%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% This is an example call of MIDACO 5.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 = 8; % Number of integer variables (0 <= nint <= n)
problem.m = 23; % Number of constraints (in total)
problem.me = 2; % 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.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0];
problem.xu = [ 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 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 = 100000; % 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; % ACCURACY
option.param( 2) = 1; % SEED
option.param( 3) = 68.01; % 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; % 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 )
% Objective function value F(X) (denoted here as 'f')
f = 5.0*x(10) + 8.0*x(11) + 6.0*x(12) + 10.0*x(13)...
+ 6.0*x(14) + 7.0*x(15) + 4.0*x(16) + 5.0*x(17)...
- 10.0*x(1) - 15.0*x(2) + 15.0*x(3) + 80.0*x(4)...
+ 25.0*x(5) + 35.0*x(6) - 40.0*x(7) + 15.0*x(8)...
- 35.0*x(9) + exp(x(1)) + exp(x(2)/1.2)...
- 65.0*log(x(3)+x(4)+1.0)...
- 90.0*log(x(5)+1.0) - 80.0*log(x(6)+1.0)...
+ 120.0;
% Equality constraints G(X) = 0 MUST COME FIRST in 'g(1:me)'
g(1) = 1.0 - x(10) - x(11);
g(2) = -x(13) + x(15) + x(16);
% Inequality constraints G(X) >= 0 MUST COME SECOND in 'g(me+1:m)'
g(3) = 1.5*log(x(5)+1.0) + log(x(6)+1.0) + x(8) ;
g(4) = log(x(3)+x(4)+1.0);
g(5) = x(1) + x(2) - x(3) - 2.0*x(4) - 0.8*x(5) - 0.8*x(6) + 0.5*x(7) + x(8) + 2.0*x(9);
g(6) = x(1) + x(2) - 2.0*x(4) - 0.8*x(5) - 0.8*x(6) + 2.0*x(7) + x(8) + 2.0*x(9);
g(7) = 2.0*x(4) + 0.8*x(5) + 0.8*x(6) - 2.0*x(7) - x(8) - 2.0*x(9);
g(8) = 0.8*x(5) + 0.8*x(6) - x(8);
g(9) = x(4) - x(7) - x(9);
g(10) = 0.4*x(5) + 0.4*x(6) - 1.5*x(8);
g(11) = -0.16*x(5) - 0.16*x(6) + 1.2*x(8);
g(12) = -x(3) + 0.8*x(4);
g(13) = x(3) - 0.4*x(4);
g(14) = 1.0 - exp(x(1)) + 10.0*x(10);
g(15) = 1.0 - exp(x(2)/1.2) + 10.0*x(11);
g(16) = -x(7) + 10.0*x(12);
g(17) = -0.8*x(5) - 0.8*x(6) + 10.0*x(13);
g(18) = -2.0*x(4) + 2.0*x(7) + 2.0*x(9) + 10.0*x(14);
g(19) = -x(5) + 10.0*x(15);
g(20) = -x(6) + 10.0*x(16);
g(21) = -x(3) - x(4) + 10.0*x(17);
g(22) = 1.0 - x(13) - x(14);
g(23) = -x(12) + x(17);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%% END OF FILE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%