% Fouzia Moussouni
% Ecole Centarle de Lille
% created December 15th 2005 

clear all
close all
% MAIN PROGRAM

% initial input parametrization
global input0  inputmax  inputmin
%         Ds     Be   delta    Bd  Bcs
% Initial guess input
input0 = [0.189  0.75  3e+6   1.8  0.8 ];
%[0.2012 0.6481 2.0437e+6  1.8  0.8959];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
inputmin=[0.150  0.5   2e+6   0.9  0.6 ]; % Lower bounds
inputmax=[0.330  0.76  5e+6   1.8  1.6 ]; % Upper bounds
param=length(input0);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% launch of the fmincon solver
options = optimset('LargeScale','off','Display','iter','TolFun',1e-100);

% see Matlab help for fmincon
fprintf('\nStart of optimization\n');
tic
[input,FVAL,exitflag,output] = fmincon(@myfunc,...
    input0,[],[],[],[],inputmin,inputmax,@mycon,options);
toc

vect=input;
save('vect.mat','vect');
fprintf('\nEnd of optimization\n');

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% At this point the optimization is finished.
