org.ojalgo.optimisation.quadratic
Class QuadraticModel

java.lang.Object
  extended by org.ojalgo.optimisation.VariablesBasedModel
      extended by org.ojalgo.optimisation.quadratic.QuadraticModel
All Implemented Interfaces:
OptimisationModel

public class QuadraticModel
extends VariablesBasedModel

Author:
apete

Constructor Summary
QuadraticModel(Set<Variable> someVariables)
           
QuadraticModel(Variable[] someVariables)
           
 
Method Summary
 Expression addCorrelationExpression(String aName, BasicMatrix aCorrelationsMatrix)
           
 Expression addEmptyQuadraticExpression(String aName)
           
 Expression addGeneralExpression(String aName)
           
 Expression addOffsetExpression(String aName, Array1Dim<BigDecimal> theOrigin)
          Generates a constraint that measures the distance from a specified point.
 Expression addSimpleWeightExpression(String aName)
           
 Expression addWeightExpression(String aName, Array1Dim<BigDecimal> theWeights)
           
 OptimisationSolver getDefaultSolver()
          No need to implement an OptimisationModel if there is not at least one matching OptimisationSolver.
 boolean isMaximisation()
           
 boolean isMinimisation()
           
 List<BigDecimal> maximise()
           
 List<BigDecimal> minimise()
           
 void setMaximisation(boolean aFlag)
          Marks the model to be a maximisation problem, or not.
 void setMinimisation(boolean aFlag)
          Marks the model to be a minimisation problem, or not.
 boolean validate()
          GenericModel is meant to be extended in parallel with GenericSolver.
 
Methods inherited from class org.ojalgo.optimisation.VariablesBasedModel
extractObjective, getComplexity, getDim, getExpression, getExpressions, getValue, getVariable, getVariables, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

QuadraticModel

public QuadraticModel(Set<Variable> someVariables)

QuadraticModel

public QuadraticModel(Variable[] someVariables)
Method Detail

addCorrelationExpression

public Expression addCorrelationExpression(String aName,
                                           BasicMatrix aCorrelationsMatrix)

addEmptyQuadraticExpression

public Expression addEmptyQuadraticExpression(String aName)

addGeneralExpression

public Expression addGeneralExpression(String aName)

addOffsetExpression

public Expression addOffsetExpression(String aName,
                                      Array1Dim<BigDecimal> theOrigin)
Generates a constraint that measures the distance from a specified point. Actually, the expression measures the square of the distance...

Parameters:
aName - An expression name
theOrigin - The "specified point"
Returns:
Expression of the square of the distance from the origin

addSimpleWeightExpression

public Expression addSimpleWeightExpression(String aName)

addWeightExpression

public Expression addWeightExpression(String aName,
                                      Array1Dim<BigDecimal> theWeights)

getDefaultSolver

public OptimisationSolver getDefaultSolver()
Description copied from interface: OptimisationModel
No need to implement an OptimisationModel if there is not at least one matching OptimisationSolver.

Specified by:
getDefaultSolver in interface OptimisationModel
Specified by:
getDefaultSolver in class VariablesBasedModel

maximise

public List<BigDecimal> maximise()

minimise

public List<BigDecimal> minimise()

validate

public boolean validate()
                 throws RecoverableCondition
Description copied from class: VariablesBasedModel
GenericModel is meant to be extended in parallel with GenericSolver. This method ensures that the model is built in a way the solver can handle.
If the solver can handle a 'relaxed' version of the model this method may return false instead of throwing a RecoverableCondition. A typical case when this method should return false is if variables are declared as integer, but the solver cannot handle this (it simply disregards that constraint).

Specified by:
validate in class VariablesBasedModel
Returns:
True if the corresponding solver can solve the problem specified by the model without errors or omissions - otherwise false.
Throws:
RecoverableCondition - If the model can be fixed during program execution (perhaps by removing a constraint).

isMaximisation

public final boolean isMaximisation()
Specified by:
isMaximisation in interface OptimisationModel
Returns:
true if this model is a maximisation problem, and false if it's a minimisation problem

isMinimisation

public final boolean isMinimisation()
Specified by:
isMinimisation in interface OptimisationModel
Returns:
true if this model is a minimisation problem, and false if it's a maximisation problem

setMaximisation

public final void setMaximisation(boolean aFlag)
Description copied from interface: OptimisationModel
Marks the model to be a maximisation problem, or not. Minimisation is the default.

Specified by:
setMaximisation in interface OptimisationModel

setMinimisation

public final void setMinimisation(boolean aFlag)
Description copied from interface: OptimisationModel
Marks the model to be a minimisation problem, or not. Minimisation is the default.

Specified by:
setMinimisation in interface OptimisationModel