Package org.ojalgo.optimisation.convex
Class ConvexData<N extends java.lang.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 java.lang.Comparable<N>> extends java.lang.Object implements ExpressionsBasedModel.EntityMap
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static interface
ConvexData.ConvexDataFactory<N extends java.lang.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
Fields Modifier and Type Field Description private RowsSupplier<N>
myAE
private RowsSupplier<N>
myAI
private PhysicalStore<N>
myBE
private PhysicalStore<N>
myBI
private ConstraintsMetaData
myConstraintsMetaData
private ConvexObjectiveFunction<N>
myObjective
private int[]
myVariableIndices
-
Fields inherited from interface org.ojalgo.optimisation.Optimisation.ProblemStructure
DEBUG
-
-
Constructor Summary
Constructors Constructor Description ConvexData(boolean inclMap, PhysicalStore.Factory<N,?> factory, int nbVars, int nbEqus, int nbIneq)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (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, java.lang.Comparable<?> value)
(package private) void
addObjective(int row, java.lang.Comparable<?> value)
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()
PhysicalStore<N>
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] <= [BI](package private) SparseArray<N>
getAI(int row)
(package private) RowsSupplier<N>
getAI(int... rows)
MatrixStore<N>
getBE()
Equality constraints RHS: [AE][X] == [BE]double
getBE(int row)
(package private) MatrixStore<N>
getBI()
Inequality constraints RHS: [AI][X] <= [BI]double
getBI(int row)
EntryPair<ModelEntity<?>,Optimisation.ConstraintType>
getConstraint(int idc)
(package private) ConstraintsMetaData
getConstraintsMetaData()
ConvexObjectiveFunction<N>
getObjective()
Access2D.RowView<N>
getRowsAE()
Access2D.RowView<N>
getRowsAI()
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
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, java.lang.Comparable<?> value)
(package private) void
setAI(int row, int col, double value)
(package private) void
setAI(int row, int col, java.lang.Comparable<?> value)
(package private) void
setBE(int row, double value)
(package private) void
setBE(int row, ModelEntity<?> entity, Optimisation.ConstraintType type, java.lang.Comparable<?> value, boolean negated)
(package private) void
setBI(int row, double value)
(package private) void
setBI(int row, ModelEntity<?> entity, Optimisation.ConstraintType type, java.lang.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, java.lang.Comparable<?> value)
(package private) void
setObjective(int row, java.lang.Comparable<?> value)
(package private) void
setVariableIndices(int indexInSolver, int indexInModel)
-
-
-
Field Detail
-
myAE
private final RowsSupplier<N extends java.lang.Comparable<N>> myAE
-
myAI
private final RowsSupplier<N extends java.lang.Comparable<N>> myAI
-
myBE
private final PhysicalStore<N extends java.lang.Comparable<N>> myBE
-
myBI
private final PhysicalStore<N extends java.lang.Comparable<N>> myBI
-
myConstraintsMetaData
private final ConstraintsMetaData myConstraintsMetaData
-
myObjective
private final ConvexObjectiveFunction<N extends java.lang.Comparable<N>> myObjective
-
myVariableIndices
private final int[] myVariableIndices
-
-
Constructor Detail
-
ConvexData
ConvexData(boolean inclMap, PhysicalStore.Factory<N,?> factory, int nbVars, int nbEqus, int nbIneq)
-
-
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
-
getAE
public PhysicalStore<N> getAE()
Equality constraints body: [AE][X] == [BE]
-
getBE
public MatrixStore<N> getBE()
Equality constraints RHS: [AE][X] == [BE]
-
getBE
public double getBE(int row)
-
getBI
public double getBI(int row)
-
getConstraint
public EntryPair<ModelEntity<?>,Optimisation.ConstraintType> getConstraint(int idc)
- Specified by:
getConstraint
in interfaceExpressionsBasedModel.EntityMap
-
getObjective
public ConvexObjectiveFunction<N> getObjective()
-
getRowsAE
public Access2D.RowView<N> getRowsAE()
-
getRowsAI
public Access2D.RowView<N> getRowsAI()
-
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 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
void addObjective(int row, java.lang.Comparable<?> value)
-
addObjective
void addObjective(int row, double value)
-
addObjective
void addObjective(int row, int col, java.lang.Comparable<?> value)
-
addObjective
void addObjective(int row, int col, double value)
-
getAE
SparseArray<N> getAE(int row)
-
getAE
RowsSupplier<N> getAE(int... rows)
-
getAI
PhysicalStore<N> getAI()
Inequality constraints body: [AI][X] <= [BI]
-
getAI
SparseArray<N> getAI(int row)
-
getAI
RowsSupplier<N> getAI(int... rows)
-
getBI
MatrixStore<N> getBI()
Inequality constraints RHS: [AI][X] <= [BI]
-
getConstraintsMetaData
ConstraintsMetaData getConstraintsMetaData()
-
reset
void reset()
-
setAE
void setAE(int row, int col, java.lang.Comparable<?> value)
-
setAE
void setAE(int row, int col, double value)
-
setAI
void setAI(int row, int col, java.lang.Comparable<?> value)
-
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, java.lang.Comparable<?> value, boolean negated)
-
setBI
void setBI(int row, double value)
-
setBI
void setBI(int row, ModelEntity<?> entity, Optimisation.ConstraintType type, java.lang.Comparable<?> value, boolean negated)
-
setEntry
void setEntry(int row, ModelEntity<?> entity, Optimisation.ConstraintType type, boolean neg)
-
setObjective
void setObjective(int row, java.lang.Comparable<?> value)
-
setObjective
void setObjective(int row, double value)
-
setObjective
void setObjective(int row, int col, java.lang.Comparable<?> value)
-
setObjective
void setObjective(int row, int col, double value)
-
setVariableIndices
void setVariableIndices(int indexInSolver, int indexInModel)
-
-