Ipopt 3.12.10

- Main Page
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Static Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
org.coinor.Ipopt Class Referenceabstract

A Java Native Interface for the Ipopt optimization solver. More...

Inheritance diagram for org.coinor.Ipopt:
[legend]

## Public Member Functions
| Ipopt ()
| Creates a new NLP Solver using { DLLPATH} as path and { DLLNAME} as the DLL name. More...
| Ipopt (String path, String DLL)
| Creates a NLP Solver for the given DLL file. More...
void | dispose ()
| Dispose of the natively allocated memory. More...
boolean | create (int n, int m, int nele_jac, int nele_hess, int index_style)
| Create a new problem. More...
boolean | setIntegerOption (String keyword, int val)
| Function for setting an integer option. More...
boolean | setNumericOption (String keyword, double val)
| Function for setting a number option. More...
boolean | setStringOption (String keyword, String val)
| Function for setting a string option. More...
int | OptimizeNLP ()
| This function actually solve the problem. More...
double[] | getVariableValues ()
| Gives primal variable values at final point. More...
double | getObjectiveValue ()
| Gives objective function value at final point. More...
int | getStatus ()
| Gives Ipopt status of last OptimizeNLP call. More...
double[] | getConstraintValues ()
| Gives constraint function values at final point. More...
double[] | getConstraintMultipliers ()
| Gives constraint dual multipliers in final point. More...
double[] | getLowerBoundMultipliers ()
| Gives dual multipliers for variable lower bounds in final point. More...
double[] | getUpperBoundMultipliers ()
| Gives dual multipliers for variable upper bounds in final point. More...
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,. More...
int | get_number_of_nonlinear_variables ()
| When LBFGS hessian approximation is used, this method should be overloaded. More...
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. More...

## Static Public Attributes
static final String | DLLNAME = "jipopt"
| The default DLL name of the native implementation (without any platform dependent prefixes or suffixes) More...
static final String | DLLPATH = "lib"
| The relative path where the native DLL is found. More...
static final int | C_STYLE = 0
| Use C index style for iRow and jCol vectors. More...
static final int | FORTRAN_STYLE = 1
| Use FORTRAN index style for iRow and jCol vectors. More...
static final int | SOLVE_SUCCEEDED = 0
| The possible Ipopt status return codes: should be kept in sync with Ipopt return codes. More...
static final int | ACCEPTABLE_LEVEL = 1
static final int | INFEASIBLE_PROBLEM = 2
static final int | SEARCH_DIRECTION_TOO_SMALL = 3
static final int | DIVERGING_ITERATES = 4
static final int | USER_REQUESTED_STOP = 5
static final int | ITERATION_EXCEEDED = -1
static final int | RESTORATION_FAILED = -2
static final int | ERROR_IN_STEP_COMPUTATION = -3
static final int | CPUTIME_EXCEEDED = -4
static final int | NOT_ENOUGH_DEGREES_OF_FRE = -10
static final int | INVALID_PROBLEM_DEFINITION = -11
static final int | INVALID_OPTION = -12
static final int | INVALID_NUMBER_DETECTED = -13
static final int | UNRECOVERABLE_EXCEPTION = -100
static final int | NON_IPOPT_EXCEPTION = -101
static final int | INSUFFICIENT_MEMORY = -102
static final int | INTERNAL_ERROR = -199

## Protected Member Functions
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. More...
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. More...
abstract boolean | eval_f (int n, double[] x, boolean new_x, double[] obj_value)
| Callback function for the objective function. More...
abstract boolean | eval_grad_f (int n, double[] x, boolean new_x, double[] grad_f)
| Callback function for the objective function gradient. More...
abstract boolean | eval_g (int n, double[] x, boolean new_x, int m, double[] g)
| Callback function for the constraints. More...
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. More...
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. More...
void | finalize () throws Throwable

## Private Member Functions
native boolean | AddIpoptIntOption (long ipopt, String keyword, int val)
| Native function should not be used directly. More...
native boolean | AddIpoptNumOption (long ipopt, String keyword, double val)
| Native function should not be used directly. More...
native boolean | AddIpoptStrOption (long ipopt, String keyword, String val)
| Native function should not be used directly. More...
native long | CreateIpoptProblem (int n, int m, int nele_jac, int nele_hess, int index_style)
| Native function should not be used directly. More...
native void | FreeIpoptProblem (long ipopt)
| Native function should not be used directly. More...
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. More...

