The OPTMODEL Procedure

ODS Table and Variable Names

PROC OPTMODEL assigns a name to each table it creates. You can use these names to reference the table when you use the Output Delivery System (ODS) to select tables and create output data sets. The names of tables common to all solvers are listed in Table 5.12. Some solvers can generate additional tables; see the individual solver chapters for more information. For more information about ODS, see SAS Output Delivery System: User’s Guide.

Table 5.12: ODS Tables Produced in PROC OPTMODEL

ODS Table Name

Description

Statement/Option

CoforPerfInfo

List of COFOR statement performance options and their values

COFOR

DerivMethods

List of derivatives used by the solver, including the method of computation

SOLVE

OptStatistics

Solver-dependent description of the resources required for solution, including function evaluations and solver time

SOLVE

PrintTable

Specified parameter or variable values

PRINT

ProblemSummary

Description of objective, variables, and constraints

SOLVE

ProfileInfo

Detailed timing of statements and declarations

PROFILE

SolutionSummary

Overview of solution, including solver-dependent solution quality values

SOLVE

SolverOptions

List of solver options and their values

SOLVE

PerformanceInfo

List of solver performance options and their values

SOLVE

Timing

Detailed solution timing

PERFORMANCE / DETAILS


To guarantee that ODS output data sets contain information from all executed statements, use the PERSIST= option in the ODS OUTPUT statement. For details, see SAS Output Delivery System: User's Guide. Note: The SUBMIT statement resets ODS SELECT and EXCLUDE lists.

Table 5.13 lists the variable names of the preceding tables used in the ODS template of the OPTMODEL procedure.

Table 5.13: Variable Names for the ODS Tables Produced in PROC OPTMODEL

ODS Table Name

Variables

CoforPerfInfo

Label1, cValue1, and nValue1

DerivMethods

Label1, cValue1, and nValue1

OptStatistics

Label1, cValue1, and nValue1

PrintTable (matrix form)

ROW, COL1 – COLn

PrintTable (table form)

COL1 – COLn, identifier-expression(_suffix)

ProblemSummary

Label1, cValue1, and nValue1

ProfileInfo

Item, Line, Column, Count, NetTime, WaitTime, and PctTime

SolutionSummary

Label1, cValue1, and nValue1

SolverOptions

Label1, cValue1, nValue1, cValue2, and nValue2

PerformanceInfo

Label1, cValue1, and nValue1

Timing

Label1, cValue1, nValue1, cValue2, and nValue2


The PRINT statement produces an ODS table named PrintTable. The variable names that are used depend on the display format used. See the section Formatted Output for details about choosing the display format.

For the PRINT statement with table format, the columns that display array indices are named COL1–COLn, where n is the number of index elements. Columns that display values from identifier expressions are named using the expression’s name and suffix. The identifier name becomes the output variable name if no suffix is used. Otherwise the variable name is formed by appending an underscore (_) and the suffix to the identifier name. Columns that display the value of expressions are named COLn, where n is the column number in the table.

For the PRINT statement with matrix format, the first column has the variable name ROW. The remaining columns are named COL1–COLn, where n is the number of distinct column indices. When an ODS table displays values from identifier expressions, a label is generated based on the expression’s name and suffix, as described for column names in the case of table format.

The PRINTLEVEL= option controls the ODS tables produced by the SOLVE and COFOR statements. When PRINTLEVEL=0, the statements produce no ODS tables. When PRINTLEVEL=1, the SOLVE statement produces the ODS tables ProblemSummary, SolutionSummary, and PerformanceInfo. When PRINTLEVEL=2, the SOLVE statement produces the ODS tables ProblemSummary, SolverOptions, DerivMethods, SolutionSummary, OptStatistics, and PerformanceInfo. When PRINTLEVEL=1 or 2, the COFOR statement produces the ODS table CoforPerfInfo.

