edu.harvard.econcs.jopt.solver
Interface IMIP

All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
MIP, MIPWrapper

public interface IMIP
extends java.io.Serializable

Interface specifying a Mixed Integer Program

Since:
Apr 12, 2004
Version:
$Revision: 1.14 $ on $Date: 2008/09/09 19:15:56 $

Method Summary
 int add(Constraint constraint)
          Adds a new constraint
 int add(Constraint constraint, int constraintId)
          Adds a new constraint
 java.lang.String add(Variable var)
          Adds a variable to the MIP formulation.
 void addObjectiveTerm(Term term)
          Adds a Term to the objective function.
 void addObjectiveTerm(Variable var, double coefficient)
          Creates and then adds a Term to the objective function.
 void clearProposedValues()
          Clears proposed value for this variable
 void clearSolveParams()
           
 boolean getBooleanSolveParam(SolveParam param)
           
 boolean getBooleanSolveParam(SolveParam param, boolean defaultValue)
           
 boolean getBooleanSolveParam(SolveParam param, java.lang.Boolean defaultValue)
           
 Constraint getConstraint(int constraintId)
           
 java.util.Iterator getConstraints()
           
 double getDoubleSolveParam(SolveParam param)
           
 double getDoubleSolveParam(SolveParam param, double defaultValue)
           
 double getDoubleSolveParam(SolveParam param, java.lang.Double defaultValue)
           
 int getIntSolveParam(SolveParam param)
           
 int getIntSolveParam(SolveParam param, int defaultValue)
           
 int getIntSolveParam(SolveParam param, java.lang.Integer defaultValue)
           
 int getNumConstraints()
           
 int getNumVars()
           
 java.util.Iterator 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
 java.lang.Object getSolveParam(SolveParam param)
          These functions control how JOpt operates, and how the backend solver operates.
 java.util.Set getSpecifiedSolveParams()
           
 java.lang.String getStringSolveParam(SolveParam param)
           
 java.lang.String getStringSolveParam(SolveParam param, java.lang.String defaultValue)
           
 Variable getVar(java.lang.String name)
           
 java.util.Map getVars()
           
 java.util.Set 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
 void remove(int constraintId)
          removes a constraint from the formulation.
 void remove(Variable var)
          Removes a variable from the MIP formulation.
 void removeObjectiveTerm(Term term)
          removes a Term from the objective function.
 void removeProposedValue(Variable var)
          Removes proposed value for this variable
 void resetDefaultSolveParams()
          reset behavior is solver specific; see implementing class
 void setObjectiveMax(boolean isMax)
          Set the objective to be MAX (true) or MIN (false)
 void setSolveParam(SolveParam param, boolean value)
           
 void setSolveParam(SolveParam param, double value)
           
 void setSolveParam(SolveParam param, int value)
           
 void setSolveParam(SolveParam param, java.lang.String value)
           
 IMIP typedClone()
           
 

Method Detail

getVars

java.util.Map getVars()
Returns:
a Map from Strings to Variables.

getVar

Variable getVar(java.lang.String name)
Returns:
the Variable corresponding to the String name.

add

java.lang.String add(Variable var)
Adds a variable to the MIP formulation. Depending on the implementation you may find that this variable doesn't show up in the solver. (For instance if there is no reference to the variable in any constraint

Returns:
the string representation of the variable

remove

void remove(Variable var)
Removes a variable from the MIP formulation. Depending on the implementation this may not actually communicate with the solver, if this variable is unused by the solver.


proposeValue

void proposeValue(Variable var,
                  double value)
Sets proposed value for this variable


proposeValue

void proposeValue(Variable var,
                  int value)
Sets proposed value for this variable


proposeValue

void proposeValue(Variable var,
                  boolean value)
Sets proposed value for this variable


removeProposedValue

void removeProposedValue(Variable var)
Removes proposed value for this variable


clearProposedValues

void clearProposedValues()
Clears proposed value for this variable


getVarsWithProposedValues

java.util.Set getVarsWithProposedValues()
useful for copying proposed var/vals to a new MIP


getProposedIntValue

int getProposedIntValue(Variable var)
returns the currently proposed value for Integer variable var


getProposedDoubleValue

double getProposedDoubleValue(Variable var)
returns the currently proposed value for Double variable var


getProposedBooleanValue

boolean getProposedBooleanValue(Variable var)
returns the currently proposed value for Boolean variable var


getNumVars

int getNumVars()
Returns:
the number of variables in the MIP formulation.

getConstraints

java.util.Iterator getConstraints()
Returns:
An iterator over the constraints

