NLopt Tutorial
From AbInitio
(Difference between revisions)
Revision as of 22:10, 13 November 2008
In this tutorial, we illustrate the usage of NLopt in various languages via one or two trivial examples.
[edit]
Example nonlinearly constrained problem
As a first example, we'll look at the nonlinearly constrained minimization problem:
- subject to , , and
for parameters a1=2, b1=0, a2=-1, b2=1.
The feasible region defined by these constraints is plotted at right: x2 is constrained to lie at the maximum of two cubics, and the optimum point is located at the intersection (1/3, 8/27) where the objective function takes on the value .
(This problem is especially trivial, because by formulating it in terms of the cube root of x2 you can turn it into a linear-programming problem, but we won't do that here.)