Package org.ojalgo.optimisation.linear
Class LinearStructure
- java.lang.Object
-
- org.ojalgo.optimisation.linear.LinearStructure
-
- All Implemented Interfaces:
ExpressionsBasedModel.EntityMap
,Optimisation
,Optimisation.ProblemStructure
final class LinearStructure extends java.lang.Object implements ExpressionsBasedModel.EntityMap
LP (simplex tableau) meta data.
-
-
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 (package private) ConstraintsMetaData
constraints
(package private) int
nbArti
The number of artificial variables(package private) int
nbEqus
The number of equality constraints(package private) int
nbIdty
The number of slack variables that also form an identity sub-matrix (in the tableau).(package private) int
nbInes
The number of inequality constraints(package private) int
nbNegs
The number of negated model variables(package private) int
nbSlck
The number of slack variables (not known to be "identity")(package private) int
nbVars
The number of positive (as-is) model variables(package private) int[]
negativePartVariables
(package private) int[]
positivePartVariables
-
Fields inherited from interface org.ojalgo.optimisation.Optimisation.ProblemStructure
DEBUG
-
-
Constructor Summary
Constructors Constructor Description LinearStructure(boolean inclMap, int constrIn, int constrEq, int varsPos, int varsNeg, int varsSlk, int varsEye)
LinearStructure(int nbConstraints, int nbVariables)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
countAdditionalConstraints()
Not included inOptimisation.ProblemStructure.countConstraints()
(because they are not simple linear equality or inequality constraints),int
countConstraints()
int
countEqualityConstraints()
int
countInequalityConstraints()
int
countModelVariables()
The number of variables, in the solver, that directly correspond to a model variable.int
countSlackVariables()
The number of slack variables.int
countVariables()
(package private) int
countVariablesTotally()
boolean
equals(java.lang.Object obj)
EntryPair<ModelEntity<?>,Optimisation.ConstraintType>
getConstraint(int idc)
EntryPair<ModelEntity<?>,Optimisation.ConstraintType>
getSlack(int ids)
Returns which model entity, and constraint type, that corresponds to the slack variable at the supplied index.int
hashCode()
int
indexOf(int j)
Converts from a solver specific variable index to the corresponding index of the variable in the model.(package private) boolean
isAnyArtificials()
(package private) boolean
isArtificialVariable(int variableIndex)
boolean
isConstraintNegated(int i)
(package private) boolean
isFullSetOfArtificials()
(package private) boolean
isModelVariable(int variableIndex)
boolean
isNegated(int j)
Is this solver variable negated relative to the corresponding model variable?boolean
negated(int i, boolean negated)
void
setConstraintMap(int i, ModelEntity<?> entity, Optimisation.ConstraintType type)
void
setConstraintMap(int i, ModelEntity<?> entity, Optimisation.ConstraintType type, boolean negated)
void
setConstraintNegated(int i, boolean negated)
(package private) void
setObjectiveAdjustmentFactor(double multiplierScale)
java.lang.String
toString()
-
-
-
Field Detail
-
constraints
final ConstraintsMetaData constraints
-
nbArti
final int nbArti
The number of artificial variables
-
nbEqus
final int nbEqus
The number of equality constraints
-
nbIdty
final int nbIdty
The number of slack variables that also form an identity sub-matrix (in the tableau).
-
nbInes
final int nbInes
The number of inequality constraints
-
nbNegs
final int nbNegs
The number of negated model variables
-
nbSlck
final int nbSlck
The number of slack variables (not known to be "identity")
-
nbVars
final int nbVars
The number of positive (as-is) model variables
-
negativePartVariables
final int[] negativePartVariables
-
positivePartVariables
final int[] positivePartVariables
-
-
Method Detail
-
countAdditionalConstraints
public int countAdditionalConstraints()
Description copied from interface:Optimisation.ProblemStructure
Not included inOptimisation.ProblemStructure.countConstraints()
(because they are not simple linear equality or inequality constraints),- Specified by:
countAdditionalConstraints
in interfaceOptimisation.ProblemStructure
-
countConstraints
public int countConstraints()
- Specified by:
countConstraints
in interfaceOptimisation.ProblemStructure
-
countEqualityConstraints
public int countEqualityConstraints()
- Specified by:
countEqualityConstraints
in interfaceOptimisation.ProblemStructure
-
countInequalityConstraints
public int countInequalityConstraints()
- Specified by:
countInequalityConstraints
in interfaceOptimisation.ProblemStructure
-
countModelVariables
public int countModelVariables()
Description copied from interface:ExpressionsBasedModel.EntityMap
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
ExpressionsBasedModel.EntityMap.indexOf(int)
andExpressionsBasedModel.EntityMap.isNegated(int)
methods.- Specified by:
countModelVariables
in interfaceExpressionsBasedModel.EntityMap
-
countSlackVariables
public int countSlackVariables()
Description copied from interface:ExpressionsBasedModel.EntityMap
The number of slack variables.This defines the range of the indices that can be used with the
ExpressionsBasedModel.EntityMap.getSlack(int)
method.- Specified by:
countSlackVariables
in interfaceExpressionsBasedModel.EntityMap
-
countVariables
public int countVariables()
- Specified by:
countVariables
in interfaceOptimisation.ProblemStructure
-
getConstraint
public EntryPair<ModelEntity<?>,Optimisation.ConstraintType> getConstraint(int idc)
- Specified by:
getConstraint
in interfaceExpressionsBasedModel.EntityMap
-
getSlack
public EntryPair<ModelEntity<?>,Optimisation.ConstraintType> getSlack(int ids)
Description copied from interface:ExpressionsBasedModel.EntityMap
Returns which model entity, and constraint type, that corresponds to the slack variable at the supplied index.- Specified by:
getSlack
in interfaceExpressionsBasedModel.EntityMap
- Parameters:
ids
- Index of solver slack variable (If there are 3 slack variables this input argument should be in the range [0.2].)
-
indexOf
public int indexOf(int j)
Description copied from interface:ExpressionsBasedModel.EntityMap
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.- Specified by:
indexOf
in interfaceExpressionsBasedModel.EntityMap
- Parameters:
j
- Index of solver variable- Returns:
- Index of model variable (negative if no map)
-
isConstraintNegated
public boolean isConstraintNegated(int i)
-
isNegated
public boolean isNegated(int j)
Description copied from interface:ExpressionsBasedModel.EntityMap
Is this solver variable negated relative to the corresponding model variable?- Specified by:
isNegated
in interfaceExpressionsBasedModel.EntityMap
- Parameters:
j
- Index of solver variable- Returns:
- true if this solver variable represents a negated model variable
-
negated
public boolean negated(int i, boolean negated)
-
setConstraintMap
public void setConstraintMap(int i, ModelEntity<?> entity, Optimisation.ConstraintType type)
-
setConstraintMap
public void setConstraintMap(int i, ModelEntity<?> entity, Optimisation.ConstraintType type, boolean negated)
-
setConstraintNegated
public void setConstraintNegated(int i, boolean negated)
-
countVariablesTotally
int countVariablesTotally()
-
isAnyArtificials
boolean isAnyArtificials()
-
isArtificialVariable
boolean isArtificialVariable(int variableIndex)
-
isFullSetOfArtificials
boolean isFullSetOfArtificials()
-
isModelVariable
boolean isModelVariable(int variableIndex)
-
setObjectiveAdjustmentFactor
void setObjectiveAdjustmentFactor(double multiplierScale)
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-