The PERFORMANCE statement controls additional ODS tables that can be produced by the SOLVE and COFOR statements. The PerformanceInfo table displays PERFORMANCE statement options that are used by the SOLVE statement. The CoforPerfInfo table displays PERFORMANCE statement options that are used by the COFOR statement. If you specify the DETAILS option in the PERFORMANCE statement, then the SOLVE statement also produces the ODS table Timing. The COFOR statement uses the DETAILS option to set default performance options with each loop iteration.

The following statements generate several ODS tables and write each table to a SAS data set:

proc optmodel printlevel=2;
   ods output PrintTable=expt ProblemSummary=exps DerivMethods=exdm
              SolverOptions=exso SolutionSummary=exss OptStatistics=exos
              Timing=exti;
   performance details;
   var x{1..2} >= 0;
   min z = 2*x[1] + 3 * x[2] + x[1]**2 + 10*x[2]**2
           + 2.5*x[1]*x[2] + x[1]**3;
   con c1: x[1] - x[2] <= 1;
   con c2: x[1] + 2*x[2] >= 100;
   solve;
   print x;

The data set expt contains the PrintTable table and is shown in Figure 5.46. The variable names are COL1 and x.

Figure 5.46: PrintTable ODS Table

PrintTable

Obs COL1 x
1 1 10.448
2 2 44.776



The data set exps contains the ProblemSummary table and is shown in Figure 5.47. The variable names are Label1, cValue1, and nValue1. The rows describe the instance, and the description depends on the form of the problem. In most solvers, the rows describe the objective function, variables, and constraints. In the network solver, the rows describe the number of nodes, the number of edges, the directedness of the graph, and the type of problem solved over the graph.

Figure 5.47: ProblemSummary ODS Table

ProblemSummary

Obs Label1 cValue1 nValue1
1 Objective Sense Minimization .
2 Objective Function z .
3 Objective Type Nonlinear .
4     .
5 Number of Variables 2 2.000000
6 Bounded Above 0 0
7 Bounded Below 2 2.000000
8 Bounded Below and Above 0 0
9 Free 0 0
10 Fixed 0 0
11     .
12 Number of Constraints 2 2.000000
13 Linear LE (<=) 1 1.000000
14 Linear EQ (=) 0 0
15 Linear GE (>=) 1 1.000000
16 Linear Range 0 0



The data set exso contains the SolverOptions table and is shown in Figure 5.48. The variable names are Label1, cValue1, nValue1, cValue2, and nValue2. The rows, which depend on the solver called by PROC OPTMODEL, list the values taken by each of the solver options. The presence of an asterisk (*) next to an option indicates that a value has been specified for that option.

Figure 5.48: SolverOptions ODS Table

SolverOptions

Obs Label1 cValue1 nValue1 cValue2 nValue2
1 ALGORITHM INTERIORPOINT .   .
2 FEASTOL 1E-6 0.000001000   .
3 HESSTYPE FULL .   .
4 LOGFREQ 1 1.000000   .
5 MAXITER 5000 5000.000000   .
6 MAXTIME I I   .
7 OBJLIMIT 1E20 1E20   .
8 OPTTOL 1E-6 0.000001000   .
9 SOLTYPE 1 1.000000   .
10 TIMETYPE REAL .   .



The data set exdm contains the DerivMethods table, which displays the methods of derivative computation, and is shown in Figure 5.49. The variable names are Label1, cValue1, and nValue1. The rows, which depend on the derivatives used by the solver, specify the method used to calculate each derivative.

Figure 5.49: DerivMethods ODS Table

DerivMethods

Obs Label1 cValue1 nValue1
1 Objective Gradient Analytic Formulas .
2 Objective Hessian Analytic Formulas .



The data set exss contains the SolutionSummary table and is shown in Figure 5.50. The variable names are Label1, cValue1, and nValue1. The rows give an overview of the solution, including the solver chosen, the objective value, and the solution status. Depending on the values returned by the solver, the SolutionSummary table might also include some solution quality values such as optimality error and infeasibility. The values in the SolutionSummary table appear in the _OROPTMODEL_ macro variable; each solver chapter has a section that describes the solver’s contribution to this macro variable.

