117 double x_L_violation[],
118 double x_U_violation[],
123 double nlp_constraint_violation[],
197 if( System.getProperty(
"os.name").toLowerCase().indexOf(
"win") >= 0 )
204 final String[] candidates = {
"ipopt-3",
"ipopt-0",
"libipopt-3",
"libipopt-0",
"ipopt",
"libipopt" };
205 boolean loadedlib =
false;
206 for( String c : candidates )
217 System.loadLibrary(c);
221 catch( UnsatisfiedLinkError e )
226 throw new UnsatisfiedLinkError(
"Could not load Ipopt library. Check your java.library.path.");
231 System.loadLibrary(
"ipopt");
247 System.loadLibrary(DLL);
263 File file =
new File(path, System.mapLibraryName(DLL));
264 System.load(file.getAbsolutePath());
538 return ipopt == 0 ? false :
true;
661 return this.
GetCurrIterate(ipopt, ip_data, ip_cq, scaled, n,
x, z_L, z_U, m,
g, lambda);
702 double x_L_violation[],
703 double x_U_violation[],
708 double nlp_constraint_violation[],
712 return this.
GetCurrViolations(ipopt, ip_data, ip_cq, scaled, n, x_L_violation, x_U_violation, compl_x_L, compl_x_U, grad_lag_x, m, nlp_constraint_violation, compl_g);
805 double regularization_size,
830 double[] obj_scaling,
835 boolean[] use_x_g_scaling)
858 int[] pos_nonlin_vars)
double[] getVariableValues()
Gives primal variable values at final point.
static final int WALLTIME_EXCEEDED
abstract boolean eval_g(int n, double[] x, boolean new_x, int m, double[] g)
Method to request the constraint values.
static final int SOLVE_SUCCEEDED
boolean setStringOption(String keyword, String val)
Function for setting a string option.
double[] getConstraintMultipliers()
Gives constraint dual multipliers in final point.
static final int DIVERGING_ITERATES
static final int INFEASIBLE_PROBLEM
native boolean GetCurrIterate(long ipopt, long ip_data, long ip_cq, boolean scaled, int n, double x[], double z_L[], double z_U[], int m, double g[], double lambda[])
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.
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_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.
native boolean AddIpoptIntOption(long ipopt, String keyword, int val)
static final int RESTORATIONPHASEMODE
Ipopt(String DLL)
Creates a NLP Solver for the given DLL file.
Ipopt(String path, String DLL)
Creates a NLP Solver for the given DLL file and path.
static final int UNRECOVERABLE_EXCEPTION
double mult_x_U[]
Final multipliers for upper variable bounds.
static final int C_STYLE
Use C index style for iRow and jCol vectors.
double g[]
Values of constraint at final point.
double x[]
Final value of variable values.
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[])
native void FreeIpoptProblem(long ipopt)
int status
Status returned by the solver.
static final int INSUFFICIENT_MEMORY
static final int NOT_ENOUGH_DEGREES_OF_FRE
double[] getConstraintValues()
Gives constraint function values at final point.
boolean intermediate_callback(int algorithmmode, int iter, double obj_value, double inf_pr, double inf_du, double mu, double d_norm, double regularization_size, double alpha_du, double alpha_pr, int ls_trials, long ip_data, long ip_cq)
Intermediate Callback method for the user.
boolean get_curr_violations(long ip_data, long ip_cq, boolean scaled, int n, double x_L_violation[], double x_U_violation[], double compl_x_L[], double compl_x_U[], double grad_lag_x[], int m, double nlp_constraint_violation[], double compl_g[])
Get primal and dual infeasibility of the current iterate.
static final int INVALID_PROBLEM_DEFINITION
double getObjectiveValue()
Gives objective function value at final point.
void dispose()
Dispose of the natively allocated memory.
static final int SEARCH_DIRECTION_TOO_SMALL
abstract boolean eval_grad_f(int n, double[] x, boolean new_x, double[] grad_f)
Method to request the gradient of the objective function.
boolean setIntegerOption(String keyword, int val)
Function for setting an integer option.
static final int ITERATION_EXCEEDED
double[] getUpperBoundMultipliers()
Gives dual multipliers for variable upper bounds in final point.
abstract boolean eval_f(int n, double[] x, boolean new_x, double[] obj_value)
Method to request the value of the objective function.
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.
native boolean AddIpoptStrOption(long ipopt, String keyword, String val)
static final int INVALID_NUMBER_DETECTED
boolean create(int n, int m, int nele_jac, int nele_hess, int index_style)
Create a new problem.
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.
double obj_val[]
Final value of objective function.
int getStatus()
Gives Ipopt status of last OptimizeNLP call.
static final int INVALID_OPTION
double[] getLowerBoundMultipliers()
Gives dual multipliers for variable lower bounds in final point.
static final int ACCEPTABLE_LEVEL
long ipopt
Pointer to the native optimization object.
double mult_g[]
Final multipliers for constraints.
Ipopt()
Creates a new NLP Solver using a default as the DLL name.
double mult_x_L[]
Final multipliers for lower variable bounds.
static final int ERROR_IN_STEP_COMPUTATION
static final int USER_REQUESTED_STOP
native boolean AddIpoptNumOption(long ipopt, String keyword, double val)
static final int NON_IPOPT_EXCEPTION
native boolean GetCurrViolations(long ipopt, long ip_data, long ip_cq, boolean scaled, int n, double x_L_violation[], double x_U_violation[], double compl_x_L[], double compl_x_U[], double grad_lag_x[], int m, double nlp_constraint_violation[], double compl_g[])
boolean setNumericOption(String keyword, double val)
Function for setting a number option.
static final int RESTORATION_FAILED
boolean get_curr_iterate(long ip_data, long ip_cq, boolean scaled, int n, double x[], double z_L[], double z_U[], int m, double g[], double lambda[])
Get primal and dual variable values of the current iterate.
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.
static final int FORTRAN_STYLE
Use FORTRAN index style for iRow and jCol vectors.
native long CreateIpoptProblem(int n, int m, int nele_jac, int nele_hess, int index_style)
int OptimizeNLP()
This function actually solve the problem.
int get_number_of_nonlinear_variables()
When LBFGS hessian approximation is used, this method should be overloaded.
double callback_grad_f[]
Callback arguments.
static final int REGULARMODE
static final int CPUTIME_EXCEEDED
static final int INTERNAL_ERROR
This file contains a base class for all exceptions and a set of macros to help with exceptions.