## A Nonlinear Optimization Problem (oclpe04)

```/***************************************************************/
/*                                                             */
/*          S A S   S A M P L E   L I B R A R Y                */
/*                                                             */
/*    NAME: oclpe04                                            */
/*   TITLE: A Nonlinear Optimization Problem (oclpe04)         */
/* PRODUCT: OR                                                 */
/*  SYSTEM: ALL                                                */
/*    KEYS: OR                                                 */
/*   PROCS: OPTMODEL                                           */
/*    DATA:                                                    */
/*                                                             */
/* SUPPORT:                             UPDATE:                */
/*     REF:                                                    */
/*    MISC: Example 4 from the CLP solver chapter of the       */
/*          Mathematical Programming book.                     */
/*                                                             */
/***************************************************************/

proc optmodel;
set DOM{1..3} = [ (-5 .. 5) (-5 .. 9 by 2) (1 .. 10) ];
var X{i in 1..3} integer >= min{j in DOM[i]} j <= max{j in DOM[i]} j;

/* map the domain of X and X to 1 .. list size */
var Z {1..2} integer;
/* map nonlinear expressions */
var Y {1..4} integer;

/* Use an element constraint to represent noncontiguous domains */
/* domains with negative numbers, and nonlinear functions. */
/* Z does not appear anywhere else. Its only purpose is
to restrict X to take a value from DOM. */
con MapDomainTo1ToCard{i in 1..2}:
element(Z[i], {k in DOM[i]} k, X[i]);

/* Functional Dependencies on X */
/* Y = X^3 -- Use Z for X for proper indexing */
con Y1:
element(Z, {k in DOM} (k^3), Y);

/* Y = mod(X, 4) */
con Y4:
element(Z, {k in DOM} (mod(k,4)), Y);

/* Functional Dependencies on X */
/* Y = 2^X */
con Y2:
element(X, {k in DOM} (2^k), Y);

/* Y = X^2 */
con Y3:
element(X, {k in DOM} (k^2), Y);

/* X - 0.5 * X + X^2 <= 50 */
con Con1:
X - 0.5 * X + Y <= 50;

/* mod(X,4) + 0.25 * X >= 1.5 */
con Con2:
Y + 0.25 * X >= 1.5;

/* Objective function: X^3 + 5 * X - 2^X */
max Objective = Y + 5 * X - Y;

solve;
print X Y Z;
quit;

```