The following optimization problem is discussed in Haverly (1978) and Liebman et al. (1986). This example illustrates how to use PROC FCMP to define nonlinear constraints and use an MPS data set to define linear constraints. Minimize
subject to
and
In the following steps, the linear component of the problem definition is first described in PROC OPTMODEL and then saved
as an MPS data set. Because the objective is linear, no FCMP objective function needs to be used. In the second section of
steps, the nonlinear constraints are defined by using FCMP functions, and their corresponding names and lower and upper bounds
are stored in the data set condata
. The OPTLSO procedure is then called with the options NLINCON=CONDATA and MPSDATA=NLCEX.
proc optmodel; var x{1..10} >= 0; x[10].lb = 1; x[10].ub = 3; x[1].ub = 100; x[2].ub = 200; con x[3] + x[4] = x[6] + x[7], x[6] + x[8] = x[1], x[7] + x[9] = x[2], x[8] + x[9] = x[5]; max f = 9*x[1] + 15*x[2] - 6*x[3] - 16*x[4] - 10*x[5]; save mps nlcexOld; quit; %lsompsmod(nlcexOld, nlcex); proc fcmp outlib=sasuser.myfuncs.mypkg; function nlc1(x1,x6,x8,x10); return (2.5*x1 - x10*x6 - 2*x8); endsub; function nlc2(x2,x7,x9,x10); return (1.5*x2 - x10*x7 - 2*x9); endsub; function nlc3(x3,x4,x10); return (3*x3 + x4 - x10*(x3 + x4)); endsub; run; data condata; input _id_ $ _lb_ _ub_; datalines; nlc1 0 . nlc2 0 . nlc3 0 0 ;
options cmplib = sasuser.myfuncs; proc optlso mpsdata = nlcex nlincon = condata logfreq = 10; performance nthreads=2; run;
Output 3.6.1 shows the ODS tables that are produced from running these steps.
Output 3.6.1: Using Nonlinear Constraints: ODS Tables
Performance Information | |
---|---|
Execution Mode | Single-Machine |
Number of Threads | 2 |
Parallel Mode | Deterministic |
Problem Summary | |
---|---|
Problem Type | NLP |
MPS Data Set | NLCEX |
Nonlinear Constraints | CONDATA |
Number of Variables | 10 |
Integer Variables | 0 |
Continuous Variables | 10 |
Number of Constraints | 7 |
Linear Constraints | 4 |
Nonlinear Constraints | 3 |
Objective Definition Source | NLCEX |
Objective Sense | Maximize |
Solution Summary | |
---|---|
Solution Status | Function convergence |
Objective | 400.00410275 |
Infeasibility | 0.0006838001 |
Iterations | 18 |
Evaluations | 2277 |
Cached Evaluations | 979 |
Global Searches | 1 |
Population Size | 160 |
Seed | 1 |
Output 3.6.2 shows the iteration log from running these steps.
Output 3.6.2: Using Nonlinear Constraints: Log
NOTE: The OPTLSO procedure is executing in single-machine mode. |
NOTE: The OPTLSO algorithm is using up to 2 threads. |
NOTE: The problem has 10 variables (0 integer, 10 continuous). |
NOTE: The problem has 7 constraints (4 linear, 3 nonlinear). |
NOTE: The problem has 3 FCMP function definitions. |
NOTE: The deterministic parallel mode is enabled. |
Best |
Iteration Objective Infeasibility Evals Time |
1 0 0 170 0 |
18 400.004102752588 0.00068380013315 2277 1 |
NOTE: Function convergence criteria reached. |
NOTE: There were 3 observations read from the data set WORK.CONDATA. |