Package org.ojalgo.optimisation
Class Variable
- java.lang.Object
-
- org.ojalgo.optimisation.ModelEntity<Variable>
-
- org.ojalgo.optimisation.Variable
-
- All Implemented Interfaces:
java.lang.Comparable<Variable>
,Optimisation
,Optimisation.Constraint
,Optimisation.Objective
public final class Variable extends ModelEntity<Variable>
Variable
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.ojalgo.optimisation.Optimisation
Optimisation.Constraint, Optimisation.ConstraintType, Optimisation.Integration<M extends Optimisation.Model,S extends Optimisation.Solver>, Optimisation.Model, Optimisation.Objective, Optimisation.Options, Optimisation.ProblemStructure, Optimisation.Result, Optimisation.Sense, Optimisation.Solver, Optimisation.State
-
-
Field Summary
Fields Modifier and Type Field Description private Structure1D.IntIndex
myIndex
private boolean
myInteger
private boolean
myUnbounded
private java.math.BigDecimal
myValue
-
Fields inherited from class org.ojalgo.optimisation.ModelEntity
PRINT, RANGE
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addTo(Expression target, java.math.BigDecimal scale)
protected void
appendMiddlePart(java.lang.StringBuilder builder, NumberContext display)
private void
assertFixedValue()
Variable
binary()
SeeisBinary()
.int
compareTo(Variable obj)
(package private) Variable
copy()
Internal copy that includes the index(package private) int
deriveAdjustmentExponent()
protected void
destroy()
(package private) void
doIntegerRounding()
If necessary this method should first determine if thisModelEntity
is "integer" or not.(package private) Structure1D.IntIndex
getIndex()
java.math.BigDecimal
getLowerSlack()
java.math.BigDecimal
getUpperSlack()
java.math.BigDecimal
getValue()
Variable
integer()
Variable
integer(boolean integer)
SeeisInteger()
.boolean
isBinary()
Variable can only be 0 or 1.(package private) boolean
isFixed()
boolean
isInteger()
Is this entity (all involved variables) integer?boolean
isNegative()
The range includes something < 0.0boolean
isPositive()
The range includes something > 0.0(package private) boolean
isUnbounded()
boolean
isValueSet()
Variable
lower(java.lang.Comparable<?> lower)
Extremely large (absolute value) values are treated as "no limit" (null) and extremely small values are treated as exactly 0.0, unless the input number type isBigDecimal
.java.math.BigDecimal
quantifyContribution()
Variable
relax()
(package private) void
setFixed(java.math.BigDecimal value)
void
setInteger(boolean integer)
(package private) void
setUnbounded(boolean uncorrelated)
void
setValue(java.lang.Comparable<?> value)
Variable
upper(java.lang.Comparable<?> upper)
Extremely large (absolute value) values are treated as "no limit" (null) and extremely small values are treated as exactly 0.0, unless the input number type isBigDecimal
.protected boolean
validate(java.math.BigDecimal value, NumberContext context, BasicLogger appender)
(package private) boolean
validate(java.math.BigDecimal value, NumberContext context, BasicLogger appender, boolean relaxed)
Variable
value(java.math.BigDecimal value)
-
Methods inherited from class org.ojalgo.optimisation.ModelEntity
adjust, appendLeftPart, appendRightPart, appendToString, deriveAdjustmentExponent, equals, getAdjustmentExponent, getAdjustmentExponentValue, getAdjustmentFactor, getCompensatedLowerLimit, getCompensatedLowerLimit, getCompensatedUpperLimit, getCompensatedUpperLimit, getContributionWeight, getLowerLimit, getLowerLimit, getLowerLimit, getName, getUpperLimit, getUpperLimit, getUpperLimit, hashCode, isClosedRange, isConstraint, isContributionWeightSet, isEqualityConstraint, isInfeasible, isInfeasible, isLowerConstraint, isLowerLimitSet, isObjective, isUpperConstraint, isUpperLimitSet, level, level, level, lower, lower, reverseAdjustment, shift, toAdjusted, toBigDecimal, toString, toUnadjusted, upper, upper, validate, weight, weight, weight
-
-
-
-
Field Detail
-
myIndex
private final Structure1D.IntIndex myIndex
-
myInteger
private boolean myInteger
-
myUnbounded
private transient boolean myUnbounded
-
myValue
private java.math.BigDecimal myValue
-
-
Constructor Detail
-
Variable
Variable(java.lang.String name, int index)
-
Variable
Variable(Variable variableToCopy)
-
-
Method Detail
-
addTo
public void addTo(Expression target, java.math.BigDecimal scale)
Description copied from class:ModelEntity
- Specified by:
addTo
in classModelEntity<Variable>
- Parameters:
target
- The targetExpression
scale
- The scaling factor
-
binary
public Variable binary()
SeeisBinary()
.- See Also:
ModelEntity.getUpperLimit()
,isInteger()
,isBinary()
-
compareTo
public int compareTo(Variable obj)
-
getLowerSlack
public java.math.BigDecimal getLowerSlack()
-
getUpperSlack
public java.math.BigDecimal getUpperSlack()
-
getValue
public java.math.BigDecimal getValue()
-
integer
public Variable integer()
-
integer
public Variable integer(boolean integer)
SeeisInteger()
.
-
isBinary
public boolean isBinary()
Variable can only be 0 or 1.
-
isInteger
public boolean isInteger()
Description copied from class:ModelEntity
Is this entity (all involved variables) integer?- Specified by:
isInteger
in classModelEntity<Variable>
- Returns:
- true if this is an integer variable, otherwise false
-
isNegative
public boolean isNegative()
The range includes something < 0.0
-
isPositive
public boolean isPositive()
The range includes something > 0.0
-
isValueSet
public boolean isValueSet()
-
lower
public Variable lower(java.lang.Comparable<?> lower)
Description copied from class:ModelEntity
Extremely large (absolute value) values are treated as "no limit" (null) and extremely small values are treated as exactly 0.0, unless the input number type isBigDecimal
.BigDecimal
values are always used as they are.- Overrides:
lower
in classModelEntity<Variable>
-
quantifyContribution
public java.math.BigDecimal quantifyContribution()
-
relax
public Variable relax()
-
setInteger
public void setInteger(boolean integer)
-
setValue
public void setValue(java.lang.Comparable<?> value)
-
upper
public Variable upper(java.lang.Comparable<?> upper)
Description copied from class:ModelEntity
Extremely large (absolute value) values are treated as "no limit" (null) and extremely small values are treated as exactly 0.0, unless the input number type isBigDecimal
.BigDecimal
values are always used as they are.- Overrides:
upper
in classModelEntity<Variable>
-
value
public Variable value(java.math.BigDecimal value)
-
assertFixedValue
private void assertFixedValue()
-
appendMiddlePart
protected void appendMiddlePart(java.lang.StringBuilder builder, NumberContext display)
- Overrides:
appendMiddlePart
in classModelEntity<Variable>
-
destroy
protected void destroy()
- Overrides:
destroy
in classModelEntity<Variable>
-
validate
protected boolean validate(java.math.BigDecimal value, NumberContext context, BasicLogger appender)
- Overrides:
validate
in classModelEntity<Variable>
-
copy
Variable copy()
Internal copy that includes the index
-
deriveAdjustmentExponent
int deriveAdjustmentExponent()
- Specified by:
deriveAdjustmentExponent
in classModelEntity<Variable>
-
doIntegerRounding
void doIntegerRounding()
Description copied from class:ModelEntity
If necessary this method should first determine if thisModelEntity
is "integer" or not.If it is, then verify if all variable factors are integers or if there exists a simple scalar that will make it so. If so, the lower/upper limits are "integer rounded".
- Specified by:
doIntegerRounding
in classModelEntity<Variable>
-
getIndex
Structure1D.IntIndex getIndex()
-
isFixed
boolean isFixed()
-
isUnbounded
boolean isUnbounded()
-
setFixed
void setFixed(java.math.BigDecimal value)
-
setUnbounded
void setUnbounded(boolean uncorrelated)
-
validate
boolean validate(java.math.BigDecimal value, NumberContext context, BasicLogger appender, boolean relaxed)
-
-