Package org.ojalgo.optimisation
Interface ExpressionsBasedModel.EntityMap
- All Superinterfaces:
Optimisation
,Optimisation.ProblemStructure
- All Known Implementing Classes:
ConvexData
,LinearStructure
- Enclosing class:
ExpressionsBasedModel
Connects solver constraints and variables back to model entities. Used for 2 things:
- Solvers that manipulate models (like the
IntegerSolver
) need this to map between model entities and solver indices. - Simplifies implementation of
ExpressionsBasedModel.Integration.toModelState(org.ojalgo.optimisation.Optimisation.Result, ExpressionsBasedModel)
.
-
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 inherited from interface org.ojalgo.optimisation.Optimisation.ProblemStructure
DEBUG
-
Method Summary
Modifier and TypeMethodDescriptionint
The number of variables, in the solver, that directly correspond to a model variable.int
The number of slack variables.getConstraint
(int idc) getSlack
(int ids) Returns which model entity, and constraint type, that corresponds to the slack variable at the supplied index.int
indexOf
(int idm) Converts from a solver specific variable index to the corresponding index of the variable in the model.boolean
isNegated
(int idm) Is this solver variable negated relative to the corresponding model variable?Methods inherited from interface org.ojalgo.optimisation.Optimisation.ProblemStructure
countAdditionalConstraints, countConstraints, countEqualityConstraints, countInequalityConstraints, countVariables
-
Method Details
-
countModelVariables
int countModelVariables()The number of variables, in the solver, that directly correspond to a model variable. (Not slack or artificial variables.)This defines the range of the indices that can be used with the
indexOf(int)
andisNegated(int)
methods. -
countSlackVariables
int countSlackVariables()The number of slack variables.This defines the range of the indices that can be used with the
getSlack(int)
method. -
getConstraint
-
getSlack
Returns which model entity, and constraint type, that corresponds to the slack variable at the supplied index.- Parameters:
ids
- Index of solver slack variable (If there are 3 slack variables this input argument should be in the range [0.2].)
-
indexOf
int indexOf(int idm) Converts from a solver specific variable index to the corresponding index of the variable in the model. Note that not all model variables are necessarily represented in the solver, and a model variable may result in multiple solver variables. Further, slack variables, artificial variables and such are typically not represented in the model.- Parameters:
idm
- Index of solver variable- Returns:
- Index of model variable (negative if no map)
-
isNegated
boolean isNegated(int idm) Is this solver variable negated relative to the corresponding model variable?- Parameters:
idm
- Index of solver variable- Returns:
- true if this solver variable represents a negated model variable
-