- All Implemented Interfaces:
Comparable<Variable>,Optimisation,Optimisation.Constraint,Optimisation.Objective
Variable represents a decision variable in an optimization model.
Each variable has a unique index in the model and can have:
- Lower and upper bounds (constraints)
- A contribution weight in the objective function
- An integer or continuous domain
- A current value
Variables can be configured as:
- Binary (0-1 integer variables)
- Integer (whole number values only)
- Continuous (any value within bounds)
- Fixed (equal lower and upper bounds)
- Unbounded (no effective limits)
As a subclass of ModelEntity, a Variable can function both as a constraint (through lower/upper bounds) and as an objective function component (through its contribution weight).
Variables are typically created and managed through ExpressionsBasedModel, which assigns their
indices and incorporates them into the optimization problem.
- Author:
- apete
-
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 -
Method Summary
Modifier and TypeMethodDescriptionvoidaddTo(Expression target, BigDecimal scale) protected voidappendMiddlePart(StringBuilder builder, NumberContext display) binary()SeeisBinary().intprotected voiddestroy()booleangetValue()inthashCode()integer()integer(boolean integer) SeeisInteger().booleanisBinary()Variable can only be 0 or 1.booleanIs this entity (all involved variables) integer?booleanThe range includes something invalid input: '<' 0.0booleanThe range includes something > 0.0booleanlower(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.relax()voidsetInteger(boolean integer) voidsetValue(Comparable<?> value) upper(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 booleanvalidate(BigDecimal value, NumberContext context, BasicLogger appender) value(BigDecimal value) Methods inherited from class org.ojalgo.optimisation.ModelEntity
adjust, appendLeftPart, appendRightPart, getAdjustmentExponent, getAdjustmentFactor, getContributionWeight, getLowerLimit, getLowerLimit, getLowerLimit, getName, getUpperLimit, getUpperLimit, getUpperLimit, isConstraint, isContributionWeightSet, isEqualityConstraint, isLowerConstraint, isLowerLimitSet, isObjective, isUpperConstraint, isUpperLimitSet, level, level, level, lower, lower, reverseAdjustment, shift, toAdjusted, toString, toUnadjusted, upper, upper, validate, weight, weight, weight
-
Method Details
-
addTo
Description copied from class:ModelEntity- Specified by:
addToin classModelEntity<Variable>- Parameters:
target- The targetExpressionscale- The scaling factor
-
binary
SeeisBinary().- See Also:
-
compareTo
-
equals
- Overrides:
equalsin classModelEntity<Variable>
-
getLowerSlack
-
getUpperSlack
-
getValue
-
hashCode
public int hashCode()- Overrides:
hashCodein classModelEntity<Variable>
-
integer
-
integer
SeeisInteger(). -
isBinary
public boolean isBinary()Variable can only be 0 or 1. -
isInteger
public boolean isInteger()Description copied from class:ModelEntityIs this entity (all involved variables) integer?- Specified by:
isIntegerin classModelEntity<Variable>- Returns:
- true if this is an integer variable, otherwise false
-
isNegative
public boolean isNegative()The range includes something invalid input: '<' 0.0 -
isPositive
public boolean isPositive()The range includes something > 0.0 -
isValueSet
public boolean isValueSet() -
lower
Description copied from class:ModelEntityExtremely 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.BigDecimalvalues are always used as they are.- Overrides:
lowerin classModelEntity<Variable>
-
quantifyContribution
-
relax
-
setInteger
public void setInteger(boolean integer) -
setValue
-
upper
Description copied from class:ModelEntityExtremely 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.BigDecimalvalues are always used as they are.- Overrides:
upperin classModelEntity<Variable>
-
value
-
appendMiddlePart
- Overrides:
appendMiddlePartin classModelEntity<Variable>
-
destroy
protected void destroy()- Overrides:
destroyin classModelEntity<Variable>
-
validate
- Overrides:
validatein classModelEntity<Variable>
-