Package org.ojalgo.optimisation.convex
Class ConvexData<N extends Comparable<N>>
java.lang.Object
org.ojalgo.optimisation.convex.ConvexData<N>
- All Implemented Interfaces:
ExpressionsBasedModel.EntityMap
,Optimisation
,Optimisation.ProblemStructure
public final class ConvexData<N extends Comparable<N>>
extends Object
implements ExpressionsBasedModel.EntityMap
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static interface
ConvexData.ConvexDataFactory<N extends Comparable<N>>
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
FieldsModifier and TypeFieldDescriptionprivate final RowsSupplier
<N> private final RowsSupplier
<N> private final PhysicalStore
<N> private final PhysicalStore
<N> private final ConstraintsMetaData
private final ConvexObjectiveFunction
<N> private final int[]
Fields inherited from interface org.ojalgo.optimisation.Optimisation.ProblemStructure
DEBUG
-
Constructor Summary
ConstructorsConstructorDescriptionConvexData
(boolean inclMap, PhysicalStore.Factory<N, ?> factory, int nbVars, int nbEqus, int nbIneq) -
Method Summary
Modifier and TypeMethodDescription(package private) void
addObjective
(int row, double value) (package private) void
addObjective
(int row, int col, double value) (package private) void
addObjective
(int row, int col, Comparable<?> value) (package private) void
addObjective
(int row, Comparable<?> value) int
Not included inOptimisation.ProblemStructure.countConstraints()
(because they are not simple linear equality or inequality constraints),int
int
int
int
The number of variables, in the solver, that directly correspond to a model variable.int
The number of slack variables.int
getAE()
Equality constraints body: [AE][X] == [BE](package private) SparseArray
<N> getAE
(int row) (package private) RowsSupplier
<N> getAE
(int... rows) (package private) PhysicalStore
<N> getAI()
Inequality constraints body: [AI][X] invalid input: '<'= [BI](package private) SparseArray
<N> getAI
(int row) (package private) RowsSupplier
<N> getAI
(int... rows) getBE()
Equality constraints RHS: [AE][X] == [BE]double
getBE
(int row) (package private) MatrixStore
<N> getBI()
Inequality constraints RHS: [AI][X] invalid input: '<'= [BI]double
getBI
(int row) getConstraint
(int idc) (package private) ConstraintsMetaData
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?(package private) void
reset()
(package private) void
setAE
(int row, int col, double value) (package private) void
setAE
(int row, int col, Comparable<?> value) (package private) void
setAI
(int row, int col, double value) (package private) void
setAI
(int row, int col, Comparable<?> value) (package private) void
setBE
(int row, double value) (package private) void
setBE
(int row, ModelEntity<?> entity, Optimisation.ConstraintType type, Comparable<?> value, boolean negated) (package private) void
setBI
(int row, double value) (package private) void
setBI
(int row, ModelEntity<?> entity, Optimisation.ConstraintType type, Comparable<?> value, boolean negated) (package private) void
setEntry
(int row, ModelEntity<?> entity, Optimisation.ConstraintType type, boolean neg) (package private) void
setObjective
(int row, double value) (package private) void
setObjective
(int row, int col, double value) (package private) void
setObjective
(int row, int col, Comparable<?> value) (package private) void
setObjective
(int row, Comparable<?> value) (package private) void
setVariableIndices
(int indexInSolver, int indexInModel)
-
Field Details
-
myAE
-
myAI
-
myBE
-
myBI
-
myConstraintsMetaData
-
myObjective
-
myVariableIndices
private final int[] myVariableIndices
-
-
Constructor Details
-
ConvexData
ConvexData(boolean inclMap, PhysicalStore.Factory<N, ?> factory, int nbVars, int nbEqus, int nbIneq)
-
-
Method Details
-
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
-
getAE
Equality constraints body: [AE][X] == [BE] -
getBE
Equality constraints RHS: [AE][X] == [BE] -
getBE
public double getBE(int row) -
getBI
public double getBI(int row) -
getConstraint
- Specified by:
getConstraint
in interfaceExpressionsBasedModel.EntityMap
-
getObjective
-
getRowsAE
-
getRowsAI
-
getSlack
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 idm) 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:
idm
- Index of solver variable- Returns:
- Index of model variable (negative if no map)
-
isNegated
public boolean isNegated(int idm) Description copied from interface:ExpressionsBasedModel.EntityMap
Is this solver variable negated relative to the corresponding model variable?- Specified by:
isNegated
in interfaceExpressionsBasedModel.EntityMap
- Parameters:
idm
- Index of solver variable- Returns:
- true if this solver variable represents a negated model variable
-
addObjective
-
addObjective
void addObjective(int row, double value) -
addObjective
-
addObjective
void addObjective(int row, int col, double value) -
getAE
-
getAE
-
getAI
PhysicalStore<N> getAI()Inequality constraints body: [AI][X] invalid input: '<'= [BI] -
getAI
-
getAI
-
getBI
MatrixStore<N> getBI()Inequality constraints RHS: [AI][X] invalid input: '<'= [BI] -
getConstraintsMetaData
ConstraintsMetaData getConstraintsMetaData() -
reset
void reset() -
setAE
-
setAE
void setAE(int row, int col, double value) -
setAI
-
setAI
void setAI(int row, int col, double value) -
setBE
void setBE(int row, double value) -
setBE
void setBE(int row, ModelEntity<?> entity, Optimisation.ConstraintType type, Comparable<?> value, boolean negated) -
setBI
void setBI(int row, double value) -
setBI
void setBI(int row, ModelEntity<?> entity, Optimisation.ConstraintType type, Comparable<?> value, boolean negated) -
setEntry
-
setObjective
-
setObjective
void setObjective(int row, double value) -
setObjective
-
setObjective
void setObjective(int row, int col, double value) -
setVariableIndices
void setVariableIndices(int indexInSolver, int indexInModel)
-