An unconstrained optimization problem formulation is simply
For example, suppose you wanted to find the minimum value of this polynomial:
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 5.2.
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).