at.dms.kjc.linprog
Class LPSolve

java.lang.Object
  extended by at.dms.kjc.linprog.LPSolve
All Implemented Interfaces:
LinearProgram, LinearProgramSolver

public class LPSolve
extends Object
implements LinearProgramSolver

This is an integer linear program solver based on the Java port of lp_solve 2.0, available from: http://www.cs.wustl.edu/~javagrp/help/LinearProgramming.html


Constructor Summary
LPSolve(int numConstraints, int numVars)
          Construct an LP with constraints and 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 i)
          Constrains the i'th variable of this to be an integer.
 void setObjective(double[] obj)
          Sets the objective function to be .
 double[] solve()
          Solve the program and return the value of the the variables (indices 0...numVars-1) in the optimum.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LPSolve

public LPSolve(int numConstraints,
               int numVars)
Construct an LP with constraints and 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 i)
Constrains the i'th variable of this to be an integer.

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

solve

public double[] solve()
Solve the program and return the value of the the variables (indices 0...numVars-1) in the optimum.

Specified by:
solve in interface LinearProgramSolver