|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ilog.cplex.example.CpxProblem
Cplex solver and problem class. Each object of this class will allocate its own CPXLP and CPXENV object. As a consequence each object grabs its own license which is freed only upon destruction of the CpxProblem Java object. Since this may occur any time when the Java garbage collector decides to, it is advised to call method CpxProblem.dispose() explicitly. The user is assumed to be familiar with the C callable library.
Field Summary | |
static char |
Continuous
constant for continuous variable type |
static char |
Equal
constant for equality constraint sense |
static char |
GreaterEqual
constant for greater or equal constraint sense |
static double |
Infinity
constant for inifinity bounds. |
static char |
Integer
constant for integer variable type |
static char |
LessEqual
constant for less or equal constraint sense |
static int |
Maximize
constant for maximiztion objective sense |
static int |
Minimize
constant for minimzation objective sense |
Constructor Summary | |
CpxProblem()
Creates one CPLEX solver and problem representation object. |
Method Summary | |
void |
addCols(double[] obj,
CpxSparseVector[] cols,
double[] lb,
double[] ub,
char[] type)
Add columns to the problem stored in the CpxProblem object. |
void |
addRows(CpxSparseVector[] rows,
char[] senses,
double[] rhs)
Add rows to the problem stored in the CpxProblem object. |
void |
baropt()
Call the barrier algorithm to optimize the problem in the CpxProblem object. |
void |
dispose()
Destructor. |
void |
dualopt()
Call the dual simplex algorithm to optimize the problem in the CpxProblem object. |
protected void |
finalize()
|
void |
getBase(int[] cstat,
int[] rstat)
Obtain basis information of the current solution. |
double |
getDblQuality(int which)
Obtain double-valued quality information about the current solution. |
void |
getDj(double[] x)
Obtain the reduced cost vector of the current solution. |
int |
getIntQuality(int which)
Obtain integer-valued quality information about the current solution. |
int |
getItcnt()
return the number of iteration from the last simplex run. |
int |
getNCols()
return the number of columns of the problem stored in the CpxProblem object. |
int |
getNRows()
return the number of rows of the problem stored in the CpxProblem object. |
double |
getObj()
return the objective value of the solution currently stored in the CpxProblem object. |
void |
getPi(double[] x)
Obtain the dual solution vector of the current solution. |
void |
getSlack(double[] x)
Obtain the vector of slack values for the current solution. |
int |
getStatus()
return the current solution status. |
void |
getX(double[] x)
Obtain the primal solution vector of the current solution. |
void |
hybbaropt()
Call the barrier algorithm followed by primal crossover to optimize the problem in the CpxProblem * object. |
void |
hybnetopt()
Call the network simplex algorithm followed by dual simplex to optimize the problem in the CpxProblem object. |
void |
mipopt()
Call the MIP optimizer to solve the problem in the CpxProblem object. |
void |
primopt()
Call the primal simplex algorithm to optimize the problem in the CpxProblem object. |
void |
read(java.lang.String file)
Read an LP, MPS or SAV file from the file system. |
void |
setCoefs(int[] rind,
int[] cind,
double[] val)
Set nonzero coefficients in the problem stored in the CpxProblem object. |
void |
setObjSense(int sense)
return the objective sense of the problem stored in the CpxProblem object. |
void |
setParam(int which,
double value)
Set a CPLEX double-valued paramter. |
void |
setParam(int which,
int value)
Set a CPLEX integer-valued paramter. |
void |
write(java.lang.String file)
Write a LP, MPS or SAV format file to the file system. |
Methods inherited from class java.lang.Object |
clone,
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final double Infinity
public static final int Minimize
public static final int Maximize
public static final char Equal
public static final char LessEqual
public static final char GreaterEqual
public static final char Integer
public static final char Continuous
Constructor Detail |
public CpxProblem() throws CpxException
Method Detail |
protected void finalize() throws java.lang.Throwable
public void dispose() throws java.lang.Throwable
public void read(java.lang.String file) throws CpxException
file
- the name of the file to be read.public void write(java.lang.String file) throws CpxException
file
- the name of the file to be written. The extension of
the file name determines what format the file will be written in.public void dualopt() throws CpxException
public void primopt() throws CpxException
public void baropt() throws CpxException
public void hybbaropt() throws CpxException
public void hybnetopt() throws CpxException
public void mipopt() throws CpxException
public double getObj() throws CpxException
public int getItcnt() throws CpxException
public int getStatus() throws CpxException
public int getNCols() throws CpxException
public int getNRows() throws CpxException
public void setObjSense(int sense) throws CpxException
public void addRows(CpxSparseVector[] rows, char[] senses, double[] rhs) throws CpxException
rows
- an array of sparse vectors containing the column
indices and associated nonzero coefficients of the rows
to be added.senses
- an array of characters CpxProblem.Equal,
CpxProblem.LessEqual, or CpxProblem.GreaterEqual that
indicate the constraint sense of the rows to be added.rhs
- an array of right hand side values for the rows to be
added.public void addCols(double[] obj, CpxSparseVector[] cols, double[] lb, double[] ub, char[] type) throws CpxException
obj
- an array of objective value coefficients for the
columns to be added.cols
- an array of sparse vectors containing the row indices
and associated nonzero coefficients of the columns
to be added.lb
- an array of lower bound values for the columns to be
added.ub
- an array of upper bound values for the columns to be
added.type
- an array of variable type characters CpxProblem.Integer
or CpxProblem.Continous for the columns to be added.public void setCoefs(int[] rind, int[] cind, double[] val) throws CpxException
rind
- an array of row indices for the coefficients to be set.cind
- an array of column indices for the coefficients to be set.val
- an array of values for the coefficients to be set.public void getBase(int[] cstat, int[] rstat) throws CpxException
cstat
- an array where the column status values are copied to.rstat
- an array where the row status values are copied to.public void getX(double[] x) throws CpxException
x
- an array where the primal solution values are copied to.public void getPi(double[] x) throws CpxException
x
- an array where the dual solution values are copied to.public void getDj(double[] x) throws CpxException
x
- an array where the reduced cost values are copied to.public void getSlack(double[] x) throws CpxException
x
- an array where the slack values are copied to.public double getDblQuality(int which) throws CpxException
which
- an integer indicating the type of information to be
returned.public int getIntQuality(int which) throws CpxException
which
- an integer indicating the type of information to be
returned.public void setParam(int which, int value) throws CpxException
which
- an integer indicating the integer parameter to be set.value
- the new parameter value.public void setParam(int which, double value) throws CpxException
which
- an integer indicating the double parameter to be set.value
- the new parameter value.
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |