67 double x[],
double g[],
73 public static final String
DLLNAME =
"jipopt";
75 public static final String
DLLPATH =
"lib";
106 private double callback_grad_f[];
107 private double callback_jac_g[];
108 private double callback_hess[];
114 private double obj_val[] = {0.0};
120 private double mult_x_L[];
123 private double mult_x_U[];
126 private double mult_g[];
148 public Ipopt(String path, String DLL)
151 File file =
new File(path, System.mapLibraryName(DLL));
152 System.load(file.getAbsolutePath());
156 abstract protected boolean get_bounds_info(
int n,
double[] x_l,
double[] x_u,
157 int m,
double[] g_l,
double[] g_u);
161 boolean init_z,
double[] z_L,
double[] z_U,
162 int m,
boolean init_lambda,
double[] lambda);
165 abstract protected boolean eval_f(
int n,
double[] x,
boolean new_x,
double[] obj_value);
168 abstract protected boolean eval_grad_f(
int n,
double[] x,
boolean new_x,
double[] grad_f);
171 abstract protected boolean eval_g(
int n,
double[] x,
boolean new_x,
int m,
double[] g);
174 abstract protected boolean eval_jac_g(
int n,
double[] x,
boolean new_x,
175 int m,
int nele_jac,
int[] iRow,
int[] jCol,
double[] values);
178 abstract protected boolean eval_h(
int n,
double[] x,
boolean new_x,
double obj_factor,
179 int m,
double[] lambda,
boolean new_lambda,
180 int nele_hess,
int[] iRow,
int[] jCol,
217 public boolean create(
int n,
int m,
int nele_jac,
int nele_hess,
int index_style)
224 callback_grad_f =
new double[n];
225 callback_jac_g =
new double[
nele_jac];
229 mult_x_U =
new double[n];
230 mult_x_L =
new double[n];
232 mult_g =
new double[
m];
238 return ipopt == 0 ?
false :
true;
277 return ipopt == 0 ?
false :
AddIpoptStrOption(ipopt, keyword, val.toLowerCase());
292 this.status = this.OptimizeTNLP(
ipopt,
374 boolean[] use_x_g_scaling)
396 int[] pos_nonlin_vars)
Ipopt()
Creates a new NLP Solver using { DLLPATH} as path and { DLLNAME} as the DLL name. ...
native void FreeIpoptProblem(long ipopt)
Native function should not be used directly.
abstract boolean get_bounds_info(int n, double[] x_l, double[] x_u, int m, double[] g_l, double[] g_u)
Callback function for the variable bounds and constraint sides.
double mult_x_L[]
Final multipliers for lower variable bounds.
static final int INSUFFICIENT_MEMORY
Number Number Index Number Number Index Index Index index_style
indexing style for iRow & jCol, 0 for C style, 1 for Fortran style
static final int DIVERGING_ITERATES
Number Number Index m
Number of constraints.
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[])
Native function should not be used directly.
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)
Callback function for retrieving a starting point.
static final String DLLNAME
The default DLL name of the native implementation (without any platform dependent prefixes or suffixe...
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)
Native function should not be used directly.
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.
Number Number Index Number Number Index nele_jac
Number of non-zero elements in constraint Jacobian.
abstract boolean eval_g(int n, double[] x, boolean new_x, int m, double[] g)
Callback function for the constraints.
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)
Native function should not be used directly.
Ipopt(String path, String DLL)
Creates a NLP Solver for the given DLL file.
double callback_grad_f[]
Callback arguments.
native boolean AddIpoptIntOption(long ipopt, String keyword, int val)
Native function should not be used directly.
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)
Callback function for the constraints Jacobian.
double x[]
Final value of variable values.
Number Number * x_scaling
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, please overload this method,.
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)
Callback function for the hessian.
double g[]
Values of constraint at final point.
Number Number Index Number Number Index Index nele_hess
Number of non-zero elements in Hessian of Lagrangian.
int OptimizeNLP()
This function actually solve the problem.
double[] getVariableValues()
Gives primal variable values at final point.
static final String DLLPATH
The relative path where the native DLL is found.
long ipopt
Pointer to the native optimization object.
Number Number Number * g_scaling
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)
Callback function for the objective function gradient.
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)
Native function should not be used directly.
void dispose()
Dispose of the natively allocated memory.
A Java Native Interface for the Ipopt optimization solver.
abstract boolean eval_f(int n, double[] x, boolean new_x, double[] obj_value)
Callback function for 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