Using Dense Format (lsoe01)
/**********************************************************************/
/* */
/* S A S S A M P L E L I B R A R Y */
/* */
/* NAME: lsoe01 */
/* TITLE: Using Dense Format (lsoe01) */
/* PRODUCT: OR */
/* SYSTEM: ALL */
/* KEYS: OR */
/* PROCS: OPTLSO, FCMP, PRINT */
/* DATA: */
/* */
/* SUPPORT: UPDATE: */
/* REF: */
/* MISC: Example 1 from the OPTLSO chapter of the */
/* Local Search Optimization book. */
/* */
/**********************************************************************/
data vardata;
input _id_ $ _lb_ _ub_;
datalines;
x1 0 1
x2 0 1
x3 0 1
x4 0 1
x5 0 1
x6 0 1
x7 0 1
x8 0 1
x9 0 1
x10 0 100
x11 0 100
x12 0 100
x13 0 1
;
proc fcmp outlib=sasuser.myfuncs.mypkg;
function quadobj(x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13);
sum1 = 5*(x1 + x2 + x3 + x4);
sum2 = 5*(x1**2 + x2**2 + x3**2 + x4**2);
sum3 = (x5 + x6 + x7 + x8 + x9 + x10 + x11 + x12 + x13);
return (sum1 - sum2 - sum3);
endsub;
run;
data objdata;
input _id_ $ _function_ $ _sense_ $;
datalines;
f quadobj min
;
data lindata;
input _id_ $ _lb_ x1-x13 _ub_;
datalines;
a1 . 2 2 0 0 0 0 0 0 0 1 1 0 0 10
a2 . 2 0 2 0 0 0 0 0 0 1 0 1 0 10
a3 . 2 0 2 0 0 0 0 0 0 0 1 1 0 10
a4 . -8 0 0 0 0 0 0 0 0 1 0 0 0 0
a5 . 0 -8 0 0 0 0 0 0 0 0 1 0 0 0
a6 . 0 0 -8 0 0 0 0 0 0 0 0 1 0 0
a7 . 0 0 0 -2 -1 0 0 0 0 1 0 0 0 0
a8 . 0 0 0 0 0 -2 -1 0 0 0 1 0 0 0
a9 . 0 0 0 0 0 0 0 -2 -1 0 0 1 0 0
;
options cmplib = sasuser.myfuncs;
proc optlso
primalout = solution
objective = objdata
variables = vardata
lincon = lindata;
performance nthreads=2;
run;
proc print data=solution;
run;