

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
public interface ILPSolver
A common interface to integer linear programming libraries such as GLPK and lp_solve.
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. 
Method Detail 

void createProblem(int columns)
columns
.
columns
 the number of columns in the ILP equation matrixvoid setColumnName(int column, String name)
column
 a column index (first column is at index 1, not 0)name
 a humanfriendly name for this columnString getColumnName(int column)
column
 a column index (first column is at index 1, not 0)
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);
coefficients
 the coefficients of the equation (including zero coefficients)equalTo
 the righthand side (a constant) of the equationvoid addInequalityConstraint(double[] coefficients, int lessThanOrEqualTo)
x2 + 5 x3 <= 42
would be accomplished like this:
double[] coefficients = {0, 1, 5, 0}; ilpsolver.addInequalityConstraint(coefficients, 42);
coefficients
 the coefficients of the equation (including zero coefficients)lessThanOrEqualTo
 the righthand side (a constant) of the inequalityvoid setMaximizeFunction(double[] coefficients)
coefficients
 the coefficients of the equation (including zero
coefficients)int getSolution()
void saveModel(String filename) throws IOException
filename
 the name of a file in which to store the representation
IOException
 if the representation could not be saved to diskvoid destroyProblem()


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