Académique Documents
Professionnel Documents
Culture Documents
Programming
Abdelmoutalib Metrane
ENSA
Khouribga Maroc
Introduction
1 Impossible de couper/coller
2 Impossible de déler les output
Solution
Édition de chiers
Le chier .mod
−x1 + 2x2 ≤ 12
3x1 + 5x2 ≤ 52
x1 + x2 ≤ 14
x1 ≤ 12
x1 , x2 ≥ 0.
Fichier Exemple1.mod
*******************************
var X1 >= 0 ;
var X2 >= 0 ;
maximize Prot: 4 * X1 + 5 * X2;
subject to cont1: -X1 + 2 * X2 <=12;
subject to cont2: 3*X1 + 5* X2 <= 52;
subject to cont3: X1 + X2 <=14;
subject to cont4: X1 <= 12;
*******************************
*******************************
sw: ampl
ampl: model Exemple1.mod;
ampl: solve;
MINOS 5.5: optimal solution found.
3 iterations, objective 61
ampl: display X1, X2;
X1 = 9
X2 = 5
*******************************
*******************************
sw: ampl
ampl: model Res-graph1.mod;
ampl: option solver gurobi;
ampl: solve;
Gurobi 8.1.0: optimal solution; objective 61
2 dual simplex iterations (1 in phase I)
ampl: display X1, X2;
X1 = 9
X2 = 5
*******************************
*******************************
sw: ampl entrer à AMPL
ampl: model nom-de-chier.mod; ouvrir un chier modèl
ampl: option solver nom-de-solveur; choisir le solveur
ampl: solve; résoudre
ampl: display nom-de-variable ; sortir les résultats
*******************************
*******************************
sw: ampl
ampl: include Usine-auto2.run;
*******************************
Fichier Usine-auto1.mod
*******************************
var X1 >=0 ;
var X2 >=0;
maximize Prot: 22410 * X1 + 33230 * X2;
subject to Atelier1: 3.5 * X1 + 4 * X2 <=1500;
subject to Ateleir2: 2 * X1 + 3 * X2 <=1500;
subject to MINeconomique: 120 <= X1;
*******************************
*******************************
sw: ampl
ampl: model 'C:\ Users\ DELL \ Desktop\ Bureau2017\
AMPL2017\ transp.mod';
ampl:data 'C:\ Users\ DELL\Desktop\ Bureau 2017\
AMPL2017\ transp.dat';
ampl: solve;
MINOS 5.5: optimal solution found.
13 iterations, objective 196200
ampl: display Trans;
Trans [*,*] (tr)