Follow us on Twitter and LinkedIn to get the latest updates from the dev team!
Represents an AMPL variable. Note that, in case of a scalar variable, all the properties (corresponding to AMPL suffixes) of the variable instance can be accessed through corresponding properties on the Variable itself. The properties have the same name of the corresponding AMPL suffixes. See http://www.ampl.com/NEW/suffbuiltin.html for a list of the available suffixes. An ArgumentException is thrown if one of such methods is called for a non-scalar variable. An ArgumentOutOfRangeException is thrown if any property of an entity which has been deleted from the underlying interpreter is accessed. The instances, represented by the class ampl.VariableInstance can be accessed via the indexing operator, via the method ampl.Entities.Variable.Get or via the iterator provided. To gain access to all the values in an entity (for all instances and all suffixes for that entities), see ampl.Entities.Entity.GetValues and the ampl.DataFrame class.
ArgumentException
ArgumentOutOfRangeException
ampl.VariableInstance
ampl.Entities.Variable.Get
ampl.Entities.Entity.GetValues
ampl.DataFrame
ampl.Entities
AMPL
Inheritance Hierarchy
Syntax
Properties
Methods
System.Object
ampl.Entities.Entity
ampl.Entities.Entity{VariableInstance}
ampl.Entities.Variable
[ClassInterface(ClassInterfaceType.None)] public class Variable : Entity<VariableInstance>, IEnumerable<VariableInstance>, IEnumerable, IVariable
Get the AMPL status of this variable (fixed, presolved or substituted) (valid for scalar variables only)
System.String
public string Astatus { get; }
Get the index in _con of "definining constraint" used to substitute this variable out (valid for scalar variables only)
_con
System.Int32
public int Defeqn { get; }
Get the dual value on the defining constraint of this variable (valid for scalar variables only)
System.Double
public double Dual { get; }
Get the current initial guess (valid for scalar variables only)
public double Init { get; }
Get the original initial guess (set by := or by a default instruction or a data statement (valid for scalar variables only)
:=
default
public double Init0 { get; }
Get the instance with the specified index
VariableInstance
public VariableInstance this[Tuple t] { get; }
Get the current lower bound (valid for scalar variables only)
public double Lb { get; }
Get the initial lower bound (valid for scalar variables only)
public double Lb0 { get; }
Get the weaker lower bound from AMPL's presolve phase (valid for scalar variables only)
public double Lb1 { get; }
Get the stronger lower bound from AMPL's presolve phase (valid for scalar variables only)
public double Lb2 { get; }
Get the reduced cost at lower bound (valid for scalar variables only)
public double Lrc { get; }
Get the slack at lower bound val - lb (valid for scalar variables only)
val - lb
public double Lslack { get; }
Get the reduced cost at the nearer bound (valid for scalar variables only)
public double Rc { get; }
Get the bound slack which is the lesser of ampl.Entities.Variable.Lslack or ampl.Entities.Variable.Uslack (valid for scalar variables only)
ampl.Entities.Variable.Lslack
ampl.Entities.Variable.Uslack
public double Slack { get; }
Solver status (basis status of variable). Valid for scalar variables only.
public string Sstatus { get; }
AMPL status if not in, otherwise solver status (valid for scalar variables only)
in
public string Status { get; }
Get the current upper bound (valid for scalar variables only)
public double Ub { get; }
Get the initial upper bound (valid for scalar variables only)
public double Ub0 { get; }
Get the weaker upper bound from AMPL's presolve phase (valid for scalar variables only)
public double Ub1 { get; }
Get the stronger upper bound from AMPL's presolve phase (valid for scalar variables only)
public double Ub2 { get; }
Get the reduced cost at upper bound (valid for scalar variables only)
public double Urc { get; }
Get the slack at upper bound ub - val (valid for scalar variables only)
ub - val
public double Uslack { get; }
Get or set the current value of this variable (valid for scalar variables only)
public double Value { get; set; }
Fix all instances of this variable to their current value
public void Fix()
Fix this variable to the specified value (valid for scalar variables only)
value (System.Double) – Value to fix the variable to
public void Fix(double value)
public VariableInstance Get(params object[] index)
public override VariableInstance Get(Tuple t = null)
Get an enumerator to iterate through the instances in this entity
System.Collections.Generic.IEnumerator<VariableInstance>
public override IEnumerator<VariableInstance> GetEnumerator()
Unfix all instances of this variable
public void Unfix()