Resources

Linear Constraints and a Nonlinear Objective (lsoe05)

/**********************************************************************/
/*                                                                    */
/*               S A S   S A M P L E   L I B R A R Y                  */
/*                                                                    */
/*    NAME: lsoe05                                                    */
/*   TITLE: Linear Constraints and a Nonlinear Objective (lsoe05)     */
/* PRODUCT: OR                                                        */
/*  SYSTEM: ALL                                                       */
/*    KEYS: OR                                                        */
/*   PROCS: OPTLSO, FCMP                                              */
/*    DATA:                                                           */
/*                                                                    */
/* SUPPORT:                             UPDATE:                       */
/*     REF:                                                           */
/*    MISC: Example 5 from the OPTLSO chapter of the                  */
/*          Local Search Optimization book.                           */
/*                                                                    */
/**********************************************************************/

data xbnds;
   input _id_ $ _lb_ _ub_;
   datalines;
x1 -2 2
x2 -2 2
;

data lindata;
   input _id_ $ _lb_ x1 x2 _ub_;
   datalines;
a1   . 2  1 2
a2  -2 1 -1 .
a3  -2 1  2 .
;

data objdata;
   input _id_ $ _function_ $ _sense_ $;
   datalines;
f   sixhump     min
;

proc fcmp outlib=sasuser.myfuncs.mypkg;
   function sixhump(x1,x2);
      return ((4 - 2.1*x1**2 + x1**4/3)*x1**2 + x1*x2 + (-4 + 4*x2**2)*x2**2);
   endsub;
run;

options cmplib = sasuser.myfuncs;
proc optlso
   primalout = solution
   variables = xbnds
   objective = objdata
   lincon    = lindata;
   performance nthreads=2;
run;

proc print data=solution;
run;