## Private Attributes
long | ipopt
| Pointer to the native optimization object. More...
double | callback_grad_f []
| Callback arguments. More...
double | callback_jac_g []
double | callback_hess []
double | x []
| Final value of variable values. More...
double | obj_val [] = {0.0}
| Final value of objective function. More...
double | g []
| Values of constraint at final point. More...
double | mult_x_L []
| Final multipliers for lower variable bounds. More...
double | mult_x_U []
| Final multipliers for upper variable bounds. More...
double | mult_g []
| Final multipliers for constraints. More...
int | status = INVALID_PROBLEM_DEFINITION
| Status returned by the solver. More...

## Detailed Description

A Java Native Interface for the Ipopt optimization solver.

Ipopt is a solver for large scale nonlinear optimization problems (NLP).

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, int, 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, OptimizeNLP() will solve the problem. Objects of this class can be reused to solve different problems, in other words, create(int, int, int, int, int) and OptimizeNLP() 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.

Author
  Rafael de Pelegrini Soares
  Edson C. do Valle
  Tong Kewei, BeiHang University

Definition at line 47 of file Ipopt.java.

## Constructor & Destructor Documentation

org.coinor.Ipopt.Ipopt | ( |  | ) |
| inline

Creates a new NLP Solver using { DLLPATH} as path and { DLLNAME} as the DLL name.

See Also
  Ipopt(String, String)

Definition at line 135 of file Ipopt.java.

org.coinor.Ipopt.Ipopt | ( | String | path,
|  | String | DLL
| ) |  |
| inline

Creates a NLP Solver for the given DLL file.

The given file must implement the native interface required by this class.

Parameters

  path | the path where the DLL is found.
  DLL | the name of the DLL (without the extension or any platform dependent prefix).

See Also
  Ipopt()

Definition at line 148 of file Ipopt.java.

## Member Function Documentation

native boolean org.coinor.Ipopt.AddIpoptIntOption | ( | long | ipopt,
|  | String | keyword,
|  | int | val
| ) |  |
| private

Native function should not be used directly.

native boolean org.coinor.Ipopt.AddIpoptNumOption | ( | long | ipopt,
|  | String | keyword,
|  | double | val
| ) |  |
| private

Native function should not be used directly.

native boolean org.coinor.Ipopt.AddIpoptStrOption | ( | long | ipopt,
|  | String | keyword,
|  | String | val
| ) |  |
| private

Native function should not be used directly.

native long org.coinor.Ipopt.CreateIpoptProblem | ( | int | n,
|  | int | m,
|  | int | nele_jac,
|  | int | nele_hess,
|  | int | index_style
| ) |  |
| private

Native function should not be used directly.

native void org.coinor.Ipopt.FreeIpoptProblem | ( | long | ipopt | ) |
| private

Native function should not be used directly.

native int org.coinor.Ipopt.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[]
| ) |  |
| private

Native function should not be used directly.

abstract boolean org.coinor.Ipopt.get_bounds_info | ( | int | n,
|  | double[] | x_l,
|  | double[] | x_u,
|  | int | m,
|  | double[] | g_l,
|  | double[] | g_u
| ) |  |
| protected pure virtual

Callback function for the variable bounds and constraint sides.

Implemented in org.coinor.examples.scalable.LuksanVlcek1, and org.coinor.examples.HS071.

abstract boolean org.coinor.Ipopt.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
| ) |  |
| protected pure virtual

Callback function for retrieving a starting point.

Implemented in org.coinor.examples.scalable.LuksanVlcek1, and org.coinor.examples.HS071.

abstract boolean org.coinor.Ipopt.eval_f | ( | int | n,
|  | double[] | x,
|  | boolean | new_x,
|  | double[] | obj_value
| ) |  |
| protected pure virtual

Callback function for the objective function.

