|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.gnu.glpk.GlpkSolver
public class GlpkSolver
This is the core class of the Java Native Interface for GLPK 4.8.
Use GLPK in the following way:
GlpkSolver solver = new GlpkSolver(); ... fill LP model solver.simplex(); // LP solver solver.integer(); // ILP solver ... obtain resultsFor a detailed manual and the C version of GLPK, take a look at the GLPK Homepage
Field Summary | |
---|---|
static int |
LPX_B_UNDEF
|
static int |
LPX_B_VALID
|
static int |
LPX_BS
|
static int |
LPX_CV
|
static int |
LPX_D_FEAS
|
static int |
LPX_D_INFEAS
|
static int |
LPX_D_NOFEAS
|
static int |
LPX_D_UNDEF
|
static int |
LPX_DB
|
static int |
LPX_E_BADB
|
static int |
LPX_E_EMPTY
|
static int |
LPX_E_FAULT
|
static int |
LPX_E_INFEAS
|
static int |
LPX_E_INSTAB
|
static int |
LPX_E_ITLIM
|
static int |
LPX_E_NOCONV
|
static int |
LPX_E_NODFS
|
static int |
LPX_E_NOFEAS
|
static int |
LPX_E_NOPFS
|
static int |
LPX_E_OBJLL
|
static int |
LPX_E_OBJUL
|
static int |
LPX_E_OK
|
static int |
LPX_E_SING
|
static int |
LPX_E_TMLIM
|
static int |
LPX_FEAS
|
static int |
LPX_FR
|
static int |
LPX_FX
|
static int |
LPX_I_FEAS
|
static int |
LPX_I_NOFEAS
|
static int |
LPX_I_OPT
|
static int |
LPX_I_UNDEF
|
static int |
LPX_INFEAS
|
static int |
LPX_IV
|
static int |
LPX_K_BRANCH
|
static int |
LPX_K_BTRACK
|
static int |
LPX_K_DUAL
|
static int |
LPX_K_ITCNT
|
static int |
LPX_K_ITLIM
|
static int |
LPX_K_LPTORIG
|
static int |
LPX_K_MPSFREE
|
static int |
LPX_K_MPSINFO
|
static int |
LPX_K_MPSOBJ
|
static int |
LPX_K_MPSORIG
|
static int |
LPX_K_MPSSKIP
|
static int |
LPX_K_MPSWIDE
|
static int |
LPX_K_MSGLEV
|
static int |
LPX_K_OBJLL
|
static int |
LPX_K_OBJUL
|
static int |
LPX_K_OUTDLY
|
static int |
LPX_K_OUTFRQ
|
static int |
LPX_K_PRESOL
|
static int |
LPX_K_PRICE
|
static int |
LPX_K_RELAX
|
static int |
LPX_K_ROUND
|
static int |
LPX_K_SCALE
|
static int |
LPX_K_TMLIM
|
static int |
LPX_K_TOLBND
|
static int |
LPX_K_TOLDJ
|
static int |
LPX_K_TOLINT
|
static int |
LPX_K_TOLOBJ
|
static int |
LPX_K_TOLPIV
|
static int |
LPX_LO
|
static int |
LPX_LP
|
static int |
LPX_MAX
|
static int |
LPX_MIN
|
static int |
LPX_MIP
|
static int |
LPX_NF
|
static int |
LPX_NL
|
static int |
LPX_NOFEAS
|
static int |
LPX_NS
|
static int |
LPX_NU
|
static int |
LPX_OPT
|
static int |
LPX_P_FEAS
|
static int |
LPX_P_INFEAS
|
static int |
LPX_P_NOFEAS
|
static int |
LPX_P_UNDEF
|
static int |
LPX_T_OPT
|
static int |
LPX_T_UNDEF
|
static int |
LPX_UNBND
|
static int |
LPX_UNDEF
|
static int |
LPX_UP
|
Constructor Summary | |
---|---|
GlpkSolver()
|
Method Summary | |
---|---|
void |
addCols(int ncs)
Add new ncs columns (structural variables) to problem object |
void |
addRows(int nrs)
Add nrs new rows (constraints) to problem object |
void |
advBasis()
Construct advanced initial LP basis |
void |
checkKkt(int scaled,
GlpkSolverKktConditions kkt)
Check Karush-Kuhn-Tucker conditions |
void |
delCols(int ncs,
int[] num)
Delete ncs columns from problem object |
void |
delRows(int nrs,
int[] num)
Delete nrs rows from problem object |
int |
dualRatioTest(int len,
int[] ind,
double[] val,
int how,
double tol)
Perform dual ratio test |
void |
enablePrints(boolean enable)
|
int |
evalTabCol(int k,
int[] ind,
double[] val)
Compute column of the simplex table |
int |
evalTabRow(int k,
int[] ind,
double[] val)
Compute row of the simplex table |
protected void |
finalize()
|
int |
getClss()
Retrieve problem class |
double |
getColDual(int j)
Retrieve dual value (reduced cost) of the structural variable (column) j |
int |
getColKind(int j)
Retrieve kind of column j |
double |
getColLb(int j)
Retrieve lower bound of column j |
java.lang.String |
getColName(int j)
Retrieve name of column j |
double |
getColPrim(int j)
Retrieve primal value of the structural variable (column) j |
int |
getColStat(int j)
Retrieve status of column j |
int |
getColType(int j)
Retrieve type of column j |
double |
getColUb(int j)
Retrieve upper bound of column j |
int |
getDualStat()
Retrieve dual status of the basic solution |
int |
getIntParm(int parm)
Query integer control parameter |
int |
getMatCol(int j,
int[] ind,
double[] val)
Retrieve column j of the constraint matrix. |
int |
getMatRow(int i,
int[] ind,
double[] val)
Retrieve row i of the constraint matrix. |
int |
getNumBin()
Retrieve number of binary columns |
int |
getNumCols()
Retrieve number of columns |
int |
getNumInt()
Retrieve number of integer columns |
int |
getNumNz()
Retrieve number of constraint coefficients (non-zero elements in constraint matrix) |
int |
getNumRows()
Retrieve number of rows |
double |
getObjCoef(int j)
Retrieve objective function coefficient or constant term |
int |
getObjDir()
Retrieve optimization direction flag |
java.lang.String |
getObjName()
Retrieve objective function name |
double |
getObjVal()
Retrieve current value of the objective function |
int |
getPrimStat()
Retrieve primal status of the basic solution |
java.lang.String |
getProbName()
Retrieve problem name |
int |
getRayInfo()
Retrieve non-basic variable which causes unboundness |
double |
getRealParm(int parm)
Query real control parameter |
double |
getRowDual(int i)
Retrieve dual value (reduced cost) of auxiliary variable associated with row i |
double |
getRowLb(int i)
Retrieve lower bound of row i |
java.lang.String |
getRowName(int i)
Retrieve name of row i |
double |
getRowPrim(int i)
Retrieve primal value of auxiliary variable of row i |
int |
getRowStat(int i)
Retrieve status of row i |
int |
getRowType(int i)
Retrieve type of row i |
double |
getRowUb(int i)
Retrieve upper bound of row i |
int |
getStatus()
Retrieve generic status of the basic solution |
int |
integer()
Solve MIP problem using the branch-and-bound method |
int |
interior()
Solve LP problem using the primal-dual interior point method |
double |
iptColDual(int j)
Retrieve dual value (reduced cost) of auxiliary variable associated with column j |
double |
iptColPrim(int j)
Retrieve primal value of structural variable of column j |
double |
iptObjVal()
Retrieve objective value from interior-point solution |
double |
iptRowDual(int i)
retrieve dual value (reduced cost) of auxiliary variable associated with row i |
double |
iptRowPrim(int i)
Retrieve primal value of auxiliary variable of row i |
int |
iptStatus()
Retrieve status of interior-point solution |
void |
loadMatrix(int ne,
int[] ia,
int[] ja,
double[] ar)
Load (replace) the whole constraint matrix |
double |
mipColVal(int j)
Retrieve value of the structural variable associated with column j |
double |
mipObjVal()
Retrieve value of the objective function |
double |
mipRowVal(int i)
Retrieve value of the auxiliary variable associated with row i |
int |
mipStatus()
Retrieve status of MIP solution |
int |
primRatioTest(int len,
int[] ind,
double[] val,
int how,
double tol)
Perform primal ratio test |
boolean |
printIps(java.lang.String fname)
Write interior point solution in printable format |
boolean |
printMip(java.lang.String fname)
Write MIP solution in printable format |
boolean |
printProb(java.lang.String fname)
Write problem data in plain text format |
boolean |
printSensBnds(java.lang.String fname)
Write bounds sensitivity information |
boolean |
printSol(java.lang.String fname)
Write basic solution in printable format |
boolean |
readBas(java.lang.String fname)
Read LP basis in fixed MPS format |
static GlpkSolver |
readCpxlp(java.lang.String fname)
Read problem data in CPLEX LP format Example: GlpkSolver solver = solver.readFreemps("plan.lp"); |
static GlpkSolver |
readFreemps(java.lang.String fname)
Read problem data in free MPS format |
static GlpkSolver |
readModel(java.lang.String model,
java.lang.String data,
java.lang.String output)
Read model written in GNU MathProg modeling language |
static GlpkSolver |
readMps(java.lang.String fname)
Read problem data in fixed MPS format |
void |
resetParms()
Reset control parameters to default values |
void |
scaleProb()
Scale problem data |
void |
setClss(int klass)
Set (change) problem class |
void |
setColBnds(int j,
int type,
double lb,
double ub)
Set (change) column bounds |
void |
setColKind(int j,
int kind)
Set (change) kind of column (structural variable) j |
void |
setColName(int j,
java.lang.String name)
Assign (change) column name |
void |
setColStat(int j,
int stat)
Set (change) status of column j |
void |
setHook(GlpkHookIFC hook)
Install a callback for handling printing and fault messages |
void |
setIntParm(int parm,
int val)
Set (change) integer control parameter |
void |
setMatCol(int j,
int len,
int[] ind,
double[] val)
Set (replace) column j of the constraint matrix |
void |
setMatRow(int i,
int len,
int[] ind,
double[] val)
Set (replace) row i of the constraint matrix |
void |
setObjCoef(int j,
double coef)
Set (change) objective coefficient or constant term |
void |
setObjDir(int dir)
Set (change) optimization direction flag. |
void |
setObjName(java.lang.String name)
Assign (change) the name of the objective funtion |
void |
setProbName(java.lang.String name)
Assign (change) LP problem name |
void |
setRealParm(int parm,
double val)
Set (change) real control parameter |
void |
setRowBnds(int i,
int type,
double lb,
double ub)
Set (change) row bounds |
void |
setRowName(int i,
java.lang.String name)
Assign (change) row name |
void |
setRowStat(int i,
int stat)
Set (change) status of row i |
int |
simplex()
Solve LP problem using the simplex method |
void |
stdBasis()
Construct standard initial LP basis |
int |
transformCol(int len,
int[] ind,
double[] val)
Transform explicitly specified column |
int |
transformRow(int len,
int[] ind,
double[] val)
Transform explicitly specified row |
void |
unscaleProb()
Unscale problem data |
int |
warmUp()
“Warm up” / refresh LP basis |
boolean |
writeBas(java.lang.String fname)
Write LP basis in fixed MPS format |
boolean |
writeCpxlp(java.lang.String fname)
Write problem data in CPLEX LP format |
boolean |
writeFreemps(java.lang.String fname)
Write problem data in free MPS format |
boolean |
writeMps(java.lang.String fname)
Write problem data in fixed MPS format |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int LPX_LP
public static final int LPX_MIP
public static final int LPX_FR
public static final int LPX_LO
public static final int LPX_UP
public static final int LPX_DB
public static final int LPX_FX
public static final int LPX_MIN
public static final int LPX_MAX
public static final int LPX_B_UNDEF
public static final int LPX_B_VALID
public static final int LPX_P_UNDEF
public static final int LPX_P_FEAS
public static final int LPX_P_INFEAS
public static final int LPX_P_NOFEAS
public static final int LPX_D_UNDEF
public static final int LPX_D_FEAS
public static final int LPX_D_INFEAS
public static final int LPX_D_NOFEAS
public static final int LPX_BS
public static final int LPX_NL
public static final int LPX_NU
public static final int LPX_NF
public static final int LPX_NS
public static final int LPX_T_UNDEF
public static final int LPX_T_OPT
public static final int LPX_CV
public static final int LPX_IV
public static final int LPX_I_UNDEF
public static final int LPX_I_OPT
public static final int LPX_I_FEAS
public static final int LPX_I_NOFEAS
public static final int LPX_OPT
public static final int LPX_FEAS
public static final int LPX_INFEAS
public static final int LPX_NOFEAS
public static final int LPX_UNBND
public static final int LPX_UNDEF
public static final int LPX_E_OK
public static final int LPX_E_EMPTY
public static final int LPX_E_BADB
public static final int LPX_E_INFEAS
public static final int LPX_E_FAULT
public static final int LPX_E_OBJLL
public static final int LPX_E_OBJUL
public static final int LPX_E_ITLIM
public static final int LPX_E_TMLIM
public static final int LPX_E_NOFEAS
public static final int LPX_E_INSTAB
public static final int LPX_E_SING
public static final int LPX_E_NOCONV
public static final int LPX_E_NOPFS
public static final int LPX_E_NODFS
public static final int LPX_K_MSGLEV
public static final int LPX_K_SCALE
public static final int LPX_K_DUAL
public static final int LPX_K_PRICE
public static final int LPX_K_RELAX
public static final int LPX_K_TOLBND
public static final int LPX_K_TOLDJ
public static final int LPX_K_TOLPIV
public static final int LPX_K_ROUND
public static final int LPX_K_OBJLL
public static final int LPX_K_OBJUL
public static final int LPX_K_ITLIM
public static final int LPX_K_ITCNT
public static final int LPX_K_TMLIM
public static final int LPX_K_OUTFRQ
public static final int LPX_K_OUTDLY
public static final int LPX_K_BRANCH
public static final int LPX_K_BTRACK
public static final int LPX_K_TOLINT
public static final int LPX_K_TOLOBJ
public static final int LPX_K_MPSINFO
public static final int LPX_K_MPSOBJ
public static final int LPX_K_MPSORIG
public static final int LPX_K_MPSWIDE
public static final int LPX_K_MPSFREE
public static final int LPX_K_MPSSKIP
public static final int LPX_K_LPTORIG
public static final int LPX_K_PRESOL
Constructor Detail |
---|
public GlpkSolver()
Method Detail |
---|
protected void finalize()
finalize
in class java.lang.Object
public void enablePrints(boolean enable)
public void setHook(GlpkHookIFC hook)
public void setProbName(java.lang.String name)
public void setObjName(java.lang.String name)
public void setObjDir(int dir)
public void addRows(int nrs)
public void addCols(int ncs)
public void setRowName(int i, java.lang.String name)
public void setColName(int j, java.lang.String name)
public void setRowBnds(int i, int type, double lb, double ub)
public void setColBnds(int j, int type, double lb, double ub)
public void setObjCoef(int j, double coef)
public void setMatRow(int i, int len, int[] ind, double[] val)
len
- length of new rowind
- indices of columnsval
- corresponding values (no zeros allowed)public void setMatCol(int j, int len, int[] ind, double[] val)
len
- length of new columnind
- indices of rowsval
- corresponding values (no zeros allowed)public void loadMatrix(int ne, int[] ia, int[] ja, double[] ar)
ne
- number of elements in matrixia
- row counterja
- column counterar
- value of matrix element (no zeros allowed)public void delRows(int nrs, int[] num)
num
- contains ordinal row numberspublic void delCols(int ncs, int[] num)
num
- contains ordinal column numberspublic java.lang.String getProbName()
public java.lang.String getObjName()
public int getObjDir()
public int getNumRows()
public int getNumCols()
public java.lang.String getRowName(int i)
public java.lang.String getColName(int j)
public int getRowType(int i)
public double getRowLb(int i)
public double getRowUb(int i)
public int getColType(int j)
public double getColLb(int j)
public double getColUb(int j)
public double getObjCoef(int j)
public int getNumNz()
public int getMatRow(int i, int[] ind, double[] val)
ind
- contains column indicesval
- contains the corresponding valuespublic int getMatCol(int j, int[] ind, double[] val)
ind
- contains column indicesval
- contains the corresponding valuespublic void scaleProb()
public void unscaleProb()
public void stdBasis()
public void advBasis()
public void setRowStat(int i, int stat)
public void setColStat(int j, int stat)
public int simplex()
public int getStatus()
public int getPrimStat()
public int getDualStat()
public double getObjVal()
public int getRowStat(int i)
public double getRowPrim(int i)
public double getRowDual(int i)
public int getColStat(int j)
public double getColPrim(int j)
public double getColDual(int j)
public int getRayInfo()
public void checkKkt(int scaled, GlpkSolverKktConditions kkt)
public int warmUp()
public int evalTabRow(int k, int[] ind, double[] val)
public int evalTabCol(int k, int[] ind, double[] val)
public int transformRow(int len, int[] ind, double[] val)
public int transformCol(int len, int[] ind, double[] val)
public int primRatioTest(int len, int[] ind, double[] val, int how, double tol)
public int dualRatioTest(int len, int[] ind, double[] val, int how, double tol)
public int interior()
public int iptStatus()
public double iptObjVal()
public double iptRowPrim(int i)
public double iptRowDual(int i)
public double iptColPrim(int j)
public double iptColDual(int j)
public void setClss(int klass)
klass
- LPX_LP: LP problem, LPX_MIP: MIP problempublic int getClss()
public void setColKind(int j, int kind)
kind
- LPX_CV: continuous, LPX_IV: integerpublic int getColKind(int j)
public int getNumInt()
public int getNumBin()
public int integer()
public int mipStatus()
public double mipObjVal()
public double mipRowVal(int i)
public double mipColVal(int j)
public void resetParms()
public void setIntParm(int parm, int val)
public int getIntParm(int parm)
public void setRealParm(int parm, double val)
public double getRealParm(int parm)
public static GlpkSolver readMps(java.lang.String fname)
public boolean writeMps(java.lang.String fname)
public boolean readBas(java.lang.String fname)
public boolean writeBas(java.lang.String fname)
public static GlpkSolver readFreemps(java.lang.String fname)
public boolean writeFreemps(java.lang.String fname)
public static GlpkSolver readCpxlp(java.lang.String fname)
public boolean writeCpxlp(java.lang.String fname)
public static GlpkSolver readModel(java.lang.String model, java.lang.String data, java.lang.String output)
public boolean printProb(java.lang.String fname)
public boolean printSol(java.lang.String fname)
public boolean printSensBnds(java.lang.String fname)
public boolean printIps(java.lang.String fname)
public boolean printMip(java.lang.String fname)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |