1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
| % Tableaux : Numéro Prix Note
%Gardiens
G=[1 150 12;
2 250 9;
3 600 18;
4 320 13;
5 141 17
6 100 12;
7 40 4;
8 80 19;
9 90 9;
10 125 11];
% Milieu de terrain
M=[1 15 12;
2 95 19;
3 160 18;
4 32 13;
5 241 17;
6 120 10;
7 50 6;
8 200 18;
9 140 15;
10 50 8];
% Attaquants
A=[1 100 12;
2 125 9;
3 60 18;
4 32 13;
5 541 17
6 100 16;
7 400 19;
8 100 11;
9 250 15
10 100 18];
Prix_max=800;
Equipe=[];
SNR=0;
NbG=10;
NbM=10;
NbA=10;
SER=0;
SERP=0;
Nb_Tirages=2000;
for n=1:Nb_Tirages
g= G(fix(1 + NbG* rand(1)),1);
m1=M(fix(1 + NbM* rand(1)),1);
m2=M(fix(1 + NbM* rand(1)),1);
a1=A(fix(1 + NbA* rand(1)),1);
a2=A(fix(1 + NbA* rand(1)),1);
PE=[G(g,2) M(m1,2) M(m2,2) A(a1,2) A(a2,2)];
NE=[G(g,3) M(m1,3) M(m2,3) A(a1,3) A(a1,3)];
SE=sum(PE);% Prix de l'équipe
SN=sum(NE);% Note de l'équipe
if SN > SNR & SE <= Prix_max % Critère de choix
SNR=SN;% Note retenue
SER=SE;% Prix retenu
SERP=SER;
Equipe=[G(g,1) M(m1,1) M(m2,1) A(a1,1) A(a2,1)];
end
end
if SER==0
disp('Pas de solution')
else
disp(['Equipe : ' num2str(Equipe)])
disp(['Total Notes : ' num2str(SNR)])
disp(['Total Points : ' num2str(SER)])
disp(' ')
end |
Partager