Some NLP problems contain many local minima. By default, the NLP solver converges to a single local minimum. However, the NLP solver is able to search the feasible region and try to locate other local minima. Once it completes the search it returns the point where the objective function achieves its minimum value. (This point might not be a local minimum; see the SOLTYPE= option for more details.) Consider the following example, taken from Hock and Schittkowski (1981):
In order to call the NLP solver to search the feasible region and locate different local minima, you can write the following SAS statements:
proc optmodel; var x{i in 1..5} >= -5 <= 5 init -2; min f=(x[1] - 1)^2 + (x[1] - x[2])^2 + (x[2] - x[3])^3 + (x[3] - x[4])^4 + (x[4] - x[5])^4; con g1: x[1] + x[2]^2 + x[3]^3 = 2 + 3*sqrt(2); con g2: x[2] + x[4] - x[3]^2 = -2 + 2*sqrt(2); con g3: x[1]*x[5] = 2; solve with nlp/ms msnumstarts=10; print x; quit;
Note that the MS option is specified after the call to the NLP solver, together with the MSNUMSTARTS= option. The MS option informs the solver that you want multiple runs of the solver from different starting points. Setting the MSNUMSTARTS= option to 10 directs the solver to start from 10 different starting points. The actual starting points are determined internally by the solver.
The SAS log is shown in Output 7.5.1.
NOTE: The problem has 5 variables (0 free, 0 fixed). |
NOTE: The problem has 0 linear constraints (0 LE, 0 EQ, 0 GE, 0 range). |
NOTE: The problem has 3 nonlinear constraints (0 LE, 3 EQ, 0 GE, 0 range). |
NOTE: The OPTMODEL presolver removed 0 variables, 0 linear constraints, and 0 |
nonlinear constraints. |
NOTE: Using analytic derivatives for objective. |
NOTE: Using analytic derivatives for nonlinear constraints. |
NOTE: Using 2 threads for nonlinear evaluation. |
NOTE: The NLP solver is called. |
NOTE: The Interior Point algorithm is used. |
NOTE: The experimental MULTISTART option is enabled. |
Best Local Optimality Local |
Start Objective Objective Infeasibility Error Status |
1 607.04 607.04 6.2288e-08 6.2288e-08 OPT |
2 0.029311 0.029311 8.6661e-08 2.0052e-07 OPT |
3 0.029311 0.029311 2.4244e-07 1.6182e-06 BESTFEAS |
4 0.029311 0.029311 5.8129e-07 5.8129e-07 OPT |
5 0.029311 607.04 1.3273e-07 1.4442e-07 OPT |
6 0.029311 0.029311 6.1521e-07 6.1521e-07 OPT |
7 0.029311 27.872 7.9897e-09 7.9897e-09 OPT |
8 0.029311 0.029311 6.2448e-07 6.2448e-07 OPT |
9 0.029311 52.903 9.6734e-09 9.6734e-09 OPT |
10 0.029311 0.029311 8.2201e-07 1.6582e-06 BESTFEAS |
NOTE: Multistart used 10 starting points. |
NOTE: Best feasible objective = 0.0293106515. |
NOTE: Best feasible solution is found at starting point 10. |
The first column in the log counts the number of starting points, and the second column records the best objective that has been found so far. Columns 3 to 5 record the final objective, infeasibility error, and optimality error of the local solver when started from the corresponding starting point. Finally the last column records the status of the local solver, namely whether it was able to converge to a local optimum from the corresponding starting point.
The summaries and solution are shown in Output 7.5.2.
Problem Summary | |
---|---|
Objective Sense | Minimization |
Objective Function | f |
Objective Type | Nonlinear |
Number of Variables | 5 |
Bounded Above | 0 |
Bounded Below | 0 |
Bounded Below and Above | 5 |
Free | 0 |
Fixed | 0 |
Number of Constraints | 3 |
Linear LE (<=) | 0 |
Linear EQ (=) | 0 |
Linear GE (>=) | 0 |
Linear Range | 0 |
Nonlinear LE (<=) | 0 |
Nonlinear EQ (=) | 3 |
Nonlinear GE (>=) | 0 |
Nonlinear Range | 0 |
Solution Summary | |
---|---|
Solver | NLP/INTERIORPOINT |
Objective Function | f |
Solution Status | Best Feasible |
Objective Value | 0.0293106515 |
Iterations | 10 |
Optimality Error | 1.6581602E-6 |
Infeasibility | 8.2200611E-7 |
[1] | x |
---|---|
1 | 1.1167 |
2 | 1.2206 |
3 | 1.5377 |
4 | 1.9724 |
5 | 1.7910 |
Multistart also provides the option to see details of the local solver progress. This is achieved by specifying a value of 3 for the MSPRINTLEVEL= option. To see this, you can solve the previous example again by writing the following SAS statements:
proc optmodel; var x{i in 1..5} >= -5 <= 5 init -2; min f = (x[1] - 1)^2 + (x[1] - x[2])^2 + (x[2] - x[3])^3 + (x[3] - x[4])^4 + (x[4] - x[5])^4; con g1: x[1] + x[2]^2 + x[3]^3 = 2 + 3*sqrt(2); con g2: x[2] + x[4] - x[3]^2 = -2 + 2*sqrt(2); con g3: x[1]*x[5] = 2; solve with nlp/ms msnumstarts=3 msprintlevel=3 printfreq=50; print x.init x.msinit x; quit;
These statements specify that you want to restart the local solver from three different points (MSNUMSTARTS=3), and you want to see the progress of the local solver from each starting point (MSPRINTLEVEL=3). You also want to set the frequency by which the local iterations are printed to 50 (PRINTFREQ=50). You have also decided to print the initial point specified in the VAR declaration (x.init), the starting point that led to the best local solution (x.msinit), and finally the best local solution (x) found by the NLP solver in multistart mode.
The SAS log is shown in Output 7.5.3.
NOTE: The problem has 5 variables (0 free, 0 fixed). |
NOTE: The problem has 0 linear constraints (0 LE, 0 EQ, 0 GE, 0 range). |
NOTE: The problem has 3 nonlinear constraints (2 LE, 1 EQ, 0 GE, 0 range). |
NOTE: The OPTMODEL presolver removed 0 variables, 0 linear constraints, and 0 |
nonlinear constraints. |
NOTE: Using analytic derivatives for objective. |
NOTE: Using analytic derivatives for nonlinear constraints. |
NOTE: Using 2 threads for nonlinear evaluation. |
NOTE: The NLP solver is called. |
NOTE: The Interior Point algorithm is used. |
NOTE: The experimental MULTISTART option is enabled. |
NOTE: The solver is called with starting point 1. |
Objective Optimality |
Iter Value Infeasibility Error |
0 9.00000000 2.00000000 2.00000000 |
5 3.46561301 0.0000000634862 0.0000005000000 |
NOTE: Optimal. |
NOTE: Objective = 3.46561301. |
NOTE: Objective of the best feasible solution found = 3.46561297. |
NOTE: The best feasible solution found is returned. |
NOTE: Best objective = 3.46561297. |
NOTE: Best objective found at starting point 1. |
NOTE: The solver is called with starting point 2. |
Objective Optimality |
Iter Value Infeasibility Error |
0 2191.15299165 15.28205927 70.68558477 |
46 -23.49811117 0.0000000277561 0.0000000973999 |
NOTE: Optimal. |
NOTE: Objective = -23.4981112. |
NOTE: Best objective = -23.4981112. |
NOTE: Best objective found at starting point 2. |
NOTE: The solver is called with starting point 3. |
Objective Optimality |
Iter Value Infeasibility Error |
0 571.09813674 22.34005000 78.63555365 |
50 0.96116145 0.00001038 0.23925270 |
100 -2.11574026 0.00000742 0.19974432 |
150 -23.00552324 0.00000426 0.16408021 |
176 -23.49810800 0.0000002151881 0.0000002151881 |
NOTE: Optimal. |
NOTE: Objective = -23.498108. |
NOTE: Objective of the best feasible solution found = -23.4981159. |
NOTE: The best feasible solution found is returned. |
NOTE: Best objective = -23.4981159. |
NOTE: Best objective found at starting point 3. |
NOTE: Multistart used 3 starting points. |
NOTE: Best feasible objective = -23.4981159. |
NOTE: Best feasible solution is found at starting point 3. |
The summaries and solution are shown in Output 7.5.4. Note that the best solution was found by starting the local solver from a starting point (x.msinit) that is different from the point specified in the VAR declaration (x.init).
Problem Summary | |
---|---|
Objective Sense | Minimization |
Objective Function | f |
Objective Type | Nonlinear |
Number of Variables | 5 |
Bounded Above | 0 |
Bounded Below | 0 |
Bounded Below and Above | 5 |
Free | 0 |
Fixed | 0 |
Number of Constraints | 3 |
Linear LE (<=) | 0 |
Linear EQ (=) | 0 |
Linear GE (>=) | 0 |
Linear Range | 0 |
Nonlinear LE (<=) | 0 |
Nonlinear EQ (=) | 3 |
Nonlinear GE (>=) | 0 |
Nonlinear Range | 0 |
Solution Summary | |
---|---|
Solver | NLP/INTERIORPOINT |
Objective Function | f |
Solution Status | Best Feasible |
Objective Value | 0.0293107657 |
Iterations | 3 |
Optimality Error | 1.6182019E-6 |
Infeasibility | 2.4244275E-7 |
[1] | x.INIT | x.MSINIT | x |
---|---|---|---|
1 | -2 | 4.69277 | 1.1166 |
2 | -2 | 0.42979 | 1.2204 |
3 | -2 | 0.31692 | 1.5378 |
4 | -2 | -4.50206 | 1.9728 |
5 | -2 | -4.33433 | 1.7911 |