160 if( System.getProperty(
"os.name").toLowerCase().indexOf(
"win") >= 0 )
167 final String[] candidates = {
"ipopt-3",
"ipopt-0",
"libipopt-3",
"libipopt-0",
"ipopt",
"libipopt" };
168 boolean loadedlib =
false;
169 for( String c : candidates )
173 System.loadLibrary(c);
177 catch( UnsatisfiedLinkError e )
182 throw new UnsatisfiedLinkError(
"Could not load Ipopt library. Check your java.library.path.");
187 System.loadLibrary(
"ipopt");
203 System.loadLibrary(DLL);
219 File file =
new File(path, System.mapLibraryName(DLL));
220 System.load(file.getAbsolutePath());
300 abstract protected boolean eval_f(
335 abstract protected boolean eval_g(
415 abstract protected boolean eval_h(
494 return ipopt == 0 ? false :
true;
649 double[] obj_scaling,
654 boolean[] use_x_g_scaling)
677 int[] pos_nonlin_vars)
Ipopt()
Creates a new NLP Solver using a default as the DLL name.
native void FreeIpoptProblem(long ipopt)
abstract boolean get_bounds_info(int n, double[] x_l, double[] x_u, int m, double[] g_l, double[] g_u)
Method to request bounds on the variables and constraints.
double mult_x_L[]
Final multipliers for lower variable bounds.
static final int INSUFFICIENT_MEMORY
static final int DIVERGING_ITERATES
int get_number_of_nonlinear_variables()
When LBFGS hessian approximation is used, this method should be overloaded.
static final int NOT_ENOUGH_DEGREES_OF_FRE
native int OptimizeTNLP(long ipopt, double x[], double g[], double obj_val[], double mult_g[], double mult_x_L[], double mult_x_U[], double callback_grad_f[], double callback_jac_g[], double callback_hess[])
double [] getUpperBoundMultipliers()
Gives dual multipliers for variable upper bounds in final point.
static final int USER_REQUESTED_STOP
double getObjectiveValue()
Gives objective function value at final point.
static final int INVALID_OPTION
static final int INTERNAL_ERROR
static final int ITERATION_EXCEEDED
int status
Status returned by the solver.
static final int INFEASIBLE_PROBLEM
static final int FORTRAN_STYLE
Use FORTRAN index style for iRow and jCol vectors.
abstract boolean get_starting_point(int n, boolean init_x, double[] x, boolean init_z, double[] z_L, double[] z_U, int m, boolean init_lambda, double[] lambda)
Method to request the starting point before iterating.
static final int UNRECOVERABLE_EXCEPTION
double mult_x_U[]
Final multipliers for upper variable bounds.
native long CreateIpoptProblem(int n, int m, int nele_jac, int nele_hess, int index_style)
This file contains a base class for all exceptions and a set of macros to help with exceptions...
double [] getLowerBoundMultipliers()
Gives dual multipliers for variable lower bounds in final point.
double [] getConstraintValues()
Gives constraint function values at final point.
double obj_val[]
Final value of objective function.
static final int RESTORATION_FAILED
boolean setIntegerOption(String keyword, int val)
Function for setting an integer option.
boolean setStringOption(String keyword, String val)
Function for setting a string option.
static final int CPUTIME_EXCEEDED
boolean setNumericOption(String keyword, double val)
Function for setting a number option.
abstract boolean eval_g(int n, double[] x, boolean new_x, int m, double[] g)
Method to request the constraint values.
Ipopt(String DLL)
Creates a NLP Solver for the given DLL file.
boolean create(int n, int m, int nele_jac, int nele_hess, int index_style)
Create a new problem.
static final int NON_IPOPT_EXCEPTION
static final int ERROR_IN_STEP_COMPUTATION
native boolean AddIpoptStrOption(long ipopt, String keyword, String val)
Ipopt(String path, String DLL)
Creates a NLP Solver for the given DLL file and path.
double callback_grad_f[]
Callback arguments.
native boolean AddIpoptIntOption(long ipopt, String keyword, int val)
static final int SEARCH_DIRECTION_TOO_SMALL
abstract boolean eval_jac_g(int n, double[] x, boolean new_x, int m, int nele_jac, int[] iRow, int[] jCol, double[] values)
Method to request either the sparsity structure or the values of the Jacobian of the constraints...
double x[]
Final value of variable values.
static final int INVALID_NUMBER_DETECTED
boolean get_scaling_parameters(double[] obj_scaling, int n, double[] x_scaling, int m, double[] g_scaling, boolean[] use_x_g_scaling)
If you using_scaling_parameters = true, this method should be overloaded.
abstract boolean eval_h(int n, double[] x, boolean new_x, double obj_factor, int m, double[] lambda, boolean new_lambda, int nele_hess, int[] iRow, int[] jCol, double[] values)
Method to request either the sparsity structure or the values of the Hessian of the Lagrangian...
double g[]
Values of constraint at final point.
int OptimizeNLP()
This function actually solve the problem.
double [] getVariableValues()
Gives primal variable values at final point.
long ipopt
Pointer to the native optimization object.
double [] getConstraintMultipliers()
Gives constraint dual multipliers in final point.
static final int ACCEPTABLE_LEVEL
abstract boolean eval_grad_f(int n, double[] x, boolean new_x, double[] grad_f)
Method to request the gradient of the objective function.
double mult_g[]
Final multipliers for constraints.
int getStatus()
Gives Ipopt status of last OptimizeNLP call.
boolean get_list_of_nonlinear_variables(int num_nonlin_vars, int[] pos_nonlin_vars)
When LBFGS hessian approximation is used, this method should be overloaded.
static final int C_STYLE
Use C index style for iRow and jCol vectors.
native boolean AddIpoptNumOption(long ipopt, String keyword, double val)
void dispose()
Dispose of the natively allocated memory.
abstract boolean eval_f(int n, double[] x, boolean new_x, double[] obj_value)
Method to request the value of the objective function.
static final int SOLVE_SUCCEEDED
The possible Ipopt status return codes: should be kept in sync with Ipopt return codes.
static final int INVALID_PROBLEM_DEFINITION