at.dms.kjc.linprog
Class SimpleLinearProgram

java.lang.Object
  extended by at.dms.kjc.linprog.SimpleLinearProgram
All Implemented Interfaces:
LinearProgram, Serializable
Direct Known Subclasses:
CPLEXSolve, MPSWriter

public class SimpleLinearProgram
extends Object
implements LinearProgram, Serializable

A simple implementation of the LinearProgram interface; keeps track of all the information that has been passed in with local fields.

See Also:
Serialized Form

Field Summary
protected  boolean[] boolVar
          An array indicating whether or not a given variable should be constrained to be zero-one.
protected  List<at.dms.kjc.linprog.Constraint> constraints
          Rows of Constraints.
protected  int numVars
          Number of variables.
protected  double[] obj
          The objective function.
 
Constructor Summary
SimpleLinearProgram(int numVars)
          Create one of these with variables.
 
Method Summary
 void addConstraintEQ(double[] constraint, double rhs)
          Adds an equality constraint between the variables with coefficients and the right-hand-side .
 void addConstraintGE(double[] constraint, double rhs)
          Adds a greater-than-or-equal constraint between the variables with coefficients and the right-hand-side .
 double[] getEmptyConstraint()
          Returns an array with a zero-entry for each variable in the linear program (which the client can then fill in with coefficients before checking in as a new constraint.)
 void setBoolVar(int n)
          Constrains the n'th variable of this to be a boolean variable (zero or one).
 void setObjective(double[] obj)
          Sets the objective function to be .
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

numVars

protected int numVars
Number of variables.


constraints

protected List<at.dms.kjc.linprog.Constraint> constraints
Rows of Constraints.


obj

protected double[] obj
The objective function.


boolVar

protected boolean[] boolVar
An array indicating whether or not a given variable should be constrained to be zero-one.

Constructor Detail

SimpleLinearProgram

public SimpleLinearProgram(int numVars)
Create one of these with variables.

Method Detail

getEmptyConstraint

public double[] getEmptyConstraint()
Returns an array with a zero-entry for each variable in the linear program (which the client can then fill in with coefficients before checking in as a new constraint.)

Specified by:
getEmptyConstraint in interface LinearProgram

setObjective

public void setObjective(double[] obj)
Sets the objective function to be .

Specified by:
setObjective in interface LinearProgram

setBoolVar

public void setBoolVar(int n)
Constrains the n'th variable of this to be a boolean variable (zero or one).

Specified by:
setBoolVar in interface LinearProgram

addConstraintGE

public void addConstraintGE(double[] constraint,
                            double rhs)
Adds a greater-than-or-equal constraint between the variables with coefficients and the right-hand-side . That is, >= .

Specified by:
addConstraintGE in interface LinearProgram

addConstraintEQ

public void addConstraintEQ(double[] constraint,
                            double rhs)
Adds an equality constraint between the variables with coefficients and the right-hand-side .

Specified by:
addConstraintEQ in interface LinearProgram