Interface ExpressionsBasedModel.EntityMap

All Superinterfaces:
Optimisation, Optimisation.ProblemStructure
All Known Implementing Classes:
ConvexData, LinearStructure
Enclosing class:
ExpressionsBasedModel

public static interface ExpressionsBasedModel.EntityMap extends Optimisation.ProblemStructure
Connects solver constraints and variables back to model entities. Used for 2 things:
  1. Solvers that manipulate models (like the IntegerSolver) need this to map between model entities and solver indices.
  2. Simplifies implementation of ExpressionsBasedModel.Integration.toModelState(org.ojalgo.optimisation.Optimisation.Result, ExpressionsBasedModel).
  • 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) and isNegated(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