The OPTLSO Procedure

Example 3.1 Using Dense Format

This example uses data from Floudas and Pardalos (1992) and illustrates how to use the VARIABLES= and LINCON= options in conjunction with the OBJECTIVE= option. The problem has nine linear constraints and a quadratic objective function. Suppose you want to minimize

\[  f(x) = 5\sum _{i=1}^4 x_ i - 5\sum _{i=1}^4 x_ i^2 - \sum _{i=5}^{13} x_ i  \]

subject to

\[  \begin{array}{l} 2 x_1 + 2 x_2 + x_{10} + x_{11} \leq 10 \\ 2 x_1 + 2 x_3 + x_{10} + x_{12} \leq 10 \\ 2 x_1 + 2 x_3 + x_{11} + x_{12} \leq 10 \\ -8 x_1 + x_{10} \leq 0 \\ -8 x_2 + x_{11} \leq 0 \\ -8 x_3 + x_{12} \leq 0 \\ -2 x_4 - x_5 + x_{10} \leq 0 \\ -2 x_6 - x_7 + x_{11} \leq 0 \\ -2 x_8 - x_9 + x_{12} \leq 0 \\ \end{array}  \]

and

\[  \begin{array}{ll} 0 \leq x_ i \leq 1, & \quad i = 1,2,\ldots ,9 \\ 0 \leq x_ i \leq 100, &  \quad i = 10,11,12 \\ 0 \leq x_{13} \leq 1 \end{array}  \]

The following statements use the dense format to define the linear constraints:

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;

The VARIABLES= VARDATA option in the PROC OPTLSO statement specifies the variables and their respective bounds. The objective function is defined by using PROC FCMP and the objective function name QUADOBJ. Other properties are described in the SAS data set objdata. The linear constraints are specified by using the SAS data set lindata, in which each row stores the (zero and nonzero) coefficients of the corresponding linear constraint along with their respective lower and upper bounds. The problem description is then passed to the OPTLSO procedure by using the options VARIABLES= VARDATA, OBJECTIVE= OBJDATA, and LINCON= LINDATA. The PERFORMANCE statement specifies the number of threads that PROC OPTLSO can use.

Output 3.1.1 shows the output from running these statements.

Output 3.1.1: Using Dense Format

The OPTLSO Procedure

Performance Information
Execution Mode Single-Machine
Number of Threads 2

Problem Summary
Problem Type NLP
   
Linear Constraints LINDATA
Objective Definition Set OBJDATA
Variables VARDATA
   
Number of Variables 13
Integer Variables 0
Continuous Variables 13
   
Number of Constraints 9
Linear Constraints 9
Nonlinear Constraints 0
   
Objective Definition Source OBJDATA
Objective Sense Minimize

Solution Summary
Solution Status Function convergence
Objective -15.00099275
Infeasibility 0.0009927519
Iterations 32
Evaluations 3956
Cached Evaluations 356
Global Searches 1
Population Size 160
Seed 1

Obs _sol_ _id_ _value_
1 0 _obj_ -15.0010
2 0 _inf_ 0.0010
3 0 x1 1.0000
4 0 x2 1.0000
5 0 x3 1.0000
6 0 x4 1.0000
7 0 x5 1.0000
8 0 x6 1.0000
9 0 x7 1.0000
10 0 x8 1.0000
11 0 x9 1.0000
12 0 x10 3.0000
13 0 x11 3.0000
14 0 x12 3.0010
15 0 x13 1.0000
16 0 f -15.0010