From: Gonzalo on
Hi,
Please find below the code I wrote to run GAMULTIOBJ.....

(When I use single GA it perfectly works )

I am using gamultiobj...using 40 individuals for the Initial Population and 20 Generations as a limit (stop criterion). I am using 2 variables....VECTORIZED...

It run only two generations and then suddenly stops....indicating the following:

TOO MANY INPUT PARAMETERS......(error message)

Please help.

Many thanks.

Gonzalo

---------------------------------------------------------------------
CODE - TO DO INVERSE ANALYSIS MINIMIZING J
so this uses 2 data files to get data from and so
compute J (Objective Function)
---------------------------------------------------------------------

function [J] =mc_ga_1layer_multiobj_2vars(POP)

%Initial Population

Eref=POP(:,1); %Young's Modulus
phi=POP(:,2); % Friction Angle
POP(:,:)
N=length(Eref)


Eref=1000*Eref; %converting MPa to Kpa
Gref=Eref/2.4;
sphi=sin(phi.*pi/180);

% this correspond to the number of the population size
%or the length of POP(:,i)


%defining first lines

L1='C:\Progra~1\Plaxis8x\';
L2='C:\ia\';
L3='exc_1strut_3layers_clay';% PLAXIS file to be called
L4='C:\ia\copies\'; %storing copies for each individual
L5=N; %number of variations for each iteration (=population size)
L6=2; %fix for soil material property changes (E)

% open the file with write permission

fid = fopen('TABLE.DAT', 'w+');
fprintf(fid, '%s\r\n', L1);
fprintf(fid, '%s\r\n', L2);
fprintf(fid, '%s\r\n', L3);
fprintf(fid, '%s\r\n', L4);
fclose(fid);

AO=[];
% G sin(phi)
A=[1 1 1 0 1 1 3 0];

for i=1:N
AO=[AO; A];
end
A=AO;
A(:,4)=Gref;
A(:,8)=sphi;

% depends on results we need from PLAXIS...

B=2;
C=[4 1 1 1 -1;
4 8 1 -1 -1];

% saving file

save('TABLE.DAT','L5','L6','A','B','C','-append','-ASCII');

%calling MIT_GA.exe (created with all Fortran codes..
%...this code reads FE input values & also extract results needed..)

!MIT_GA.exe

%opening, extracting COMPUTED VALUES from RESULT.DAT

fid=fopen('result.dat','r');
comp = fscanf(fid,'%g %g %g ',[3,inf]); % It has 3 columns
comp = comp';
fclose(fid)

%Initializing variables

u_comp=zeros(N,1);
u_field=zeros(N,1);

s_comp=zeros(N,1);
s_field=zeros(N,1);

U=zeros(N,1);
S=zeros(N,1);

J1=zeros(N,1);
J2=zeros(N,1);
J=zeros(N,2);

%copy stored computed values

u_comp(:,1)=1000*comp(:,2); % displacement in mm
s_comp(:,1)=abs(comp(:,3)); % strut loads in kN/m

%defining fitness function & inserting s_field as a vector
%(depending on # of Struts & variations per iteration)

u_field(:,1)=1000*(5.1912911E-03);
s_field(:,1)=abs(-1.1038154E+02);

%computing the residual values as 1-norm

U=abs(u_field-u_comp); % in mm
S=abs(s_field-s_comp); % in kN/m

% specifying OBJECTIVE FUNCTIONS

J1=U; % max displacement in (mm)
J2=S; % strut loads F1 in (KN/m)

J=[J1 J2];

%creating variables...

J_acc=[];
E_acc=[];
phi_acc=[];
u_comp_acc=[];
u_field_acc=[];
s_comp_acc=[];
s_field_acc=[];

% registrying/storing some data

u_comp_acc=[u_comp_acc; u_comp];
u_field_acc=[u_field_acc; u_field];
s_comp_acc=[s_comp_acc; s_comp];
s_field_acc=[s_field_acc; s_field];

J_acc=[J_acc; J];

E_acc=[E_acc; Eref];
n=length(E_acc);
E_field=80*ones(n,1);

phi_acc=[phi_acc; phi];
m=length(phi_acc);
phi_field=26*ones(m,1);

ALL_DATA=[E_acc E_field phi_acc phi_field s_comp_acc s_field_acc u_comp_acc u_field_acc J_acc];

%storing all results + data ....

save('ALL_DATA_MULTI_2vars.txt','ALL_DATA','-append','-ASCII');