Getting Started Example (nlp0)
/***************************************************************/
/* */
/* S A S S A M P L E L I B R A R Y */
/* */
/* NAME: nlp0 */
/* TITLE: Getting Started Example (nlp0) */
/* PRODUCT: OR */
/* SYSTEM: ALL */
/* KEYS: OR */
/* PROCS: OPTMODEL */
/* DATA: */
/* */
/* SUPPORT: UPDATE: */
/* REF: */
/* MISC: Example from the Getting Started section of the */
/* Interior Point Nonlinear Programming Solver */
/* chapter of Mathematical Programming. */
/* */
/***************************************************************/
proc optmodel;
var x{1..3} >= 0;
minimize f = (x[1] + 3*x[2] + x[3])**2 + 4*(x[1] - x[2])**2;
con constr1: sum{i in 1..3}x[i] = 1;
con constr2: 6*x[2] + 4*x[3] - x[1]**3 - 3 >= 0;
/* starting point */
x[1] = 0.1;
x[2] = 0.7;
x[3] = 0.2;
solve with NLP;
print x;
quit;
proc optmodel;
number n = 1000;
number b = 5;
var x{1..n} >= -1 <= 1 init 0.99;
var y{1..n} >= -1 <= 1 init -0.99;
var z{1..b} >= 0 <= 2 init 0.5;
minimize f = sum {i in 1..n} x[i] * y[i] + sum {j in 1..b} 0.5 * z[j]^2;
con cons1{k in 1..n}: x[k] + y[k] + sum {j in 1..b} z[j] = b;
con cons2: sum {i in 1..n} (x[i] + y[i]) + sum {j in 1..b} z[j] >= b + 1;
solve with NLP / algorithm=activeset logfreq=10;
quit;
proc optmodel;
var x >= -1 <= 1;
var y >= -1 <= 1;
min f = exp(sin(50*x)) + sin(60*exp(y)) + sin(70*sin(x)) + sin(sin(80*y))
- sin(10*(x+y)) + (x^2+y^2)/4;
solve with nlp / multistart seed=94245 msmaxstarts=30;
quit;