Figure 5.50: SolutionSummary ODS Table

SolutionSummary

Obs Label1 cValue1 nValue1
1 Solver NLP .
2 Algorithm Interior Point .
3 Objective Function z .
4 Solution Status Optimal .
5 Objective Value 22623.347101 22623
6     .
7 Optimality Error 5E-7 0.000000500
8 Infeasibility 0 0
9     .
10 Iterations 5 5.000000
11 Presolve Time 0.00 0.000175
12 Solution Time 0.01 0.006376



The data set exos contains the OptStatistics table, which displays the optimization statistics, and is shown in Figure 5.51. The variable names are Label1, cValue1, and nValue1. The rows, which depend on the solver called by PROC OPTMODEL, describe the amount of time and the function evaluations that are used by the solver and associated processing. Times are displayed in seconds of clock or CPU time according to the value of the TIMETYPE= option that is used by the solver.

Figure 5.51: OptStatistics ODS Table

OptStatistics

Obs Label1 cValue1 nValue1
1 Function Evaluations 28 28.000000
2 Gradient Evaluations 28 28.000000
3 Hessian Evaluations 6 6.000000
4 Problem Generation Time 0.00 0.000398
5 Code Generation Time 0.01 0.007144
6 Presolve Time 0.00 0.000175
7 Solution Time 0.01 0.006376
8 Total Time 0.07 0.074679



Problem generation is the process of combining the model with the data into a format that solvers can use. This includes computing equation coefficients, but it does not include reading data or evaluating other programming statements. Code generation is compiles code for nonlinear equations in the model and performs other analysis that is needed prior to solver evaluations. The time required for problem generation will be negligible if the model contains only linear equations. The presolve time in this table includes the time used by the PROC OPTMODEL presolver and any presolver that is part of the solver. Solution time is the sum of the times used by the presolvers and the solver. The presolve and solution times also appear in the SolutionSummary table. The OptStatistics table includes a total time, which is the sum of times for problem generation, code generation, solution, and overhead in the SOLVE statement. Overhead includes solver setup, postprocessing, and ODS table output.

The Timing table provides an alternate breakdown of SOLVE statement timing. Times in this table are shown in seconds of clock time. The data set exti, which is shown in Figure 5.52, contains the Timing table data and statistics. The variable names are Label1, cValue1, nValue1, cValue2, and nValue2. The values present depend on the solver and on the context of the SOLVE statement.

Figure 5.52: Timing ODS Table

Timing

Obs Label1 cValue1 nValue1 cValue2 nValue2
1 Problem Generation 0.0003975585 0.00 0.0053228127 0.53%
2 OPTMODEL Presolver 0.0001746318 0.00 0.0023381017 0.23%
3 Solver Initialization 0.0603277548 0.06 0.8077133928 80.77%
4 Code Generation 0.0071441545 0.01 0.0956513183 9.57%
5 Solver 0.0062017029 0.01 0.0830330661 8.30%
6 Solver Postprocessing 0.0004437537 0.00 0.0059413085 0.59%



Some of the Timing table values have already been described for the OptStatistics table. Solver initialization time is overhead in the SOLVE statement before the solver starts. Solver time includes execution of the solver and its associated preprocessor, if any. Solver postprocessing time is overhead in the SOLVE statement after the solver has completed. Several table values appear only for a SOLVE statement called within a COFOR loop. These values are shown in Table 5.14.

Table 5.14: Solver Timing Values for COFOR Loops

Label

Description

Waiting for Multiple Threads

Time waiting for the required number of threads to become available on the client machine when NTHREADS > 1

Waiting for Grid

Time waiting for the distributed computing environment to become ready to accept a new problem

Sending to Grid

Time to transmit a solver problem description to the distributed computing environment

Receiving from Grid

Time to receive solver results from the distributed computing environment

Waiting after Solver

Time between solver completion and the resumption of the SOLVE statement for processing the results

Grid Overhead

Time required for processing in the distributed computing environment that is not included in the preceding times