nlpsolve computes the optimum of a (not necessarily differentiable) nonlinear (multivariate) objective function, subject to a set of nonlinear equality and/or inequality constraints, using the COBYLA algorithm.
Examples.
⎡ ⎣ | −1.73205080757, | ⎡ ⎣ | x1=−4.77142305945×10−8,x2=1.73205080757 | ⎤ ⎦ | ⎤ ⎦ |
⎡ ⎣ | −3300.0, | ⎡ ⎣ | x1=20.0,x2=11.0,x3=15.0 | ⎤ ⎦ | ⎤ ⎦ |
nlpsolve(x^3+2x*y-2y^2,x=-10..10,y=-10..10, |
nlp_initialpoint=[x=3,y=4],maximize) |
⎡ ⎣ | 1050.0, | ⎡ ⎣ | x=10.0,y=4.99999985519 | ⎤ ⎦ | ⎤ ⎦ |
⎡ ⎣ | −0.217233628211, | ⎡ ⎣ | x=4.49340946198 | ⎤ ⎦ | ⎤ ⎦ |
nlpsolve(2-1/120*x1*x2*x3*x4*x5, |
[x1<=1,x2<=2,x3<=3,x4<=4,x5<=5],assume=nlp_nonnegative) |
⎡ ⎣ | 1.0, | ⎡ ⎣ | x1=1.0,x2=2.0,x3=3.0,x4=4.0,x5=5.0 | ⎤ ⎦ | ⎤ ⎦ |