%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% This is an example call of MIDACO 6.0
% -------------------------------------
%
% MIDACO solves Multi-Objective Mixed-Integer Non-Linear Problems:
%
%
% Minimize F_1(X),... F_O(X) where X(1,...N-NI) is CONTINUOUS
% and X(N-NI+1,...N) is DISCRETE
%
% subject to G_j(X) = 0 (j=1,...ME) equality constraints
% G_j(X) >= 0 (j=ME+1,...M) inequality constraints
%
% and bounds XL <= X <= XU
%
%
% The problem statement of this example is given below. You can use
% this example as template to run your own problem. To do so: Replace
% the objective functions 'F' (and in case the constraints 'G') given
% here with your own problem and follow the below instruction steps.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function example
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%% MAIN PROGRAM %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
key = '************************************************************';
problem.func = @problem_function; % Call is [f,g] = problem_function(x)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Step 1: Problem definition %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% STEP 1.A: Problem dimensions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
problem.o = 1; % Number of objectives
problem.n = 17; % Number of variables (in total)
problem.ni = 12; % Number of integer variables (0 <= ni <= n)
problem.m = 8; % Number of constraints (in total)
problem.me = 5; % Number of equality constraints (0 <= me <= m)
% STEP 1.B: Lower and upper bounds 'xl' & 'xu'
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% bounds for continuous variables % integer bounds
problem.xl = [ 0.414, 0.207, 0.001785714, 1.1, 0.1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
problem.xu = [ 10.0, 10.0, 0.02, 10.0, 9.5, 10, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
% STEP 1.C: Starting point 'x'
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
problem.x = problem.xl; % Here for example: 'x' = lower bounds 'xl'
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Step 2: Choose stopping criteria and printing options %%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% STEP 2.A: Stopping criteria
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
option.maxeval = 999999999; % Maximum number of function evaluation (e.g. 1000000)
option.maxtime = 60*60*24; % Maximum time limit in Seconds (e.g. 1 Day = 60*60*24)
% STEP 2.B: Printing options
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
option.printeval = 10000; % Print-Frequency for current best solution (e.g. 1000)
option.save2file = 1; % Save SCREEN and SOLUTION to TXT-files [ 0=NO/ 1=YES]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Step 3: Choose MIDACO parameters (FOR ADVANCED USERS) %%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
option.param( 1) = 0.0005; % ACCURACY
option.param( 2) = 1; % SEED
option.param( 3) = 0.85; % FSTOP
option.param( 4) = 0; % ALGOSTOP
option.param( 5) = 0; % EVALSTOP
option.param( 6) = 0; % FOCUS
option.param( 7) = 0; % ANTS
option.param( 8) = 0; % KERNEL
option.param( 9) = 0; % ORACLE
option.param(10) = 0; % PARETOMAX
option.param(11) = 0; % EPSILON
option.param(12) = 0; % BALANCE
option.param(13) = 0; % CHARACTER
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Step 4: Choose Parallelization Factor %%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
option.parallel = 0; % Serial: 0 or 1, Parallel: 2,3,4,5,6,7,8...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Call MIDACO solver %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[ solution ] = midaco( problem, option, key);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% End of Example %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%% OPTIMIZATION PROBLEM %%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [ f, g ] = problem_function( x )
% Rename integer variables
y = x(6:17);
x1 = x(1);
x2 = x(2);
x3 = x(3);
i4 = y(1);
x5 = x(4);
x6 = x(5);
b7 = y(2);
b8 = y(3);
b9 = y(4);
b10 = y(5);
b11 = y(6);
b12 = y(7);
b13 = y(8);
b14 = y(9);
b15 = y(10);
b16 = y(11);
b17 = y(12);
% Objective function value F(X) (denoted here as 'f')
f = (1.570796327 + 0.7853981635*i4)*x1*x2^2;
% Equality constraints g(X) = 0 MUST COME FIRST in 'g(1:me)'
g(1) = - x1/x2 + x5;
g(2) = - ((4*x5 - 1)/(4*x5 - 4) + 0.615/x5) + x6;
g(3) = (-6.95652173913044e-7*i4*x5^3/x2 + x3);
g(4) = x2 - 0.207*b7 - 0.225*b8 - 0.244*b9 - 0.263*b10 - 0.283*b11 - ...
0.307*b12 - 0.331*b13 - 0.362*b14 - 0.394*b15 - 0.4375*b16 - 0.5*b17;
g(5) = b7 + b8 + b9 + b10 + b11 + b12 + b13 + b14 + b15 + b16 + b17 - 1;
% Inequality constraints g(X) >= 0 MUST COME SECOND in 'g(me+1:m)'
g(6) = (-2546.47908913782*x6*x5/x2^2 + 189000);
g(7) = -(2.1 + 1.05*i4)*x2 - 1000*x3 + 14;
g(8) = -x1 - x2 + 3;
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%% END OF FILE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%