Quickguide MINLP Problem
The mixed-integer nonlinear programming (minlp) problem is defined as
Failed to parse (unknown function "\MATHSET"): {\displaystyle \begin{array}{ll} \min\limits_{x} & f(x) \\ & \\ s/t & \begin{array}{llcccll} -\infty < &x_{L} & \leq & x & \leq & x_{U}& < \infty \\&b_{L} & \leq & A x & \leq & b_{U}& \\&c_{L} & \leq & c(x) & \leq & c_{U},& ~x_{j} \in \MATHSET{N}\ ~~\forall j \in $I$, \\ \end{array} \end{array} }
where Failed to parse (unknown function "\MATHSET"): {\displaystyle x, x_L, x_U \in \MATHSET{R}^n}
, Failed to parse (unknown function "\MATHSET"): {\displaystyle f(x) \in \MATHSET{R}}
, Failed to parse (unknown function "\MATHSET"): {\displaystyle A \in \MATHSET{R}^{m_1 \times n}}
, Failed to parse (unknown function "\MATHSET"): {\displaystyle b_L,b_U \in \MATHSET{R}^{m_1}}
and Failed to parse (unknown function "\MATHSET"): {\displaystyle c_L,c(x),c_U \in \MATHSET{R}^{m_2}}
. The variables ,
the index subset of , are restricted to be integers.
The following files define a problem in TOMLAB.
File: tomlab/quickguide/minlpQG_f.m, minlpQG_g.m, minlpQG_H.m, minlpQG_c.m, minlpQG_dc.m, minlpQG_d2c.m
f: Function value g: Gradient vector H: Hessian matrix c: Nonlinear constraint vector dc: Nonlinear constraint gradient matrix d2c: The second part of the Hessian to the Lagrangian function for the nonlinear constraints.
The following file illustrates how to solve a MINLP problem in TOMLAB. Also view the m-files specified above for more information.
File: tomlab/quickguide/minlpQG.m
Open the file for viewing, and execute minlpQG in Matlab.
% minlpQG is a small example problem for defining and solving
% mixed-integer nonlinear programming problems using the TOMLAB format.
Name='minlp1Demo - Kocis/Grossman.';
IntVars = logical([ 0 0 1 1 1 ]); % Integer variables: x(3)-x(5)
VarWeight = [ ]; % No priorities given
% There are divisions and square roots involving x(2), so we must
% have a small but positive value for the lower bound on x(2).
BIG = 1E8;
x_L = [ 0 1/BIG 0 0 0 ]'; % Lower bounds on x
x_U = [ BIG BIG 1 1 1 ]'; % Upper bounds on x
% Three linear constraints
A = [1 0 1 0 0 ; ...
0 1.333 0 1 0 ; ...
0 0 -1 -1 1 ];
b_L = []; % No lower bounds
b_U = [1.6 ; 3 ; 0]; % Upper bounds
c_L = [1.25;3]; % Two nonlinear constraints
c_U = c_L; % c_L==c_U implies equality
x_0 = ones(5,1); % Initial value
x_opt = [1.12,1.31,0,1,1]'; % One optimum known
f_opt = 7.6672; % Value f(x_opt)
x_min = [-1 -1 0 0 0]; % Used for plotting, lower bounds
x_max = [ 1 1 1 1 1]; % Used for plotting, upper bounds
HessPattern = spalloc(5,5,0); % All elements in Hessian are zero.
ConsPattern = [ 1 0 1 0 0; ... % Sparsity pattern of nonlinear
0 1 0 1 0 ]; % constraint gradient
fIP = []; % An upper bound on the IP value wanted. Makes it possible
xIP = []; % to cut branches. xIP: the x value giving fIP
% Generate the problem structure using the TOMLAB Quick format
Prob = minlpAssign('minlpQG_f', 'minlpQG_g', 'minlpQG_H', HessPattern, ...
x_L, x_U, Name, x_0, ...
IntVars, VarWeight, fIP, xIP, ...
A, b_L, b_U, 'minlpQG_c', 'minlpQG_dc', 'minlpQG_d2c', ...
ConsPattern, c_L, c_U, ...
x_min, x_max, f_opt, x_opt);
Prob.DUNDEE.optPar(20) = 1;
Prob.P = 1; % Needed in minlpQG_xxx files
% Get default TOMLAB solver for your current license, for "minlp" problems
% Solver = GetSolver('minlp');
% Call driver routine tomRun, 3rd argument > 0 implies call to PrintResult
Result = tomRun('minlpBB',Prob,2);