Implemented in org.coinor.examples.HS071, and org.coinor.examples.scalable.LuksanVlcek1.

abstract boolean org.coinor.Ipopt.eval_grad_f | ( | int | n,
|  | double[] | x,
|  | boolean | new_x,
|  | double[] | grad_f
| ) |  |
| protected pure virtual

Callback function for the objective function gradient.

Implemented in org.coinor.examples.scalable.LuksanVlcek1, and org.coinor.examples.HS071.

abstract boolean org.coinor.Ipopt.eval_g | ( | int | n,
|  | double[] | x,
|  | boolean | new_x,
|  | int | m,
|  | double[] | g
| ) |  |
| protected pure virtual

Callback function for the constraints.

Implemented in org.coinor.examples.HS071, and org.coinor.examples.scalable.LuksanVlcek1.

abstract boolean org.coinor.Ipopt.eval_jac_g | ( | int | n,
|  | double[] | x,
|  | boolean | new_x,
|  | int | m,
|  | int | nele_jac,
|  | int[] | iRow,
|  | int[] | jCol,
|  | double[] | values
| ) |  |
| protected pure virtual

Callback function for the constraints Jacobian.

Implemented in org.coinor.examples.scalable.LuksanVlcek1, and org.coinor.examples.HS071.

abstract boolean org.coinor.Ipopt.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
| ) |  |
| protected pure virtual

Callback function for the hessian.

Implemented in org.coinor.examples.scalable.LuksanVlcek1, and org.coinor.examples.HS071.

void org.coinor.Ipopt.dispose | ( |  | ) |
| inline

Dispose of the natively allocated memory.

Programmers should, for efficiency, call the dispose method when finished using a Ipopt object.

