VariableInstance ================ .. java:package:: com.ampl :noindex: .. java:type:: public class VariableInstance extends BasicInstance A decision variable instance. Each member of this class belongs to a single \ :java:ref:`Variable`\ . Note that accessors available here are replicated at \ :java:ref:`Variable`\ level for ease of use when dealing with scalar variables. All AMPL suffixes for an algebraic variable are available through methods with the same name in this class. See http://www.ampl.com/NEW/suffbuiltin.html for a list of the available suffixes. All the accessors in this class throw a :java:ref:`IllegalArgumentException` if the instance has been deleted in the underlying AMPL interpreter. Constructors ------------ VariableInstance ^^^^^^^^^^^^^^^^ .. java:constructor:: VariableInstance(VariableInstanceBase impl) :outertype: VariableInstance Methods ------- astatus ^^^^^^^ .. java:method:: public String astatus() :outertype: VariableInstance Get the AMPL status (fixed, presolved, or substituted out) defeqn ^^^^^^ .. java:method:: public int defeqn() :outertype: VariableInstance Get the index in \ ``_con``\ of "defining constraint" used to substitute variable out dual ^^^^ .. java:method:: public double dual() :outertype: VariableInstance Get the dual value on defining constraint of variable substituted out fix ^^^ .. java:method:: public void fix() :outertype: VariableInstance Fix all instances of this variable to their current value, equivalent to: .. parsed-literal:: fix varname; fix ^^^ .. java:method:: public void fix(double value) :outertype: VariableInstance (for scalar variables) fix the variable to the specified value, equivalent to: .. parsed-literal:: fix varname := value; impl ^^^^ .. java:method:: VariableInstanceBase impl() :outertype: VariableInstance init ^^^^ .. java:method:: public double init() :outertype: VariableInstance Get the current initial guess init0 ^^^^^ .. java:method:: public double init0() :outertype: VariableInstance Get the original initial guess (set by \ ``:=``\ or \ ``default``\ or by a data statement) lb ^^ .. java:method:: public double lb() :outertype: VariableInstance Returns the current lower bound. See :ref:`secVariableSuffixesNotes`. lb0 ^^^ .. java:method:: public double lb0() :outertype: VariableInstance Returns the initial lower bounds, from the var declaration lb1 ^^^ .. java:method:: public double lb1() :outertype: VariableInstance Returns the weaker lower bound from AMPL's presolve phase lb2 ^^^ .. java:method:: public double lb2() :outertype: VariableInstance Returns the stronger lower bound from AMPL's presolve phase lrc ^^^ .. java:method:: public double lrc() :outertype: VariableInstance Returns the reduced cost at lower bound lslack ^^^^^^ .. java:method:: public double lslack() :outertype: VariableInstance Return the slack at lower bound (\ ``val - lb``\ ). See :ref:`secVariableSuffixesNotes`. rc ^^ .. java:method:: public double rc() :outertype: VariableInstance Get the reduced cost (at the nearer bound) setValue ^^^^^^^^ .. java:method:: public void setValue(double value) :outertype: VariableInstance Set the current value of this variable instance :param value: Value to be set slack ^^^^^ .. java:method:: public double slack() :outertype: VariableInstance Returns the bound slack which is the lesser of :java:ref:`lslack` and :java:ref:`uslack`. See :ref:`secVariableSuffixesNotes`. sstatus ^^^^^^^ .. java:method:: public String sstatus() :outertype: VariableInstance Solver status (basis status of variable) status ^^^^^^ .. java:method:: public String status() :outertype: VariableInstance AMPL status if not \ ``in``\ , otherwise solver status ub ^^ .. java:method:: public double ub() :outertype: VariableInstance Returns the current upper bound. See :ref:`secVariableSuffixesNotes`. ub0 ^^^ .. java:method:: public double ub0() :outertype: VariableInstance Returns the initial upper bound, from the var declaration ub1 ^^^ .. java:method:: public double ub1() :outertype: VariableInstance Returns the weaker upper bound from AMPL's presolve phase ub2 ^^^ .. java:method:: public double ub2() :outertype: VariableInstance Returns the stronger upper bound from AMPL's presolve phase unfix ^^^^^ .. java:method:: public void unfix() :outertype: VariableInstance Unfix all instances of the current variable, equivalent to the AMPL code: .. parsed-literal:: unfix varname; urc ^^^ .. java:method:: public double urc() :outertype: VariableInstance Returns the reduced cost at upper bound uslack ^^^^^^ .. java:method:: public double uslack() :outertype: VariableInstance Return the slack at upper bound (\ ``ub - val``\ ). See :ref:`secVariableSuffixesNotes`. value ^^^^^ .. java:method:: public double value() :outertype: VariableInstance Get the current value of this variable instance