

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
java.lang.Object edu.uci.eecs.doc.clepsydra.ipet.GLPKAdapter
public class GLPKAdapter
Provides an implementation of the ILPSolver
interface for the GNU Linear Programming Kit.
Constructor Summary  

GLPKAdapter()

Method Summary  

void 
addConstraint(double[] coefficients,
int equalTo)
Adds an equality equation (i.e., row) to the ILP equation matrix. 
void 
addInequalityConstraint(double[] coefficients,
int lessThanOrEqualTo)
Adds an inequality equation (i.e., row) to the ILP equation matrix. 
void 
createProblem(int columns)
Initializes an ILP problem whose equation matrix will contain the specified number of columns (i.e., variables). 
void 
destroyProblem()
Deallocates resources that had been allocated to solve the ILP problem. 
String 
getColumnName(int column)
Returns the humanfriendly name for the specified column in the ILP equation matrix, if one was set. 
int 
getSolution()
Solves the ILP problem and returns the result. 
void 
saveModel(String filename)
Saves a representation of the ILP problem to disk. 
void 
setColumnName(int column,
String name)
Provides a humanfriendly name for the specified column in the ILP equation matrix. 
void 
setMaximizeFunction(double[] coefficients)
Provides the ILP solver with an equation to maximize. 
Methods inherited from class java.lang.Object 

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
Constructor Detail 

public GLPKAdapter()
Method Detail 

public void createProblem(int columns)
columns
.
createProblem
in interface ILPSolver
columns
 the number of columns in the ILP equation matrixpublic void setColumnName(int column, String name)
setColumnName
in interface ILPSolver
column
 a column index (first column starts at 1, not 0)name
 a humanfriendly name for this columnpublic String getColumnName(int column)
getColumnName
in interface ILPSolver
column
 a column index (first column is at index 1, not 0)
public void addConstraint(double[] coefficients, int equalTo)
x2 + 5 x3 = 42
would be accomplished like this:
double[] coefficients = {0, 1, 5, 0}; ilpsolver.addConstraint(coefficients, 42);
addConstraint
in interface ILPSolver
coefficients
 the coefficients of the equation (including zero coefficients)equalTo
 the righthand side (a constant) of the equationpublic void addInequalityConstraint(double[] coefficients, int lessThanOrEqualTo)
x2 + 5 x3 <= 42
would be accomplished like this:
double[] coefficients = {0, 1, 5, 0}; ilpsolver.addInequalityConstraint(coefficients, 42);
addInequalityConstraint
in interface ILPSolver
coefficients
 the coefficients of the equation (including zero coefficients)lessThanOrEqualTo
 the righthand side (a constant) of the equationpublic void setMaximizeFunction(double[] coefficients)
setMaximizeFunction
in interface ILPSolver
coefficients
 the coefficients of the equation (including zero
coefficients)public int getSolution()
getSolution
in interface ILPSolver
ILPException
 if the solution is infeasible or some other error occurredpublic void saveModel(String filename) throws IOException
saveModel
in interface ILPSolver
filename
 the name of a file in which to store the representation
IOException
 if the representation could not be saved to diskpublic void destroyProblem()
destroyProblem
in interface ILPSolver


PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 