An JIpopt object can be reused to solve different problems by calling again create(int, int, 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.

Definition at line 192 of file Ipopt.java.

void org.coinor.Ipopt.finalize | ( |  | ) | throws Throwable
| inline protected

Definition at line 202 of file Ipopt.java.

boolean org.coinor.Ipopt.create | ( | int | n,
|  | int | m,
|  | int | nele_jac,
|  | int | nele_hess,
|  | int | index_style
| ) |  |
| inline

Create a new problem.

the use is the same as get_nlp_info, change the name for clarity in java.

Parameters

  n | the number of variables in the problem.
  m | the number of constraints in the problem.
  nele_jac | the number of nonzero entries in the Jacobian.
  nele_hess | the number of nonzero entries in the Hessian.
  index_style | the numbering style used for row/col entries in the sparse matrix format (C_STYLE or FORTRAN_STYLE).

Returns
  true on success, otherwise false

Definition at line 217 of file Ipopt.java.

boolean org.coinor.Ipopt.setIntegerOption | ( | String | keyword,
|  | int | val
| ) |  |
| inline

Function for setting an integer option.

For a list of valid keywords check the Ipopt documentation.

Parameters

  keyword | the option keyword
  val | the value

Returns
  false if the option could not be set (e.g., if keyword is unknown)

Definition at line 249 of file Ipopt.java.

boolean org.coinor.Ipopt.setNumericOption | ( | String | keyword,
|  | double | val
| ) |  |
| inline

Function for setting a number option.

For a list of valid keywords check the Ipopt documentation.

Parameters

  keyword | the option keyword
  val | the value

Returns
  false if the option could not be set (e.g., if keyword is unknown)

Definition at line 262 of file Ipopt.java.

boolean org.coinor.Ipopt.setStringOption | ( | String | keyword,
|  | String | val
| ) |  |
| inline

Function for setting a string option.

For a list of valid keywords check the Ipopt documentation.

Parameters

  keyword | the option keyword
  val | the value

Returns
  false if the option could not be set (e.g., if keyword is unknown)

Definition at line 275 of file Ipopt.java.

int org.coinor.Ipopt.OptimizeNLP | ( |  | ) |
| inline

This function actually solve the problem.

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.

Returns
  the solve status

See Also
  getStatus()

Definition at line 290 of file Ipopt.java.

double [] org.coinor.Ipopt.getVariableValues | ( |  | ) |
| inline

Gives primal variable values at final point.

Returns
  the primal variable values at the final point.

Definition at line 302 of file Ipopt.java.

double org.coinor.Ipopt.getObjectiveValue | ( |  | ) |
| inline

Gives objective function value at final point.

Returns
  the final value of the objective function.

Definition at line 310 of file Ipopt.java.

int org.coinor.Ipopt.getStatus | ( |  | ) |
| inline

Gives Ipopt status of last OptimizeNLP call.

Returns
  the status of the solver.

See Also
  OptimizeNLP()

Definition at line 320 of file Ipopt.java.

double [] org.coinor.Ipopt.getConstraintValues | ( |  | ) |
| inline

Gives constraint function values at final point.

Returns
  Returns the final values for the constraints functions.

Definition at line 328 of file Ipopt.java.

double [] org.coinor.Ipopt.getConstraintMultipliers | ( |  | ) |
| inline

Gives constraint dual multipliers in final point.

Returns
  Returns the final multipliers for the constraints.

Definition at line 336 of file Ipopt.java.

double [] org.coinor.Ipopt.getLowerBoundMultipliers | ( |  | ) |
| inline

Gives dual multipliers for variable lower bounds in final point.

Returns
  Returns the final multipliers for the variable lower bounds.

Definition at line 344 of file Ipopt.java.

double [] org.coinor.Ipopt.getUpperBoundMultipliers | ( |  | ) |
| inline

Gives dual multipliers for variable upper bounds in final point.

Returns
  Returns the final multipliers for the variable upper bounds.

Definition at line 352 of file Ipopt.java.

boolean org.coinor.Ipopt.get_scaling_parameters | ( | double[] | obj_scaling,
|  | int | n,
|  | double[] | x_scaling,
|  | int | m,
|  | double[] | g_scaling,
|  | boolean[] | use_x_g_scaling
| ) |  |
| inline

If you using_scaling_parameters = true, please overload this method,.

To instruct IPOPT to use scaling values for variables, the first element of use_x_g_scaling should be set. To instruct IPOPT to use scaling values for constraints, the second element of use_x_g_scaling should be set.

Parameters

  obj_scaling | double[1] to store a scaling factor for the objective (negative value leads to maximizing the objective function)
  n | the number of variables in the problem
  x_scaling | array to store the scaling factors for the variables
  m | the number of constraints in the problem
  g_scaling | array to store the scaling factors for the constraints
  use_x_g_scaling | boolean[2] to store whether scaling factors for variables (1st entry) and constraints (2nd entry) should be used

Returns
  true on success, otherwise false

Definition at line 371 of file Ipopt.java.

int org.coinor.Ipopt.get_number_of_nonlinear_variables | ( |  | ) |
| inline

When LBFGS hessian approximation is used, this method should be overloaded.

Returns
  number of nonlinear variables, a negative value indicates that all variables are negative

Definition at line 383 of file Ipopt.java.

boolean org.coinor.Ipopt.get_list_of_nonlinear_variables | ( | int | num_nonlin_vars,
|  | int[] | pos_nonlin_vars
| ) |  |
| inline

When LBFGS hessian approximation is used, this method should be overloaded.

Parameters

  num_nonlin_vars | number of nonlinear variables and length of pos_nonlin_vars array
  pos_nonlin_vars | the indices of all nonlinear variables

Returns
  true on success, otherwise false

Definition at line 395 of file Ipopt.java.

## Member Data Documentation

final String org.coinor.Ipopt.DLLNAME = "jipopt"
| static

The default DLL name of the native implementation (without any platform dependent prefixes or suffixes)

Definition at line 73 of file Ipopt.java.

final String org.coinor.Ipopt.DLLPATH = "lib"
| static

The relative path where the native DLL is found.

Definition at line 75 of file Ipopt.java.

final int org.coinor.Ipopt.C_STYLE = 0
| static

Use C index style for iRow and jCol vectors.

Definition at line 78 of file Ipopt.java.

final int org.coinor.Ipopt.FORTRAN_STYLE = 1
| static

Use FORTRAN index style for iRow and jCol vectors.

Definition at line 80 of file Ipopt.java.

final int org.coinor.Ipopt.SOLVE_SUCCEEDED = 0
| static

The possible Ipopt status return codes: should be kept in sync with Ipopt return codes.

Definition at line 83 of file Ipopt.java.

final int org.coinor.Ipopt.ACCEPTABLE_LEVEL = 1
| static

Definition at line 84 of file Ipopt.java.

final int org.coinor.Ipopt.INFEASIBLE_PROBLEM = 2
| static

Definition at line 85 of file Ipopt.java.

final int org.coinor.Ipopt.SEARCH_DIRECTION_TOO_SMALL = 3
| static

Definition at line 86 of file Ipopt.java.

final int org.coinor.Ipopt.DIVERGING_ITERATES = 4
| static

Definition at line 87 of file Ipopt.java.

final int org.coinor.Ipopt.USER_REQUESTED_STOP = 5
| static

Definition at line 88 of file Ipopt.java.

final int org.coinor.Ipopt.ITERATION_EXCEEDED = -1
| static

Definition at line 89 of file Ipopt.java.

final int org.coinor.Ipopt.RESTORATION_FAILED = -2
| static

Definition at line 90 of file Ipopt.java.

final int org.coinor.Ipopt.ERROR_IN_STEP_COMPUTATION = -3
| static

Definition at line 91 of file Ipopt.java.

final int org.coinor.Ipopt.CPUTIME_EXCEEDED = -4
| static

Definition at line 92 of file Ipopt.java.

final int org.coinor.Ipopt.NOT_ENOUGH_DEGREES_OF_FRE = -10
| static

Definition at line 93 of file Ipopt.java.

final int org.coinor.Ipopt.INVALID_PROBLEM_DEFINITION = -11
| static

Definition at line 94 of file Ipopt.java.

final int org.coinor.Ipopt.INVALID_OPTION = -12
| static

Definition at line 95 of file Ipopt.java.

final int org.coinor.Ipopt.INVALID_NUMBER_DETECTED = -13
| static

Definition at line 96 of file Ipopt.java.

final int org.coinor.Ipopt.UNRECOVERABLE_EXCEPTION = -100
| static

Definition at line 97 of file Ipopt.java.

final int org.coinor.Ipopt.NON_IPOPT_EXCEPTION = -101
| static

Definition at line 98 of file Ipopt.java.

final int org.coinor.Ipopt.INSUFFICIENT_MEMORY = -102
| static

Definition at line 99 of file Ipopt.java.

final int org.coinor.Ipopt.INTERNAL_ERROR = -199
| static

Definition at line 100 of file Ipopt.java.

long org.coinor.Ipopt.ipopt
| private

Pointer to the native optimization object.

Definition at line 103 of file Ipopt.java.

double org.coinor.Ipopt.callback_grad_f[]
| private

Callback arguments.

Definition at line 106 of file Ipopt.java.

double org.coinor.Ipopt.callback_jac_g[]
| private

Definition at line 107 of file Ipopt.java.

double org.coinor.Ipopt.callback_hess[]
| private

Definition at line 108 of file Ipopt.java.

double org.coinor.Ipopt.x[]
| private

Final value of variable values.

Definition at line 111 of file Ipopt.java.

double org.coinor.Ipopt.obj_val[] = {0.0}
| private

Final value of objective function.

Definition at line 114 of file Ipopt.java.

double org.coinor.Ipopt.g[]
| private

Values of constraint at final point.

Definition at line 117 of file Ipopt.java.

double org.coinor.Ipopt.mult_x_L[]
| private

Final multipliers for lower variable bounds.

Definition at line 120 of file Ipopt.java.

double org.coinor.Ipopt.mult_x_U[]
| private

Final multipliers for upper variable bounds.

Definition at line 123 of file Ipopt.java.

double org.coinor.Ipopt.mult_g[]
| private

Final multipliers for constraints.

Definition at line 126 of file Ipopt.java.

int org.coinor.Ipopt.status = INVALID_PROBLEM_DEFINITION
| private

Status returned by the solver.

Definition at line 129 of file Ipopt.java.

The documentation for this class was generated from the following file:

- contrib/JavaInterface/org/coinor/Ipopt.java