Class ExpressionsBasedModel
- java.lang.Object
-
- org.ojalgo.optimisation.ExpressionsBasedModel
-
- All Implemented Interfaces:
Optimisation
,Optimisation.Model
public final class ExpressionsBasedModel extends java.lang.Object implements Optimisation.Model
Lets you construct optimisation problems by combining (mathematical) expressions in terms of variables. Each expression or variable can be a constraint and/or contribute to the objective function. An expression or variable is turned into a constraint by setting a lower and/or upper limit. Use ModelEntity.lower(Comparable), ModelEntity.upper(Comparable) or ModelEntity.level(Comparable). An expression or variable is made part of (contributing to) the objective function by setting a contribution weight. Use ModelEntity.weight(Comparable).
You may think of variables as simple (the simplest possible) expressions, and of expressions as weighted combinations of variables. They are both model entities and it is as such they can be turned into constraints and set to contribute to the objective function. Alternatively you may choose to disregard the fact that variables are model entities and simply treat them as index values. In this case everything (constraints and objective) needs to be defined using expressions.
Basic instructions:
- Define (create) a set of variables. Set contribution weights and lower/upper limits as needed.
- Create a model using that set of variables.
- Add expressions to the model. The model is the expression factory. Set contribution weights and lower/upper limits as needed.
- Solve your problem using either minimise() or maximise()
When using this class you do not need to worry about which solver will actually be used. The docs of the various solvers describe requirements on input formats and similar. This is handled for you and should absolutely NOT be considered here! Compared to using the various solvers directly this class actually does something for you:
- You can model your problems without worrying about specific solver requirements.
- It knows which solver to use.
- It knows how to use that solver.
- It has a presolver that tries to simplify the problem before invoking a solver (sometimes it turns out there is no need to invoke a solver at all).
- When/if needed it scales problem parameters, before creating solver specific data structures, to minimise numerical problems in the solvers.
- It's the only way to access the integer solver.
Different solvers can be used, and ojAlgo comes with collection built in. The default built-in solvers can handle anything you can model with a couple of restrictions:
- No quadratic constraints (The plan is that future versions should not have this limitation.)
- If you use quadratic expressions make sure they're convex. This is most likely a requirement even with 3:d party solvers.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
ExpressionsBasedModel.DefaultIntermediate
static class
ExpressionsBasedModel.Description
Counts of different kinds of model entities.static interface
ExpressionsBasedModel.EntityMap
Connects solver constraints and variables back to model entities.static class
ExpressionsBasedModel.FileFormat
static class
ExpressionsBasedModel.Integration<S extends Optimisation.Solver>
Optimisation.Solver
:s that should be usabale fromExpressionsBasedModel
needs to implement a subclass of this.static class
ExpressionsBasedModel.Presolver
(package private) static class
ExpressionsBasedModel.Simplifier<ME extends ModelEntity<?>,S extends ExpressionsBasedModel.Simplifier<?,?>>
static class
ExpressionsBasedModel.Validator
(package private) static class
ExpressionsBasedModel.VariableAnalyser
(package private) static class
ExpressionsBasedModel.VariablesCategorisation
-
Nested classes/interfaces inherited from interface org.ojalgo.optimisation.Optimisation
Optimisation.Constraint, Optimisation.ConstraintType, 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 static java.util.List<ExpressionsBasedModel.Integration<?>>
INTEGRATIONS
private java.util.Map<java.lang.String,Expression>
myExpressions
private java.util.Set<Structure1D.IntIndex>
myFixedVariables
private boolean
myInfeasible
private boolean
myIntegrationSwitch
private Optimisation.Result
myKnownSolution
private java.math.BigDecimal
myObjectiveConstant
private Optimisation.Sense
myOptimisationSense
private java.util.Set<Structure1D.IntIndex>
myReferences
private boolean
myRelaxed
private boolean
myShallowCopy
A shallow copy may share complex/large data structures with other models - typically the Map:s holding Expression parameters.private java.util.Set<Structure1D.IntIndex>
myTemporary
Temporary storage for some expression specific subset of variablesprivate java.util.function.BiConsumer<ExpressionsBasedModel,Access1D<java.math.BigDecimal>>
myValidationFailureHandler
private java.util.ArrayList<Variable>
myVariables
private ExpressionsBasedModel.VariablesCategorisation
myVariablesCategorisation
private static java.lang.String
NEW_LINE
private static java.lang.String
OBJ_FUNC_AS_CONSTR_KEY
private static java.lang.String
OBJECTIVE
Optimisation.Options
options
(package private) static java.util.TreeSet<ExpressionsBasedModel.Presolver>
PRESOLVERS
private static java.lang.String
START_END
-
Constructor Summary
Constructors Constructor Description ExpressionsBasedModel()
ExpressionsBasedModel(ExpressionsBasedModel modelToCopy, boolean shallow, boolean prune)
ExpressionsBasedModel(Optimisation.Options optimisationOptions)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Expression
addExpression()
Expression
addExpression(java.lang.String name)
static boolean
addIntegration(ExpressionsBasedModel.Integration<?> integration)
Add an integration for a solver that will be used rather than the built-in solvers(package private) void
addObjectiveConstant(java.math.BigDecimal addition)
static boolean
addPresolver(ExpressionsBasedModel.Presolver presolver)
(package private) void
addReference(Structure1D.IntIndex index)
void
addSpecialOrderedSet(java.util.Collection<Variable> orderedSet, int min, int max)
Calling this method will create 2 things: A simple expression meassuring the sum of the (binary) variable values (the number of binary variables that are "ON").void
addSpecialOrderedSet(java.util.Collection<Variable> orderedSet, int type, Expression linkedTo)
Creates a special ordered set (SOS) presolver instance and links that to the supplied expression.Variable
addVariable()
Variable
addVariable(java.lang.String name)
java.util.stream.Stream<Variable>
bounds()
boolean
checkSimilarity(Expression potential)
static void
clearIntegrations()
static void
clearPresolvers()
java.util.stream.Stream<Expression>
constraints()
Returns a prefiltered stream of expressions that are constraints and have not been markes as redundant.ExpressionsBasedModel
copy()
ExpressionsBasedModel
copy(boolean relax)
ExpressionsBasedModel
copy(boolean shallow, boolean prune)
int
countExpressions()
int
countVariables()
(package private) int
deriveAdjustmentRange(Expression expression)
ExpressionsBasedModel.Description
describe()
Counts variables and expressions of different categories.void
dispose()
Cleanup when a model instance is no longer needed.(package private) java.util.stream.Stream<Expression>
expressions()
Expression
getExpression(java.lang.String name)
java.util.Collection<Expression>
getExpressions()
java.util.Set<Structure1D.IntIndex>
getFixedVariables()
java.util.List<Variable>
getFreeVariables()
java.util.List<Variable>
getIntegerVariables()
(package private) ExpressionsBasedModel.Integration<?>
getIntegration()
(package private) Optimisation.Result
getKnownSolution()
java.util.List<Variable>
getNegativeVariables()
(package private) java.math.BigDecimal
getObjectiveConstant()
Optimisation.Sense
getOptimisationSense()
The default optimisation sense isOptimisation.Sense.MIN
If this model was read from a file and that file format contained information about being a minimisation or maximisation model, that info is reflected here.java.util.List<Variable>
getPositiveVariables()
Returns a list of the variables that are not fixed at a specific value and whos range include positive values and/or zero(package private) java.util.Set<Structure1D.IntIndex>
getReferences()
(package private) java.util.function.BiConsumer<ExpressionsBasedModel,Access1D<java.math.BigDecimal>>
getValidationFailureHandler()
Variable
getVariable(int index)
Variable
getVariable(Structure1D.IntIndex index)
java.util.List<Variable>
getVariables()
Optimisation.Result
getVariableValues()
Optimisation.Result
getVariableValues(NumberContext validationContext)
Null variable values are replaced with 0.0.int
indexOf(Variable variable)
int
indexOfFreeVariable(int globalIndex)
int
indexOfFreeVariable(Variable variable)
int
indexOfFreeVariable(Structure1D.IntIndex variableIndex)
int
indexOfIntegerVariable(int globalIndex)
int
indexOfIntegerVariable(Variable variable)
int
indexOfIntegerVariable(Structure1D.IntIndex variableIndex)
int
indexOfNegativeVariable(int globalIndex)
int
indexOfNegativeVariable(Variable variable)
int
indexOfNegativeVariable(Structure1D.IntIndex variableIndex)
int
indexOfPositiveVariable(int globalIndex)
int
indexOfPositiveVariable(Variable variable)
int
indexOfPositiveVariable(Structure1D.IntIndex variableIndex)
boolean
isAnyConstraintQuadratic()
boolean
isAnyExpressionQuadratic()
Objective or any constraint has quadratic part.boolean
isAnyObjectiveQuadratic()
boolean
isAnyVariableFixed()
boolean
isAnyVariableInteger()
(package private) boolean
isFixed()
(package private) boolean
isInfeasible()
(package private) boolean
isInteger(java.util.Set<Structure1D.IntIndex> variables)
(package private) boolean
isIntegrationSwitch()
(package private) boolean
isReferenced(Variable variable)
(package private) boolean
isRelaxed()
(package private) boolean
isShallowCopy()
(package private) boolean
isUnbounded()
Expression
limitObjective(java.math.BigDecimal lower, java.math.BigDecimal upper)
Optimisation.Result
maximise()
Optimisation.Result
minimise()
Expression
newExpression(java.lang.String name)
Variable
newVariable(java.lang.String name)
Expression
objective()
This is generated on demand – you should not cache this.private Optimisation.Result
optimise()
static ExpressionsBasedModel
parse(java.io.File file)
Apart from the "native" EBM file format, currently only supports the MPS file format, but with some of the various extensions.static ExpressionsBasedModel
parse(java.io.InputStream input, ExpressionsBasedModel.FileFormat format)
<T extends IntermediateSolver>
Tprepare(java.util.function.Function<ExpressionsBasedModel,T> factory)
The general recommendation is to NOT call this method directly.(package private) void
presolve()
ExpressionsBasedModel
reduce()
Will try to indentify constraints with equal variables set, and check if those can be combined or not.void
relax()
void
relax(boolean soft)
void
removeExpression(java.lang.String name)
static boolean
removeIntegration(ExpressionsBasedModel.Integration<?> integration)
static boolean
removePresolver(ExpressionsBasedModel.Presolver presolver)
static void
resetPresolvers()
private void
scanEntities()
(package private) void
setInfeasible()
(package private) void
setIntegrationSwitch(boolean value)
void
setKnownSolution(Optimisation.Result knownSolution)
Same assetKnownSolution(org.ojalgo.optimisation.Optimisation.Result, BiConsumer)
but with a no-op handler.void
setKnownSolution(Optimisation.Result knownSolution, java.util.function.BiConsumer<ExpressionsBasedModel,Access1D<java.math.BigDecimal>> handler)
For test/validation during solver development.(package private) void
setOptimisationSense(Optimisation.Sense optimisationSense)
ExpressionsBasedModel
simplify()
Will perform presolve and then create a copy removing redundant constraint expressions, and pruning the remaining ones to no longer include fixed variables.ExpressionsBasedModel
snapshot()
Will create a shallow copy flagged as relaxed.(package private) Structure1D.IntIndex
toIntIndex(int index)
(package private) Structure2D.IntRowColumn
toIntRowColumn(int row, int column)
java.lang.String
toString()
boolean
validate()
This methods validtes model construction only.boolean
validate(BasicLogger appender)
boolean
validate(Access1D<java.math.BigDecimal> solution)
boolean
validate(Access1D<java.math.BigDecimal> solution, BasicLogger appender)
boolean
validate(Access1D<java.math.BigDecimal> solution, NumberContext context)
boolean
validate(Access1D<java.math.BigDecimal> solution, NumberContext context, BasicLogger appender)
boolean
validate(NumberContext context)
boolean
validate(NumberContext context, BasicLogger appender)
java.util.stream.Stream<Variable>
variables()
Returns a stream of variables that are not fixed.void
writeTo(java.io.File file)
Save this instance to file.void
writeTo(InMemoryFile file)
-
-
-
Field Detail
-
INTEGRATIONS
private static final java.util.List<ExpressionsBasedModel.Integration<?>> INTEGRATIONS
-
NEW_LINE
private static final java.lang.String NEW_LINE
- See Also:
- Constant Field Values
-
OBJ_FUNC_AS_CONSTR_KEY
private static final java.lang.String OBJ_FUNC_AS_CONSTR_KEY
-
OBJECTIVE
private static final java.lang.String OBJECTIVE
- See Also:
- Constant Field Values
-
START_END
private static final java.lang.String START_END
- See Also:
- Constant Field Values
-
PRESOLVERS
static final java.util.TreeSet<ExpressionsBasedModel.Presolver> PRESOLVERS
-
options
public final Optimisation.Options options
-
myExpressions
private final java.util.Map<java.lang.String,Expression> myExpressions
-
myFixedVariables
private final java.util.Set<Structure1D.IntIndex> myFixedVariables
-
myInfeasible
private transient boolean myInfeasible
-
myIntegrationSwitch
private boolean myIntegrationSwitch
-
myKnownSolution
private Optimisation.Result myKnownSolution
-
myObjectiveConstant
private java.math.BigDecimal myObjectiveConstant
-
myOptimisationSense
private Optimisation.Sense myOptimisationSense
-
myReferences
private final java.util.Set<Structure1D.IntIndex> myReferences
-
myRelaxed
private boolean myRelaxed
-
myShallowCopy
private final boolean myShallowCopy
A shallow copy may share complex/large data structures with other models - typically the Map:s holding Expression parameters.
-
myTemporary
private final java.util.Set<Structure1D.IntIndex> myTemporary
Temporary storage for some expression specific subset of variables
-
myValidationFailureHandler
private java.util.function.BiConsumer<ExpressionsBasedModel,Access1D<java.math.BigDecimal>> myValidationFailureHandler
-
myVariables
private final java.util.ArrayList<Variable> myVariables
-
myVariablesCategorisation
private final ExpressionsBasedModel.VariablesCategorisation myVariablesCategorisation
-
-
Constructor Detail
-
ExpressionsBasedModel
public ExpressionsBasedModel()
-
ExpressionsBasedModel
public ExpressionsBasedModel(Optimisation.Options optimisationOptions)
-
ExpressionsBasedModel
ExpressionsBasedModel(ExpressionsBasedModel modelToCopy, boolean shallow, boolean prune)
-
-
Method Detail
-
addIntegration
public static boolean addIntegration(ExpressionsBasedModel.Integration<?> integration)
Add an integration for a solver that will be used rather than the built-in solvers
-
addPresolver
public static boolean addPresolver(ExpressionsBasedModel.Presolver presolver)
-
clearIntegrations
public static void clearIntegrations()
-
clearPresolvers
public static void clearPresolvers()
-
parse
public static ExpressionsBasedModel parse(java.io.File file)
Apart from the "native" EBM file format, currently only supports the MPS file format, but with some of the various extensions. In particular it is possible to parse QP models using QUADOBJ or QMATRIX file sections.
-
parse
public static ExpressionsBasedModel parse(java.io.InputStream input, ExpressionsBasedModel.FileFormat format)
-
removeIntegration
public static boolean removeIntegration(ExpressionsBasedModel.Integration<?> integration)
-
removePresolver
public static boolean removePresolver(ExpressionsBasedModel.Presolver presolver)
-
resetPresolvers
public static void resetPresolvers()
-
addExpression
public Expression addExpression()
-
addExpression
public Expression addExpression(java.lang.String name)
-
addSpecialOrderedSet
public void addSpecialOrderedSet(java.util.Collection<Variable> orderedSet, int type, Expression linkedTo)
Creates a special ordered set (SOS) presolver instance and links that to the supplied expression. When/if the presolver concludes that the SOS "constraints" are not possible the linked expression is marked as infeasible.
-
addSpecialOrderedSet
public void addSpecialOrderedSet(java.util.Collection<Variable> orderedSet, int min, int max)
Calling this method will create 2 things:- A simple expression meassuring the sum of the (binary) variable values (the number of binary
variables that are "ON"). The upper, and optionally lower, limits are set as defined by the
max
andmin
parameter values. - A custom presolver (specific to this SOS) to be used by the MIP solver. This presolver help to keep track of which combinations of variable values or feasible, and is the only thing that enforces the order.
- Parameters:
orderedSet
- The set members in correct order. Each of these variables must be binary.min
- The minimum number of binary varibales in the set that must be "ON" (Set this to 0 if there is no minimum.)max
- The SOS type or maximum number of binary varibales in the set that may be "ON"
- A simple expression meassuring the sum of the (binary) variable values (the number of binary
variables that are "ON"). The upper, and optionally lower, limits are set as defined by the
-
addVariable
public Variable addVariable()
-
addVariable
public Variable addVariable(java.lang.String name)
-
bounds
public java.util.stream.Stream<Variable> bounds()
- Returns:
- A prefiltered stream of variables that are constraints and not fixed
-
checkSimilarity
public boolean checkSimilarity(Expression potential)
-
constraints
public java.util.stream.Stream<Expression> constraints()
Returns a prefiltered stream of expressions that are constraints and have not been markes as redundant.
-
copy
public ExpressionsBasedModel copy()
-
copy
public ExpressionsBasedModel copy(boolean relax)
-
copy
public ExpressionsBasedModel copy(boolean shallow, boolean prune)
-
countExpressions
public int countExpressions()
-
countVariables
public int countVariables()
-
describe
public ExpressionsBasedModel.Description describe()
Counts variables and expressions of different categories.
-
dispose
public void dispose()
Description copied from interface:Optimisation.Model
Cleanup when a model instance is no longer needed.- Specified by:
dispose
in interfaceOptimisation.Model
-
getExpression
public Expression getExpression(java.lang.String name)
-
getExpressions
public java.util.Collection<Expression> getExpressions()
-
getFixedVariables
public java.util.Set<Structure1D.IntIndex> getFixedVariables()
-
getFreeVariables
public java.util.List<Variable> getFreeVariables()
- Returns:
- A list of the variables that are not fixed at a specific value
-
getIntegerVariables
public java.util.List<Variable> getIntegerVariables()
- Returns:
- A list of the variables that are not fixed at a specific value and are marked as integer variables
-
getNegativeVariables
public java.util.List<Variable> getNegativeVariables()
- Returns:
- A list of the variables that are not fixed at a specific value and whos range include negative values
-
getOptimisationSense
public Optimisation.Sense getOptimisationSense()
- The default optimisation sense is
Optimisation.Sense.MIN
- If this model was read from a file and that file format contained information about being a minimisation or maximisation model, that info is reflected here.
- In general you are expected to know whether to call
minimise()
ormaximise()
. Once you have called one of those methods this method's return value will match that.
- The default optimisation sense is
-
getPositiveVariables
public java.util.List<Variable> getPositiveVariables()
Returns a list of the variables that are not fixed at a specific value and whos range include positive values and/or zero
-
getVariable
public Variable getVariable(int index)
-
getVariable
public Variable getVariable(Structure1D.IntIndex index)
-
getVariables
public java.util.List<Variable> getVariables()
-
getVariableValues
public Optimisation.Result getVariableValues()
-
getVariableValues
public Optimisation.Result getVariableValues(NumberContext validationContext)
Null variable values are replaced with 0.0. If any variable value is null the state is set to INFEASIBLE even if zero would actually be a feasible value. The objective function value is not calculated for infeasible variable values.
-
indexOf
public int indexOf(Variable variable)
-
indexOfFreeVariable
public int indexOfFreeVariable(int globalIndex)
- Parameters:
globalIndex
- General, global, variable index- Returns:
- Local index among the free variables. -1 indicates the variable is not a free variable.
-
indexOfFreeVariable
public int indexOfFreeVariable(Structure1D.IntIndex variableIndex)
-
indexOfFreeVariable
public int indexOfFreeVariable(Variable variable)
-
indexOfIntegerVariable
public int indexOfIntegerVariable(int globalIndex)
- Parameters:
globalIndex
- General, global, variable index- Returns:
- Local index among the integer variables. -1 indicates the variable is not an integer variable.
-
indexOfIntegerVariable
public int indexOfIntegerVariable(Structure1D.IntIndex variableIndex)
-
indexOfIntegerVariable
public int indexOfIntegerVariable(Variable variable)
-
indexOfNegativeVariable
public int indexOfNegativeVariable(int globalIndex)
- Parameters:
globalIndex
- General, global, variable index- Returns:
- Local index among the negative variables. -1 indicates the variable is not a negative variable.
-
indexOfNegativeVariable
public int indexOfNegativeVariable(Structure1D.IntIndex variableIndex)
-
indexOfNegativeVariable
public int indexOfNegativeVariable(Variable variable)
-
indexOfPositiveVariable
public int indexOfPositiveVariable(int globalIndex)
- Parameters:
globalIndex
- General, global, variable index- Returns:
- Local index among the positive variables. -1 indicates the variable is not a positive variable.
-
indexOfPositiveVariable
public int indexOfPositiveVariable(Structure1D.IntIndex variableIndex)
-
indexOfPositiveVariable
public int indexOfPositiveVariable(Variable variable)
-
isAnyConstraintQuadratic
public boolean isAnyConstraintQuadratic()
-
isAnyExpressionQuadratic
public boolean isAnyExpressionQuadratic()
Objective or any constraint has quadratic part.
-
isAnyObjectiveQuadratic
public boolean isAnyObjectiveQuadratic()
-
isAnyVariableFixed
public boolean isAnyVariableFixed()
-
isAnyVariableInteger
public boolean isAnyVariableInteger()
-
limitObjective
public Expression limitObjective(java.math.BigDecimal lower, java.math.BigDecimal upper)
-
maximise
public Optimisation.Result maximise()
- Specified by:
maximise
in interfaceOptimisation.Model
-
minimise
public Optimisation.Result minimise()
- Specified by:
minimise
in interfaceOptimisation.Model
-
newExpression
public Expression newExpression(java.lang.String name)
-
newVariable
public Variable newVariable(java.lang.String name)
-
objective
public Expression objective()
This is generated on demand – you should not cache this. More specifically, modifications made to this expression will not be part of the optimisation model. You define the objective by setting theModelEntity.weight(Comparable)
/ModelEntity.weight(Comparable)
on one or more variables and/or expressions.- Returns:
- The generated/aggregated objective function
-
prepare
public <T extends IntermediateSolver> T prepare(java.util.function.Function<ExpressionsBasedModel,T> factory)
The general recommendation is to NOT call this method directly. Instead you should use/call
maximise()
orminimise()
.The primary use case for this method is as a callback method for solvers that iteratively modifies the model and solves at each iteration point.
With direct usage of this method:
- Maximisation/Minimisation is undefined (you don't know which it is)
- The solution is not written back to the model
- The solution is not validated by the model
-
reduce
public ExpressionsBasedModel reduce()
Will try to indentify constraints with equal variables set, and check if those can be combined or not. This is a relatively slow process with small chance to actually achieve somthing. Therefore it is not part of the default presolve ochsimplify()
functionality.- See Also:
Presolvers.reduce(Collection)
-
relax
public void relax()
-
relax
public void relax(boolean soft)
- Parameters:
soft
- If true the integer variables are still identified as such, but the model is flagged as non-integer (will not use theIntegerSolver
, but presolve and validation may still recognise the variables' integer property). If false the integer property of any/all variables are removed.
-
removeExpression
public void removeExpression(java.lang.String name)
-
setKnownSolution
public void setKnownSolution(Optimisation.Result knownSolution)
Same assetKnownSolution(org.ojalgo.optimisation.Optimisation.Result, BiConsumer)
but with a no-op handler.
-
setKnownSolution
public void setKnownSolution(Optimisation.Result knownSolution, java.util.function.BiConsumer<ExpressionsBasedModel,Access1D<java.math.BigDecimal>> handler)
For test/validation during solver development.- Parameters:
knownSolution
- The optimal solutionhandler
- What to do if validation fails
-
simplify
public ExpressionsBasedModel simplify()
Will perform presolve and then create a copy removing redundant constraint expressions, and pruning the remaining ones to no longer include fixed variables.
-
snapshot
public ExpressionsBasedModel snapshot()
Will create a shallow copy flagged as relaxed.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
validate
public boolean validate()
This methods validtes model construction only. All the other validate(...) method validates the solution (one way or another).- Specified by:
validate
in interfaceOptimisation.Model
- Returns:
- true If eveything is ok. false The model is structurally ok, but the "value" breaks constraints - the solution is infeasible.
- See Also:
Optimisation.Model.validate()
-
validate
public boolean validate(Access1D<java.math.BigDecimal> solution)
-
validate
public boolean validate(Access1D<java.math.BigDecimal> solution, BasicLogger appender)
-
validate
public boolean validate(Access1D<java.math.BigDecimal> solution, NumberContext context)
-
validate
public boolean validate(Access1D<java.math.BigDecimal> solution, NumberContext context, BasicLogger appender)
-
validate
public boolean validate(BasicLogger appender)
-
validate
public boolean validate(NumberContext context)
-
validate
public boolean validate(NumberContext context, BasicLogger appender)
-
variables
public java.util.stream.Stream<Variable> variables()
Returns a stream of variables that are not fixed.
-
writeTo
public void writeTo(java.io.File file)
Save this instance to file. The file format isExpressionsBasedModel.FileFormat.EBM
and the file name is therefore recommended to end with ".ebm".- Parameters:
file
- The path/name of the file to write.
-
writeTo
public void writeTo(InMemoryFile file)
-
optimise
private Optimisation.Result optimise()
-
scanEntities
private void scanEntities()
-
addObjectiveConstant
void addObjectiveConstant(java.math.BigDecimal addition)
-
addReference
void addReference(Structure1D.IntIndex index)
-
deriveAdjustmentRange
int deriveAdjustmentRange(Expression expression)
-
expressions
java.util.stream.Stream<Expression> expressions()
-
getIntegration
ExpressionsBasedModel.Integration<?> getIntegration()
-
getKnownSolution
Optimisation.Result getKnownSolution()
-
getObjectiveConstant
java.math.BigDecimal getObjectiveConstant()
-
getReferences
java.util.Set<Structure1D.IntIndex> getReferences()
-
getValidationFailureHandler
java.util.function.BiConsumer<ExpressionsBasedModel,Access1D<java.math.BigDecimal>> getValidationFailureHandler()
-
isFixed
boolean isFixed()
-
isInfeasible
boolean isInfeasible()
-
isInteger
boolean isInteger(java.util.Set<Structure1D.IntIndex> variables)
-
isIntegrationSwitch
boolean isIntegrationSwitch()
-
isReferenced
boolean isReferenced(Variable variable)
-
isRelaxed
boolean isRelaxed()
-
isShallowCopy
boolean isShallowCopy()
-
isUnbounded
boolean isUnbounded()
-
presolve
void presolve()
-
setInfeasible
void setInfeasible()
-
setIntegrationSwitch
void setIntegrationSwitch(boolean value)
-
setOptimisationSense
void setOptimisationSense(Optimisation.Sense optimisationSense)
-
toIntIndex
Structure1D.IntIndex toIntIndex(int index)
-
toIntRowColumn
Structure2D.IntRowColumn toIntRowColumn(int row, int column)
-
-