|
QSopt 0.5 Alpha All Rights Reserved |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectLibProblem
qs.Problem
The Problem class wraps all information defining a linear problem as well as the choice of solution algorithm. It supplies the methods necessary to create linear problems, manipulate, solve, and read them from and write them to files.
This implementation is based on an early version of the QSopt callable function library written in the C programming language. QSopt's documentation of the C library is accessible on the QSopt web site .
Each method of the Problem class is based on a C function.
For example
void Problem.get_status() is based on
int QSget_status(QSprob p) and
public void Problem.new_row(double rhs, char sense, String name) is based on
int QSnew_row (QSprob p, double rhs, char sense, const char *name)
Most of the library's C functions return a non zero integer value to indicate failure.
The corresponding Java methods throw a QSException instead.
Instead of describing the JAVA methods in detail the documentation refers the reader to their corresponding C functions. Their documentation can be found on the QSopt website's function list .
Constructor Summary | |
Problem()
create an empty linear problem; see QScreate_prob |
|
Problem(java.lang.String nm)
create an empty linear problem; see QScreate_prob |
|
Problem(java.lang.String probname,
int ncols,
int nrows,
int[] cmatcnt,
int[] cmatbeg,
int[] cmatind,
double[] cmatval,
int objsense,
double[] obj,
double[] rhs,
char[] sense,
double[] lower,
double[] upper,
java.lang.String[] colnames,
java.lang.String[] rownames)
create a Problem; see QSload_prob |
Method Summary | |
void |
add_cols(int num,
int[] cmatcnt,
int[] cmatbeg,
int[] cmatind,
double[] cmatval,
double[] obj,
double[] lower,
double[] upper,
java.lang.String[] names)
add a set of columns (variables) to the problem; see QSadd_cols |
void |
add_rows(int num,
int[] rmatcnt,
int[] rmatbeg,
int[] rmatind,
double[] rmatval,
double[] rhs,
char[] sense,
java.lang.String[] names)
add a set of rows to the problem; see QSadd_rows |
void |
change_bounds(int num,
int[] collist,
char[] lu,
double[] bounds)
change the lower or upper bounds for a set of variables; see QSchange_bounds |
void |
change_objsense(int sense)
Change the sense of the objective function; see QSchange_objsense |
void |
change_sense(int num,
int[] rowlist,
char[] sense)
change the sense of a set of constraints; see QSchange_senses |
void |
compute_row_norms()
compute_row_norms; see QScompute_row_norms |
void |
delete_cols(int num,
int[] dellist)
delete a set of columns from the problem; see QSdelete_cols |
void |
delete_rows(int num,
int[] dellist)
delete a set of rows from the problem; see QSdelete_rows |
void |
delete_setrows(int[] flags)
delete a set of rows specified by flags; see QSdelete_setrows |
void |
free()
free all internal memory; see QSfree_prob |
void |
get_basis_and_row_norms_array(char[] cstat,
char[] rstat,
double[] rownorms)
copy the basis and row norms; see QSget_basis_and_row_norms_array |
void |
get_basis_array(char[] cstat,
char[] rstat)
copy the current basis into arrays; see QSget_basis_array |
int |
get_colcount()
return the number of columns (variables) in the problem, see QSget_colcount |
void |
get_colnames(java.lang.String[] colnames)
copy the names of the columns in the problem, see QSget_colnames |
java.lang.String |
get_name()
copy the problem name, see QSget_probname |
int |
get_nzcount()
return the number of non-zeros in the constraint matrix. |
void |
get_obj(double[] obj)
copy the objective function coefficients into an array. |
java.lang.String |
get_objname()
copy the objective name; see QSget_objname |
double |
get_objval()
get the current objective function value; see QSget_objval |
void |
get_pi_array(double[] pi)
copy the values of the dual variables into an array; see QSget_pi_array |
void |
get_rc_array(double[] rc)
copy the constraint reduced cost values into an array; see QSget_rc_array |
java.lang.String |
get_rhsname()
obtain the index of a named row see QSget_row_index |
int |
get_rowcount()
return the number of rows (constraints) in the problem, see QSget_rowcount |
void |
get_rownames(java.lang.String[] rownames)
copy the names of the rows in the problem, see QSget_rownames |
void |
get_slack_array(double[] slack)
copy the constraint slack values into an array; see QSget_slack_array |
double |
get_solution(double[] x,
double[] pi,
double[] slack,
double[] rc)
copy various solution data into arrays; see QSget_solution |
int |
get_status()
retrieve the problem's status. |
void |
get_x_array(double[] x)
copy the solution vector into an array; see QSget_x_array |
int |
getparam(int whichparam)
obtain the value of a specified parameter; see QSget_param |
void |
load_basis_and_row_norms_array(char[] cstat,
char[] rstat,
double[] rownorms)
copy the basis and row norms; see QSload_basis_and_row_norms_array |
void |
load_basis_array(char[] cstat,
char[] rstat)
copy the current basis into arrays; see QSload_basis_array |
void |
load_basis(Basis B)
load a basis stored in a basis structure; see QSload_basis |
void |
new_row(double rhs,
char sense,
java.lang.String name)
create a new empty row (constraint) in the problem; see QSnew_row |
void |
opt_dual()
solve the LP problem with the dual simplex algorithm; see QSopt_dual |
void |
opt_primal()
solve the LP problem with the primal simplex algorithm; see QSopt_primal |
int |
print_pi(Reporter r,
boolean nonZerosOnly,
int precision)
print the values of the Problem's dual variables to the Reporter's stream |
int |
print_rc(Reporter r,
boolean nonZerosOnly,
int precision)
print the reduced cost values of the Problem's variables to the Reporter's stream |
int |
print_slack(Reporter r,
boolean nonZerosOnly,
int precision)
print the slack values of the Problem's constraints to the Reporter's stream |
int |
print_x(Reporter r,
boolean nonZerosOnly,
int precision)
print the values of the Problem's variables to the Reporter's stream |
static Problem |
read_lp(java.io.Reader r,
java.lang.String name)
read a problem from an LP source; see QSread_prob |
static Problem |
read_lp(java.lang.String fname)
read a problem from an LP file; see QSread_prob |
static Problem |
read_mps(java.io.Reader r,
java.lang.String name)
read a problem from an MPS source; see QSread_prob |
static Problem |
read_mps(java.lang.String fname)
read a problem from an MPS file; see QSread_prob |
static Problem |
read(java.io.Reader r,
java.lang.String fname,
boolean isMps)
read a problem from Reader; see QSread_prob |
static Problem |
read(java.lang.String fname,
boolean isMps)
read a problem from an MPS or LP file; see QSread_prob; fname may be givem as a plain file name or a "file:", "http:" url; |
void |
setparam(int whichparam,
int newvalue)
set the value of a specified parameter, see QSset_param |
void |
write_basis(java.lang.String filename)
write a basis to a file, see QSwrite_basis |
void |
write_lp(java.lang.String filename)
write the problem in LP format to a named file, see QSwrite_prob |
void |
write_mps(java.lang.String filename)
write the problem to a named file, see QSwrite_prob |
void |
write(Reporter rep,
boolean isMps)
write the problem to Reporter's stream see QSwrite_prob |
void |
write(java.lang.String filename,
boolean isMps)
write the problem in LP or MPS format to a named file, see QSwrite_prob |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Problem()
public Problem(java.lang.String nm)
public Problem(java.lang.String probname, int ncols, int nrows, int[] cmatcnt, int[] cmatbeg, int[] cmatind, double[] cmatval, int objsense, double[] obj, double[] rhs, char[] sense, double[] lower, double[] upper, java.lang.String[] colnames, java.lang.String[] rownames) throws QSException
Method Detail |
public void add_cols(int num, int[] cmatcnt, int[] cmatbeg, int[] cmatind, double[] cmatval, double[] obj, double[] lower, double[] upper, java.lang.String[] names) throws QSException
QSException
public void add_rows(int num, int[] rmatcnt, int[] rmatbeg, int[] rmatind, double[] rmatval, double[] rhs, char[] sense, java.lang.String[] names) throws QSException
QSException
public void change_bounds(int num, int[] collist, char[] lu, double[] bounds) throws QSException
QSException
public void change_objsense(int sense)
public void change_sense(int num, int[] rowlist, char[] sense) throws QSException
QSException
public void compute_row_norms() throws QSException
QSException
public void delete_cols(int num, int[] dellist) throws QSException
QSException
public void delete_rows(int num, int[] dellist) throws QSException
QSException
public void delete_setrows(int[] flags) throws QSException
QSException
public void free()
public void get_basis_and_row_norms_array(char[] cstat, char[] rstat, double[] rownorms) throws QSException
QSException
public void get_basis_array(char[] cstat, char[] rstat) throws QSException
QSException
public int get_colcount()
public void get_colnames(java.lang.String[] colnames)
public java.lang.String get_name()
public int get_nzcount()
public void get_obj(double[] obj) throws QSException
QSException
public java.lang.String get_objname() throws QSException
QSException
public double get_objval() throws QSException
QSException
public void get_pi_array(double[] pi) throws QSException
QSException
public void get_rc_array(double[] rc) throws QSException
QSException
public java.lang.String get_rhsname()
public int get_rowcount()
public void get_rownames(java.lang.String[] rownames) throws QSException
QSException
public void get_slack_array(double[] slack) throws QSException
QSException
public double get_solution(double[] x, double[] pi, double[] slack, double[] rc) throws QSException
QSException
public int get_status()
public void get_x_array(double[] x) throws QSException
QSException
public int getparam(int whichparam) throws QSException
QSException
public void load_basis_and_row_norms_array(char[] cstat, char[] rstat, double[] rownorms) throws QSException
QSException
public void load_basis_array(char[] cstat, char[] rstat) throws QSException
QSException
public void load_basis(Basis B) throws QSException
QSException
public void new_row(double rhs, char sense, java.lang.String name) throws QSException
QSException
public void opt_dual() throws QSException
QSException
public void opt_primal() throws QSException
QSException
public int print_pi(Reporter r, boolean nonZerosOnly, int precision) throws QSException
QSException
public int print_rc(Reporter r, boolean nonZerosOnly, int precision) throws QSException
QSException
public int print_slack(Reporter r, boolean nonZerosOnly, int precision) throws QSException
QSException
public int print_x(Reporter r, boolean nonZerosOnly, int precision) throws QSException
QSException
public static Problem read_lp(java.io.Reader r, java.lang.String name)
public static Problem read_lp(java.lang.String fname) throws java.io.IOException
java.io.IOException
public static Problem read_mps(java.io.Reader r, java.lang.String name)
public static Problem read_mps(java.lang.String fname) throws java.io.IOException
java.io.IOException
public static Problem read(java.io.Reader r, java.lang.String fname, boolean isMps) throws java.io.IOException
java.io.IOException
public static Problem read(java.lang.String fname, boolean isMps) throws java.io.IOException
java.io.IOException
public void setparam(int whichparam, int newvalue) throws QSException
QSException
public void write_basis(java.lang.String filename) throws QSException
QSException
public void write_lp(java.lang.String filename) throws java.io.IOException, QSException
java.io.IOException
QSException
public void write_mps(java.lang.String filename) throws java.io.IOException
java.io.IOException
public void write(Reporter rep, boolean isMps) throws QSException
QSException
public void write(java.lang.String filename, boolean isMps) throws java.io.IOException, QSException
java.io.IOException
QSException
|
QSopt 0.5 Alpha QSopt Home |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |