### Example 8.4 Solving Large-Scale NLP Problems

The following example is a selected large-scale problem from the CUTEr test set (Gould, Orban, and Toint, Ph. L. 2003) that has 20,400 variables, 20,400 lower bounds, and 9,996 linear equality constraints. This problem was selected to provide an idea of the size of problem that the NLP solver is capable of solving. In general, the maximum size of nonlinear optimization problems that can be solved with the NLP solver is controlled less by the number of variables and more by the density of the first and second derivatives of the nonlinear objective and constraint functions.

For large-scale problems, the default memory limit might be too small, which can lead to out-of-memory status. To prevent this occurrence, it is recommended that you set a larger memory size. See the section Memory Limit for more information.

```proc optmodel;
num nx = 100;
num ny = 100;

var x {1..nx, 0..ny+1} >= 0;
var y {0..nx+1, 1..ny} >= 0;

min f = (
sum {i in 1..nx-1, j in 1..ny-1} (x[i,j] - 1)^2
+ sum {i in 1..nx-1, j in 1..ny-1} (y[i,j] - 1)^2
+ sum {i in 1..nx-1} (x[i,ny] - 1)^2
+ sum {j in 1..ny-1} (y[nx,j] - 1)^2
) / 2;

con con1 {i in 2..nx-1, j in 2..ny-1}:
(x[i,j] - x[i-1,j]) + (y[i,j] - y[i,j-1]) = 1;
con con2 {i in 2..nx-1}:
x[i,0] + (x[i,1] - x[i-1,1]) + y[i,1] = 1;
con con3 {i in 2..nx-1}:
x[i,ny+1] + (x[i,ny] - x[i-1,ny]) - y[i,ny-1] = 1;
con con4 {j in 2..ny-1}:
y[0,j] + (y[1,j] - y[1,j-1]) + x[1,j] = 1;
con con5 {j in 2..ny-1}:
y[nx+1,j] + (y[nx,j] - y[nx,j-1]) - x[nx-1,j] = 1;

for {i in 1..nx-1} x[i,ny].lb = 1;
for {j in 1..ny-1} y[nx,j].lb = 1;

solve with nlp;
quit;
```

The problem and solution summaries are shown in Output 8.4.1.

Output 8.4.1: Problem Summary and Solution Summary

The OPTMODEL Procedure

Problem Summary
Objective Sense Minimization
Objective Function f

Number of Variables 20400
Bounded Above 0
Bounded Below 20400
Bounded Below and Above 0
Free 0
Fixed 0

Number of Constraints 9996
Linear LE (<=) 0
Linear EQ (=) 9996
Linear GE (>=) 0
Linear Range 0

Performance Information
Execution Mode Single-Machine
Number of Threads 4

Solution Summary
Solver NLP
Algorithm Interior Point
Objective Function f
Solution Status Optimal
Objective Value 6237012.1174

Optimality Error 6.8106459E-7
Infeasibility 6.8106459E-7

Iterations 6
Presolve Time 0.02
Solution Time 46.04