public class MinConNLPEx3 extends Object implements MinConNLP.Function
MinConNLP Example 3: Solves a general nonlinear programming problem using a finite difference gradient.
A general nonlinear programming problem is solved using a finite difference gradient. Intermediate output is captured in a file named MinConNLPlog.txt. The level of output requested is FINE. The problem statement is as follows:$${\rm {min}} \,\, F(x) = (x_1 - 2)^2 + (x_2 - 1)^2$$
subject to
$$g_1(x) = x_1 - 2x_2 + 1 = 0$$
$$g_2(x) = -x_1^2 / 4 - x_2^2 + 1 \ge 0$$
| Constructor and Description |
|---|
MinConNLPEx3() |
| Modifier and Type | Method and Description |
|---|---|
double |
f(double[] x,
int iact,
boolean[] ierr)
Defines the objective function and constraints.
|
static void |
main(String[] args) |
public double f(double[] x,
int iact,
boolean[] ierr)
This function is called by MinConNLP.
f in interface MinConNLP.Functionx - a double array containing the variable valuesiact - an int specifying the return value. If
iact=0 this function returns the objective function
evaluated at x. If iact=\(1, 2, 3,...\), this
function returns the constraint with that index evaluated at
x.ierr - a boolean array of length 1, where
ierr[0]=false when no error or undesirable condition occurs
during evaluation, and ierr[0]=true indicates some issue
during evaluationdouble the value specified by iactCopyright © 2020 Rogue Wave Software. All rights reserved.