The OPTMODEL Procedure

An Unconstrained Optimization Example

An unconstrained optimization problem formulation is simply

minimize f left-parenthesis x right-parenthesis

For example, suppose you wanted to find the minimum value of this polynomial:

z left-parenthesis x comma y right-parenthesis equals x squared minus x minus 2 y minus x y plus y squared

You can compactly specify and solve the optimization problem by using the OPTMODEL modeling language. Here is the program:

/* invoke procedure */
proc optmodel;
   var x, y;  /* declare variables */

   /* objective function */
   min z=x**2 - x - 2*y - x*y + y**2;

   /* now run the solver */
   solve;

   print x y;
quit;

This program produces the output in Figure 2.

Figure 2: Optimizing a Simple Polynomial

The OPTMODEL Procedure

Problem Summary
Objective SenseMinimization
Objective Functionz
Objective TypeQuadratic
  
Number of Variables2
Bounded Above0
Bounded Below0
Bounded Below and Above0
Free2
Fixed0
  
Number of Constraints0
  
Constraint Coefficients0
  
Hessian Diagonal Elements2
Hessian Elements Below Diagonal1

Solution Summary
SolverQP
AlgorithmInterior Point
Objective Functionz
Solution StatusOptimal
Objective Value-2.333333333
  
Primal Infeasibility0
Dual Infeasibility6.861556E-17
Bound Infeasibility0
Duality Gap0
Complementarity0
  
Iterations0
Presolve Time0.00
Solution Time0.03

xy
1.33331.6667


In PROC OPTMODEL you specify the mathematical formulas that describe the behavior of the optimization problem that you want to solve. In the preceding example there were two independent variables in the polynomial, x and y. These are the optimization variables of the problem. In PROC OPTMODEL you declare optimization variables with the VAR statement. The formula that defines the quantity that you are seeking to optimize is called the objective function, or objective. The solver varies the values of the optimization variables when searching for an optimal value for the objective.

In the preceding example the objective function is named z, declared with the MIN statement. The keyword MIN is an abbreviation for MINIMIZE. The expression that follows the equal sign (=) in the MIN statement defines the function to be minimized in terms of the optimization variables.

The VAR and MIN statements are just two of the many available PROC OPTMODEL declaration and programming statements. PROC OPTMODEL processes all such statements interactively, meaning that each statement is processed as soon as it is complete.

After PROC OPTMODEL has completed processing of declaration and programming statements, it processes the SOLVE statement, which submits the problem to a solver and prints a summary of the results. The PRINT statement displays the optimal values of the optimization variables x and y found by the solver.

It is worth noting that PROC OPTMODEL does not use a RUN statement but instead operates on an interactive basis throughout. You can continue to interact with PROC OPTMODEL even after invoking a solver. For example, you could modify the problem and issue another SOLVE statement (see the section Model Update).

Last updated: June 22, 2026