public class MIP extends Object implements IMIP, Serializable, Cloneable
Modifier and Type | Field and Description |
---|---|
static int |
MAX_VALUE
Never give mip a number bigger than this, FOR ANY reason This should
never be greater than 1E9 per
https://support.ilog.com/public/products/faq
.cfm?Product=CPLEX&FAQ=75&CFID=
96044&CFTOKEN=40609383&jsessionid=92301560341115251663761
|
Constructor and Description |
---|
MIP() |
Modifier and Type | Method and Description |
---|---|
void |
add(Constraint constraint)
Adds a new constraint
|
String |
add(Variable var)
Adds a variable to the MIP formulation.
|
void |
addObjectiveTerm(double coefficient,
Variable var)
Adds a Term to the objective function.
|
void |
addObjectiveTerm(double coefficient,
Variable varA,
Variable varB)
Adds a Term to the objective function.
|
void |
addObjectiveTerm(LinearTerm term)
Adds a Term to the objective function.
|
void |
addObjectiveTerm(QuadraticTerm term)
Adds a Term to the objective function.
|
boolean |
clearObjective()
Removes the objective
|
void |
clearProposedValues()
Clears proposed value for this variable
|
void |
clearSolveParams() |
protected Object |
clone() |
boolean |
getBooleanSolveParam(SolveParam param) |
boolean |
getBooleanSolveParam(SolveParam param,
boolean defaultValue) |
boolean |
getBooleanSolveParam(SolveParam param,
Boolean defaultValue) |
List<Constraint> |
getConstraints() |
double |
getDoubleSolveParam(SolveParam param) |
double |
getDoubleSolveParam(SolveParam param,
double defaultValue) |
double |
getDoubleSolveParam(SolveParam param,
Double defaultValue) |
int |
getIntSolveParam(SolveParam param) |
int |
getIntSolveParam(SolveParam param,
int defaultValue) |
int |
getIntSolveParam(SolveParam param,
Integer defaultValue) |
Collection<LinearTerm> |
getLinearObjectiveTerms() |
int |
getNumConstraints() |
int |
getNumVars() |
Collection<Term> |
getObjectiveTerms() |
boolean |
getProposedBooleanValue(Variable var)
returns the currently proposed value for Boolean variable var
|
double |
getProposedDoubleValue(Variable var)
returns the currently proposed value for Double variable var
|
int |
getProposedIntValue(Variable var)
returns the currently proposed value for Integer variable var
|
Map<Variable,Object> |
getProposedValuesMap()
useful for copying proposed var/vals to a new MIP
|
Collection<QuadraticTerm> |
getQuadraticObjectiveTerms() |
Object |
getSolveParam(SolveParam param)
These functions control how JOpt operates, and how the backend solver operates.
|
Collection<LinearTerm> |
getSortedLinearObjectiveTerms()
Get the terms sorted lexicographically
|
Collection<QuadraticTerm> |
getSortedQuadraticObjectiveTerms()
Get the terms sorted lexicographically
|
Set<SolveParam> |
getSpecifiedSolveParams() |
String |
getStringSolveParam(SolveParam param) |
String |
getStringSolveParam(SolveParam param,
String defaultValue) |
Variable |
getVar(String name) |
Map<String,Variable> |
getVars() |
Set<Variable> |
getVarsWithProposedValues()
useful for copying proposed var/vals to a new MIP
|
boolean |
isObjectiveMax() |
boolean |
isObjectiveMin() |
boolean |
isSolveParamSpecified(SolveParam param) |
void |
proposeValue(Variable var,
boolean value)
Sets proposed value for this variable
|
void |
proposeValue(Variable var,
double value)
Sets proposed value for this variable
|
void |
proposeValue(Variable var,
int value)
Sets proposed value for this variable
|
boolean |
remove(Constraint constraint)
removes a constraint from the formulation.
|
void |
remove(Variable var)
Removes a variable from the MIP formulation.
|
void |
removeObjectiveTerm(LinearTerm term)
removes a Term from the objective function.
|
void |
removeObjectiveTerm(QuadraticTerm term)
removes a Term from the objective function.
|
void |
removeProposedValue(Variable var)
Removes proposed value for this variable
|
void |
resetDefaultSolveParams()
Resets CPLEX/JOpt parameters to: Wall clock, 10 minute timelimit, strict
IIS calculation, no-output problem file, and zero missing proposed
variables.
|
void |
setObjectiveMax(boolean isMax)
Set the objective to be MAX (true) or MIN (false)
|
void |
setProposedValues(Map<Variable,Object> proposedValues)
useful for copying proposed var/vals to a new MIP
|
void |
setSolveParam(SolveParam param,
Object value) |
void |
setSolveParam(SolveParam param,
String value) |
String |
toString() |
IMIP |
typedClone() |
public static final int MAX_VALUE
public String add(Variable var)
IMIP
public int getNumVars()
getNumVars
in interface IMIP
public void remove(Variable var)
IMIP
public void proposeValue(Variable var, double value)
proposeValue
in interface IMIP
public void proposeValue(Variable var, int value)
proposeValue
in interface IMIP
public void proposeValue(Variable var, boolean value)
proposeValue
in interface IMIP
public void removeProposedValue(Variable var)
removeProposedValue
in interface IMIP
public void clearProposedValues()
clearProposedValues
in interface IMIP
public Map<Variable,Object> getProposedValuesMap()
getProposedValuesMap
in interface IMIP
public void setProposedValues(Map<Variable,Object> proposedValues)
setProposedValues
in interface IMIP
public Set<Variable> getVarsWithProposedValues()
getVarsWithProposedValues
in interface IMIP
public int getProposedIntValue(Variable var)
IMIP
getProposedIntValue
in interface IMIP
public double getProposedDoubleValue(Variable var)
IMIP
getProposedDoubleValue
in interface IMIP
public boolean getProposedBooleanValue(Variable var)
IMIP
getProposedBooleanValue
in interface IMIP
public Collection<LinearTerm> getLinearObjectiveTerms()
getLinearObjectiveTerms
in interface IMIP
public Collection<LinearTerm> getSortedLinearObjectiveTerms()
IMIP
getSortedLinearObjectiveTerms
in interface IMIP
public void addObjectiveTerm(LinearTerm term)
IMIP
addObjectiveTerm
in interface IMIP
public void addObjectiveTerm(double coefficient, Variable var)
IMIP
addObjectiveTerm
in interface IMIP
public void removeObjectiveTerm(LinearTerm term)
IMIP
removeObjectiveTerm
in interface IMIP
public Collection<QuadraticTerm> getQuadraticObjectiveTerms()
getQuadraticObjectiveTerms
in interface IMIP
public Collection<QuadraticTerm> getSortedQuadraticObjectiveTerms()
IMIP
getSortedQuadraticObjectiveTerms
in interface IMIP
public void addObjectiveTerm(QuadraticTerm term)
IMIP
addObjectiveTerm
in interface IMIP
public void addObjectiveTerm(double coefficient, Variable varA, Variable varB)
IMIP
addObjectiveTerm
in interface IMIP
public void removeObjectiveTerm(QuadraticTerm term)
IMIP
removeObjectiveTerm
in interface IMIP
public boolean clearObjective()
IMIP
clearObjective
in interface IMIP
public Collection<Term> getObjectiveTerms()
getObjectiveTerms
in interface IMIP
public boolean isObjectiveMax()
isObjectiveMax
in interface IMIP
public boolean isObjectiveMin()
isObjectiveMin
in interface IMIP
public void setObjectiveMax(boolean isMax)
IMIP
setObjectiveMax
in interface IMIP
public List<Constraint> getConstraints()
getConstraints
in interface IMIP
public void add(Constraint constraint)
IMIP
public Object getSolveParam(SolveParam param)
IMIP
getSolveParam
in interface IMIP
public int getIntSolveParam(SolveParam param, Integer defaultValue)
getIntSolveParam
in interface IMIP
IMIP.getSolveParam(SolveParam)
public int getIntSolveParam(SolveParam param, int defaultValue)
getIntSolveParam
in interface IMIP
IMIP.getSolveParam(SolveParam)
public int getIntSolveParam(SolveParam param)
getIntSolveParam
in interface IMIP
IMIP.getSolveParam(SolveParam)
public double getDoubleSolveParam(SolveParam param, Double defaultValue)
getDoubleSolveParam
in interface IMIP
IMIP.getSolveParam(SolveParam)
public double getDoubleSolveParam(SolveParam param, double defaultValue)
getDoubleSolveParam
in interface IMIP
IMIP.getSolveParam(SolveParam)
public double getDoubleSolveParam(SolveParam param)
getDoubleSolveParam
in interface IMIP
IMIP.getSolveParam(SolveParam)
public boolean getBooleanSolveParam(SolveParam param, Boolean defaultValue)
getBooleanSolveParam
in interface IMIP
IMIP.getSolveParam(SolveParam)
public boolean getBooleanSolveParam(SolveParam param, boolean defaultValue)
getBooleanSolveParam
in interface IMIP
IMIP.getSolveParam(SolveParam)
public boolean getBooleanSolveParam(SolveParam param)
getBooleanSolveParam
in interface IMIP
IMIP.getSolveParam(SolveParam)
public String getStringSolveParam(SolveParam param, String defaultValue)
getStringSolveParam
in interface IMIP
IMIP.getSolveParam(SolveParam)
public String getStringSolveParam(SolveParam param)
getStringSolveParam
in interface IMIP
IMIP.getSolveParam(SolveParam)
public void setSolveParam(SolveParam param, Object value)
setSolveParam
in interface IMIP
IMIP.getSolveParam(SolveParam)
public void setSolveParam(SolveParam param, String value)
public Set<SolveParam> getSpecifiedSolveParams()
getSpecifiedSolveParams
in interface IMIP
IMIP.getSolveParam(SolveParam)
public void clearSolveParams()
clearSolveParams
in interface IMIP
IMIP.getSolveParam(SolveParam)
public void resetDefaultSolveParams()
resetDefaultSolveParams
in interface IMIP
public boolean isSolveParamSpecified(SolveParam param)
isSolveParamSpecified
in interface IMIP
protected Object clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
public IMIP typedClone()
typedClone
in interface IMIP
public int getNumConstraints()
getNumConstraints
in interface IMIP
public boolean remove(Constraint constraint)
IMIP
Copyright © 2017. All rights reserved.