The Nonlinear Programming Solver

Example 8.5 Solving NLP Problems with Several Local Minima

Some NLP problems contain many local minima. By default, the NLP solver converges to a single local minimum. However, the NLP solver can search the feasible region for other local minima. After 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):

\[ \begin{array}{ll} \displaystyle \mathop \textrm{minimize}&  f(x) = (x_1-1)^2 + (x_1-x_2)^2 + (x_2-x_3)^3 + (x_3-x_4)^4 + (x_4-x_5)^4 \\ \textrm{subject\  to}&  x_1 + x_2^2 + x_3^3 = 2+3\sqrt {2} \\ &  x_2+x_4-x_3^2 = -2+2\sqrt {2} \\ &  x_1 x_5 = 2 \\ &  -5 \le x_ i \le 5, i=1,\dots ,5 \end{array}  \]

The following statements call the NLP solver to search the feasible region for different local minima. The PERFORMANCE statement specifies that the multistart algorithm use multiple threads. The SEED= option is specified for reproducibility, but it is not required in running the multistart algorithm.

The PRINT statement prints the initial point that is 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) that is found by the NLP solver in multistart mode.

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;
   
   performance nthreads=4;
   solve with nlp/multistart seed=42 msmaxstarts=10;
   print x.init x.msinit x;
quit;

The SAS log is shown in Output 8.5.1.

Output 8.5.1: Progress of the Algorithm as Shown in the Log

NOTE: Problem generation will use 4 threads.                                    
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: The NLP solver is called.                                                 
NOTE: The Interior Point algorithm is used.                                     
NOTE: The MULTISTART option is enabled.                                         
NOTE: The deterministic parallel mode is enabled.                               
NOTE: The Multistart algorithm is using up to 4 threads.                        
NOTE: Random number seed 42 is used.                                            
                    Best       Local  Optimality    Infeasi-  Local  Local      
      Start    Objective   Objective       Error      bility  Iters  Status     
          1   52.9026035  52.9026035  5.14505E-7  5.14505E-7      7  Optimal    
          2   52.9026035  64.8739911  7.36148E-7  7.36148E-7      8  Optimal    
          3   52.9025196  52.9025196  5.89505E-7  5.89505E-7      8  Optimal    
          4   52.9025196  607.035514  2.99434E-7  1.12976E-8      9  Optimal    
          5 R 52.9025196  52.9026252        5E-7  4.85479E-7     32  Optimal    
          6   27.8719052  27.8719052        5E-9  8.2816E-10      6  Optimal    
          7   27.8719052  27.8719077        5E-7  3.08785E-7      6  Optimal    
          8   0.02931089  0.02931089  8.37861E-7  8.37861E-7      6  Optimal    
          9   0.02931089  0.02931107  6.40157E-7  3.79703E-7     13  Optimal    
NOTE: The Multistart algorithm generated 800 sample points.                     
NOTE: 8 distinct local optima were found.                                       
NOTE: The best objective value found by local solver = 0.0293108946.            


The first column in the log indicates the index of the current starting point. An additional indicator (*, r, or R) can appear after the index to provide more information about the optimization run starting from the current point. See the section Iteration Log for Multistart for more information. The second column records the best objective that has been found so far. Columns 3 to 6 report the objective value, infeasibility, optimality error, and number of iterations of the local solver when it was started from the current 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 current starting point.

The summaries and solution are shown in Output 8.5.2. 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).

Output 8.5.2: Summaries and the Optimal Solution

The OPTMODEL Procedure

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

Performance Information
Execution Mode On Client
Number of Threads 4

Solution Summary
Solver Multistart NLP
Algorithm Interior Point
Objective Function f
Solution Status Optimal
Objective Value 0.0293108388
   
Number of Starts 9
Number of Sample Points 800
Number of Distinct Optima 9
Random Seed Used 42
Optimality Error 5.920214E-7
Infeasibility 1.9827782E-7

[1] x.INIT x.MSINIT x
1 -2 . 1.1166
2 -2 . 1.2204
3 -2 . 1.5378
4 -2 . 1.9728
5 -2 . 1.7911