## 11Global Optimization

### 11.1  Example of a global optimization problem

The basic structure of a global optimization problem with simple bounds is the following

 min x
f(x)

s/t
 −∞ < xL ≤ x ≤ xU < ∞
(13)
where x, xL, xU Rn, f(x) R. The variables x I, the index subset of 1,...,n, are restricted to be integers.

The following file is required to define a problem of this category in TOMLAB.

File: tomlab/quickguide/glbQG_f.m
```  f:   Function
```
An example of a problem of this class, (that is also found in the TOMLAB quickguide) is glbQG:

File: tomlab/quickguide/glbQG.m
```% glbQG is a small example problem for defining and solving
% unconstrained global programming problems using the TOMLAB format.

Name = 'Shekel 5';
x_L = [ 0  0  0  0]';  % Lower bounds for x.
x_U = [10 10 10 10]';  % Upper bounds for x.
x_0 = [-3.0144 -2.4794 -3.1584 -3.1790]; % May not be used.
x_opt = [];
f_opt = -10.1531996790582;
f_Low=-20;             % Lower bound on function.
x_min = [ 0  0  0  0]; % For plotting
x_max = [10 10 10 10]; % For plotting

Prob = glcAssign('glbQG_f', x_L, x_U, Name, [], [], [], ...
[], [], [], x_0, ...
[], [], [], [], ...
f_Low, x_min, x_max, f_opt, x_opt);

Prob.optParam.MaxFunc = 1500;

Result1 = tomRun('glbFast', Prob, 1);  %Global solver
Result2 = tomRun('conSolve', Prob, 1); %Local solver

% Result = tomRun('glbSolve', Prob, 1);
% Result = tomRun('glcSolve', Prob, 1);
% Result = tomRun('glcFast', Prob, 1);
% Result = tomRun('lgo', Prob, 1);
% Result = tomRun('oqnlp', Prob, 1);```

### 11.2glb_prob

In `glb_prob` there are 51 unconstrained global optimization test problems with sizes to 100 variables. In order to define the problem `n` and solve it execute the following in Matlab:
```  Prob   = probInit('glb_prob',n);
Result = tomRun('',Prob);
```

### 11.3lgo1_prob

In `glo1_prob` there are 30 global optimization test problems in one dimension. In order to define the problem `n` and solve it execute the following in Matlab:
```  Prob   = probInit('lgo1_prob',n);
Result = tomRun('',Prob);
```

### 11.4lgo2_prob

In `glo2_prob` there are 30 global optimization test problems in two up to four dimensions. In order to define the problem `n` and solve it execute the following in Matlab:
```  Prob   = probInit('lgo2_prob',n);
Result = tomRun('',Prob);
```

### 11.5gkls_prob

In `gkls_prob` there are 300 global optimization test problems in two dimensions. In order to define the problem `n` and solve it execute the following in Matlab:
```  Prob   = probInit('gkls_prob',n);
Result = tomRun('',Prob);
```