|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.coinor.Ipopt
public abstract class Ipopt
A Java Native Interface for the Ipopt optimization solver.
Ipopt is a solver for large scale nonlinear optimization problems (NLP) with non-linear contraints.
The Java Native Interface (JNI) is a programming framework that allows Java code running in the Java Virtual Machine (JVM) to call and be called by native applications (programs specific to a hardware and operating system platform) and libraries written in other languages, such as C and C++.
This class is a JNI hook around the C interface of Ipopt, as a consequence it will need a nativelly compiled DLL to run. For more details about Ipopt click here.
The user should subclass this class and implement the abstract methods.
At some point before solving the problem the
create(int, double[], double[], int, double[], double[], int, int, int)
function should be called.
For simple cases you can call this function in the constructor of your class.
Once the problem was created, solve(double[]) will solve the problem.
Objects of this class can be reused to solve different problems, in other words,
create(int, double[], double[], int, double[], double[], int, int, int)
and solve(double[]) can be called multiple times.
Programmers should, for efficiency, call dispose() when finished using a
Ipopt object, otherwise the nativelly allocated memory will be disposed of only
when the JVM call finalize() on it.
| Field Summary | |
|---|---|
static int |
ACCEPTABLE_LEVEL
|
static int |
C_STYLE
Use C index style for iRow and jCol vectors |
static int |
DIVERGING_ITERATES
|
static java.lang.String |
DLLNAME
The default DLL name of the native implementation (without any platform dependent prefixes or sufixes) |
static java.lang.String |
DLLPATH
The relative path where the native DLL is found |
static int |
ERROR_IN_STEP_COMPUTATION
|
static int |
FORTRAN_STYLE
Use FORTRAN index style for iRow and jCol vectors |
static int |
INFEASIBLE_PROBLEM
|
static int |
INSUFFICIENT_MEMORY
|
static int |
INTERNAL_ERROR
|
static int |
INVALID_NUMBER_DETECTED
|
static int |
INVALID_OPTION
|
static int |
INVALID_PROBLEM_DEFINITION
|
static int |
ITERATION_EXCEEDED
|
static java.lang.String |
KEY_ACCEPTABLE_COMPL_INF_TOL
|
static java.lang.String |
KEY_ACCEPTABLE_CONSTR_VIOL_TOL
|
static java.lang.String |
KEY_ACCEPTABLE_DUAL_INF_TOL
|
static java.lang.String |
KEY_ACCEPTABLE_TOL
|
static java.lang.String |
KEY_BARRIER_TOL_FACTOR
|
static java.lang.String |
KEY_BOUND_RELAX_FACTOR
|
static java.lang.String |
KEY_COMPL_INF_TOL
|
static java.lang.String |
KEY_CONSTR_VIOL_TOL
|
static java.lang.String |
KEY_DERIVATIVE_TEST
|
static java.lang.String |
KEY_DERIVATIVE_TEST_PRINT_ALL
|
static java.lang.String |
KEY_DERIVATIVE_TEST_TOL
|
static java.lang.String |
KEY_DUAL_INF_TOL
|
static java.lang.String |
KEY_FILE_PRINT_LEVEL
|
static java.lang.String |
KEY_HESSIAN_APPROXIMATION
The hessian approximation, set to "limited-memory" if no hessian is available |
static java.lang.String |
KEY_LIMITED_MEMORY_MAX_HISTORY
|
static java.lang.String |
KEY_LINEAR_SOLVER
|
static java.lang.String |
KEY_MAX_ITER
|
static java.lang.String |
KEY_MU_STRATEGY
|
static java.lang.String |
KEY_OBJ_SCALING_FACTOR
|
static java.lang.String |
KEY_OUTPUT_FILE
|
static java.lang.String |
KEY_PRINT_LEVEL
|
static java.lang.String |
KEY_PRINT_USER_OPTIONS
|
static java.lang.String |
KEY_TOL
|
static int |
NON_IPOPT_EXCEPTION
|
static int |
NOT_ENOUGH_DEGREES_OF_FRE
|
static int |
RESTORATION_FAILED
|
static int |
SEARCH_DIRECTION_TOO_SMALL
|
static int |
SOLVE_SUCCEEDED
|
static int |
UNRECOVERABLE_EXCEPTION
|
static int |
USER_REQUESTED_STOP
|
| Constructor Summary | |
|---|---|
Ipopt()
Creates a new NLP Solver using "lib" as path and "jipopt" as the DLL name. |
|
Ipopt(java.lang.String path,
java.lang.String DLL)
Creates a NLP Solver for the given DLL file. |
|
| Method Summary | |
|---|---|
boolean |
addIntOption(java.lang.String keyword,
int val)
Function for adding an integer option. |
boolean |
addNumOption(java.lang.String keyword,
double val)
Function for adding a number option. |
boolean |
addStrOption(java.lang.String keyword,
java.lang.String val)
Function for adding a string option. |
boolean |
create(int n,
double[] x_L,
double[] x_U,
int m,
double[] g_L,
double[] g_U,
int nele_jac,
int nele_hess,
int index_style)
Create the NLP problem to be solved. |
void |
dispose()
Disposes of the natively allocated memory. |
void |
finalize()
Disposes of the object once it is no longer referenced (automatically called by the JVM). |
double[] |
getMultConstraints()
|
double[] |
getMultLowerBounds()
|
double[] |
getMultUpperBounds()
|
double |
getObjVal()
|
int |
getStatus()
|
boolean |
openOutputFile(java.lang.String file_name,
int print_level)
Function for opening an output file for a given name with given printlevel. |
void |
setProblemScaling(double obj_scaling,
double[] x_scaling,
double[] g_scaling)
Set the scaling for the optimization problem. |
int |
solve(double[] x)
This function actually solve the problem. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String DLLNAME
public static final java.lang.String DLLPATH
public static final int C_STYLE
public static final int FORTRAN_STYLE
public static final int SOLVE_SUCCEEDED
public static final int ACCEPTABLE_LEVEL
public static final int INFEASIBLE_PROBLEM
public static final int SEARCH_DIRECTION_TOO_SMALL
public static final int DIVERGING_ITERATES
public static final int USER_REQUESTED_STOP
public static final int ITERATION_EXCEEDED
public static final int RESTORATION_FAILED
public static final int ERROR_IN_STEP_COMPUTATION
public static final int NOT_ENOUGH_DEGREES_OF_FRE
public static final int INVALID_PROBLEM_DEFINITION
public static final int INVALID_OPTION
public static final int INVALID_NUMBER_DETECTED
public static final int UNRECOVERABLE_EXCEPTION
public static final int NON_IPOPT_EXCEPTION
public static final int INSUFFICIENT_MEMORY
public static final int INTERNAL_ERROR
public static final java.lang.String KEY_TOL
public static final java.lang.String KEY_COMPL_INF_TOL
public static final java.lang.String KEY_DUAL_INF_TOL
public static final java.lang.String KEY_CONSTR_VIOL_TOL
public static final java.lang.String KEY_ACCEPTABLE_TOL
public static final java.lang.String KEY_ACCEPTABLE_COMPL_INF_TOL
public static final java.lang.String KEY_ACCEPTABLE_CONSTR_VIOL_TOL
public static final java.lang.String KEY_ACCEPTABLE_DUAL_INF_TOL
public static final java.lang.String KEY_BARRIER_TOL_FACTOR
public static final java.lang.String KEY_OBJ_SCALING_FACTOR
public static final java.lang.String KEY_BOUND_RELAX_FACTOR
public static final java.lang.String KEY_MAX_ITER
public static final java.lang.String KEY_LIMITED_MEMORY_MAX_HISTORY
public static final java.lang.String KEY_FILE_PRINT_LEVEL
public static final java.lang.String KEY_PRINT_LEVEL
public static final java.lang.String KEY_MU_STRATEGY
public static final java.lang.String KEY_OUTPUT_FILE
public static final java.lang.String KEY_DERIVATIVE_TEST_TOL
public static final java.lang.String KEY_DERIVATIVE_TEST
public static final java.lang.String KEY_DERIVATIVE_TEST_PRINT_ALL
public static final java.lang.String KEY_PRINT_USER_OPTIONS
public static final java.lang.String KEY_LINEAR_SOLVER
public static final java.lang.String KEY_HESSIAN_APPROXIMATION
| Constructor Detail |
|---|
public Ipopt()
Ipopt(String, String)
public Ipopt(java.lang.String path,
java.lang.String DLL)
path - the path where the DLL is found.DLL - the name of the DLL (without the extension or any platform dependent prefix).Ipopt()| Method Detail |
|---|
public void dispose()
An Ipopt object can be reused to solve different problems by calling again
create(int, double[], double[], int, double[], double[], int, int, int).
In this case, you should call the dispose method only when you
finished with the object and it is not needed anymore.
finalize()public void finalize()
finalize in class java.lang.Objectdispose()
public boolean create(int n,
double[] x_L,
double[] x_U,
int m,
double[] g_L,
double[] g_U,
int nele_jac,
int nele_hess,
int index_style)
This function should be called before solve(double[])
and before any of the option configuration methods,
e.g, addIntOption(String, int).
In simple cases this function in the constructor of the deriving class.
n - number of variablesx_L - lower bound vectorx_U - upper bound vectorm - number of constraintsg_L - lower bounds on constraintsg_U - upper bounds on constraintsnele_jac - number of non-zero elements in constraint Jacobiannele_hess - number of non-zero elements in Hessian of Lagrangianindex_style - indexing style for iRow & jCol (C_STYLE or FORTRAN_STYLE)
public boolean addIntOption(java.lang.String keyword,
int val)
The valid keywords are public static members of this class, with names
beginning with KEY_, e.g, KEY_TOL.
For more details about the valid options check the Ipopt documentation.
keyword - the option keywordval - the value
public boolean addNumOption(java.lang.String keyword,
double val)
keyword - the option keywordval - the value
addIntOption(String, int)
public boolean addStrOption(java.lang.String keyword,
java.lang.String val)
keyword - the option keywordval - the value
addIntOption(String, int)
public void setProblemScaling(double obj_scaling,
double[] x_scaling,
double[] g_scaling)
obj_scaling - objective function scalingx_scaling - variables scalingg_scaling - constraints scaling
public boolean openOutputFile(java.lang.String file_name,
int print_level)
file_name - the file nameprint_level - the print level
public int solve(double[] x)
The solve status returned is one of the constant fields of this class,
e.g. SOLVE_SUCCEEDED. For more details about the valid solve status
check the Ipopt documentation or the
ReturnCodes_inc.h<\code>
which is installed in the Ipopt include directory.
x - the start point, and the solution when returns
getStatus()
public double getObjVal()
public int getStatus()
solve(double[])public double[] getMultConstraints()
public double[] getMultUpperBounds()
public double[] getMultLowerBounds()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||