getConstraint

Constraint getConstraint(int constraintId)
Parameters:
constraintId - the id passed in during constraint creation
Returns:
the Constraint object

add

int add(Constraint constraint)
Adds a new constraint

Parameters:
constraint - the constraint to add
Returns:
constraintId should be a UNIQUE number; useful for getting the dual of this constraint

add

int add(Constraint constraint,
        int constraintId)
Adds a new constraint

Parameters:
constraint - the constraint to add
constraintId - should be a UNIQUE number; useful for getting the dual of this constraint
Returns:

remove

void remove(int constraintId)
removes a constraint from the formulation.

Parameters:
constraintId -

getNumConstraints

int getNumConstraints()
Returns:
the number of constraints in the system

getObjectiveTerms

java.util.Iterator getObjectiveTerms()
Returns:
an iterator on the objective Term objects

addObjectiveTerm

void addObjectiveTerm(Term term)
Adds a Term to the objective function.

Parameters:
term -

addObjectiveTerm

void addObjectiveTerm(Variable var,
                      double coefficient)
Creates and then adds a Term to the objective function.

Parameters:
var -
coefficient -

removeObjectiveTerm

void removeObjectiveTerm(Term term)
removes a Term from the objective function.

Parameters:
term -

isObjectiveMax

boolean isObjectiveMax()
Returns:
true if objective is a max

isObjectiveMin

boolean isObjectiveMin()
Returns:
true if objective is a min

setObjectiveMax

void setObjectiveMax(boolean isMax)
Set the objective to be MAX (true) or MIN (false)

Parameters:
isMax -

typedClone

IMIP typedClone()

getSolveParam

java.lang.Object getSolveParam(SolveParam param)
These functions control how JOpt operates, and how the backend solver operates. You can control a number of parameters. Not all of these will be supported by your chosen backend solver, unfortunently. But we try to map these settings into relevant solver settings. See each setting to see if they are applicable to CPLEX, LPSOLVE, or ALLSOLVERS


getIntSolveParam

int getIntSolveParam(SolveParam param,
                     int defaultValue)
See Also:
getSolveParam(SolveParam)

getDoubleSolveParam

double getDoubleSolveParam(SolveParam param,
                           double defaultValue)
See Also:
getSolveParam(SolveParam)

getBooleanSolveParam

boolean getBooleanSolveParam(SolveParam param,
                             boolean defaultValue)
See Also:
getSolveParam(SolveParam)

getIntSolveParam

int getIntSolveParam(SolveParam param,
                     java.lang.Integer defaultValue)
See Also:
getSolveParam(SolveParam)

getDoubleSolveParam

double getDoubleSolveParam(SolveParam param,
                           java.lang.Double defaultValue)
See Also:
getSolveParam(SolveParam)

getBooleanSolveParam

boolean getBooleanSolveParam(SolveParam param,
                             java.lang.Boolean defaultValue)
See Also:
getSolveParam(SolveParam)

getStringSolveParam

java.lang.String getStringSolveParam(SolveParam param,
                                     java.lang.String defaultValue)
See Also:
getSolveParam(SolveParam)

getIntSolveParam

int getIntSolveParam(SolveParam param)
See Also:
getSolveParam(SolveParam)

getDoubleSolveParam

double getDoubleSolveParam(SolveParam param)
See Also:
getSolveParam(SolveParam)

getBooleanSolveParam

boolean getBooleanSolveParam(SolveParam param)
See Also:
getSolveParam(SolveParam)

getStringSolveParam

java.lang.String getStringSolveParam(SolveParam param)
See Also:
getSolveParam(SolveParam)

setSolveParam

void setSolveParam(SolveParam param,
                   int value)
See Also:
getSolveParam(SolveParam)

setSolveParam

void setSolveParam(SolveParam param,
                   double value)
See Also:
getSolveParam(SolveParam)

setSolveParam

void setSolveParam(SolveParam param,
                   boolean value)
See Also:
getSolveParam(SolveParam)

setSolveParam

void setSolveParam(SolveParam param,
                   java.lang.String value)
See Also:
getSolveParam(SolveParam)

getSpecifiedSolveParams

java.util.Set getSpecifiedSolveParams()
See Also:
getSolveParam(SolveParam)

isSolveParamSpecified

boolean isSolveParamSpecified(SolveParam param)

clearSolveParams

void clearSolveParams()
See Also:
getSolveParam(SolveParam)

resetDefaultSolveParams

void resetDefaultSolveParams()
reset behavior is solver specific; see implementing class