{{ message }}

# cureos / jcobyla

Java port of COBYLA2 nonlinear constrained optimization method

Switch branches/tags
Nothing to show

## Files

Failed to load latest commit information.
Type
Name
Commit time

# jcobyla¶ ↑

Constrained Optimization BY Linear Approximation in Java

COBYLA2 is an implementation of Powell’s nonlinear derivative–free constrained optimization that uses a linear approximation approach. The algorithm is a sequential trust–region algorithm that employs linear approximations to the objective and constraint functions, where the approximations are formed by linear interpolation at n + 1 points in the space of the variables and tries to maintain a regular–shaped simplex over iterations.

It solves nonsmooth NLP with a moderate number of variables (about 100). Inequality constraints only.

The initial point X is taken as one vertex of the initial simplex with zero being another, so, X should not be entered as the zero vector.

## Usage¶ ↑

The files Cobyla.java, Calcfc.java and CobylaExitStatus.java can be included in the package com.cureos.numerics of any Java project.

The Java implementation is relatively faithful to the original Fortran 77 and 90 implementations. It should be noted however that the

indexing of the variables and constraints arrays in the public interface is zero-based, i.e. for a problem with 3 variables, x, x and x should be employed in the objective and constraints function evaluations.

The objective function and (potentially) constraints functions computation should be is represented by the Compute method in the Calcfc interface. Implement the interface explicitly or anonymously. The Compute method exhibits the following signature:

`double Compute(int n, int m, double[] x, double[] con)`

where n is the number of variables, m is the number of constraints, x is the variable array, and con is the array of calculated constraints function values. The method should return the value of the objective function.

To minimize the objective function subject to constraints, call the static Cobyla.FindMinimum method:

```CobylaExitStatus FindMinimum(Calcfc calcfc, int n, int m, double[] x,
double rhobeg, double rhoend, int iprint, int maxfun);```

where x on input is the initial variable array, rhobeg and rhoend are the initial and final values of the simplex, iprint (0..3) specifies the level of output to the console, and maxfun is the maximum allowed number of function evaluations. On output x is the optimal obtained variable values. The method returns final optimization status, which is one of normal termination, maximum iterations reached or diverging rounding errors.

For usage examples with anonymous interface implementations, please review the CobylaTest.java file in the test folder.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

## Revision history¶ ↑

• May 2, 2012: Reference to usage examples.

• May 1, 2012: Initial document.

Java port of COBYLA2 nonlinear constrained optimization method

1 tags

## Packages 0

No packages published