Está en la página 1de 4

Ejemplo2B_guia2.

mod

#Conjuntos
set Productos := 1..20;
set Procesos := 1..7;
set ProcesoMP := 1..5;
set Matriz1 := {Productos,Procesos};
set Matriz2 := {Productos,ProcesoMP};

#Parametros
param Margen {Productos};
param Demandamin {Productos};
param Demandamax {Productos};
param RecursoT {ProcesoT};
param RecursoMP {ProcesoMP};
param Tiempo {Matriz1};
param MateriaPrima {Matriz2};

#Variables del modelo


var P {Productos};

#Funcion Objetivo
maximize Utilidades: sum {i in Productos} Margen[i] * P[i];

#Restricciones

#Restricciones de demanda
subject to Minimo {i in Productos}: P[i] >= Demandamin[i];
subject to Maximo {i in Productos}: P[i] <= Demandamax[i];

#Restricciones de tiempo
subject to Tp {j in Procesos}: sum {i in Productos} Tiempo[i,j] * P[i] <=
RecursoT[j];

#Restriciones de materia prima


subject to Materia {j in ProcesoMP}: sum {i in Productos} MateriaPrima[i,j] *
P[i] <= RecursoMP[j];

Comandos
ampl: reset;
ampl: model Ejemplo2B_guia2.mod;
ampl: data Ejemplo2B_guia2.dat;
ampl: solve;
MINOS 5.51: optimal solution found.
20 iterations, objective 50289.23077

ampl: display P;
P [*] :=
1 150
2 80
3 90
4 100
5 180
6 150
7 122.906
8 145
9 100
10 110
11 150
12 160
13 165
14 155
15 150
16 250
17 150
18 200
19 250
20 180
;

Ejemplo2B_guia2.dat
param Margen:=
1 11.00
2 15.75
3 10.50
4 10.75
5 14.50
6 17.25
7 13.50
8 12.00
9 16.00
10 17.00
11 20.00
12 22.00
13 18.50
14 17.00
15 15.50
16 19.00
17 21.50
18 21.50
19 15.50
20 14.50;

param Demandamin:=
1 10.00
2 15.00
3 0.00
4 0.00
5 10.00
6 0.00
7 10.00
8 0.00
9 20.00
10 25.00
11 15.00
12 10.00
13 0.00
14 0.00
15 0.00
16 10.00
17 0.00
18 0.00
19 0.00
20 0.00;

param Demandamax:=
1 150
2 80
3 90
4 100
5 180
6 150
7 150
8 145
9 100
10 110
11 150
12 160
13 165
14 155
15 150
16 250
17 150
18 200
19 250
20 180;

param RecursoT:=
1 900
2 250
3 600
4 380
5 270
6 450
7 300;

param RecursoMP:=
1 1200
2 650
3 600
4 350
5 400;

param Tiempo:
1 2 3 4 5 6 7 :=
1 0.167 0.083 0.100 0.067 0.050 0.100 0.083
2 0.200 0.067 0.067 0.083 0.033 0.117 0.100
3 0.417 0.133 0.167 0.067 0.067 0.117 0.050
4 0.200 0.150 0.183 0.100 0.067 0.133 0.067
5 0.250 0.033 0.200 0.100 0.067 0.133 0.117
6 0.283 0.033 0.217 0.117 0.083 0.150 0.133
7 0.317 0.050 0.133 0.133 0.117 0.150 0.117
8 0.500 0.067 0.183 0.150 0.100 0.133 0.100
9 0.333 0.083 0.233 0.167 0.133 0.167 0.083
10 0.350 0.100 0.250 0.183 0.150 0.183 0.100
11 0.333 0.083 0.167 0.117 0.083 0.167 0.117
12 0.367 0.133 0.217 0.150 0.117 0.183 0.117
13 0.333 0.167 0.250 0.100 0.067 0.083 0.133
14 0.250 0.183 0.233 0.167 0.133 0.100 0.117
15 0.300 0.083 0.217 0.067 0.033 0.133 0.067
16 0.283 0.050 0.200 0.083 0.050 0.150 0.050
17 0.250 0.067 0.200 0.067 0.050 0.133 0.033
18 0.267 0.033 0.183 0.100 0.067 0.150 0.150
19 0.233 0.050 0.167 0.117 0.083 0.167 0.133
20 0.200 0.033 0.150 0.133 0.100 0.150 0.067;
param MateriaPrima:
1 2 3 4 5 :=
1 0.400 0.200 0.200 0.100 0.100
2 0.300 0.200 0.100 0.200 0.200
3 0.400 0.300 0.100 0.100 0.100
4 0.300 0.300 0.200 0.100 0.100
5 0.400 0.300 0.100 0.100 0.100
6 0.500 0.150 0.000 0.150 0.200
7 0.400 0.300 0.000 0.100 0.200
8 0.500 0.300 0.200 0.000 0.000
9 0.300 0.300 0.300 0.100 0.000
10 0.400 0.200 0.200 0.100 0.100
11 0.350 0.150 0.250 0.150 0.100
12 0.450 0.050 0.200 0.150 0.150
13 0.500 0.200 0.200 0.050 0.050
14 0.250 0.250 0.300 0.000 0.200
15 0.350 0.150 0.300 0.100 0.100
16 0.450 0.050 0.100 0.200 0.200
17 0.400 0.200 0.250 0.100 0.050
18 0.300 0.250 0.250 0.100 0.100
19 0.350 0.250 0.200 0.100 0.100
20 0.300 0.200 0.200 0.150 0.150;

También podría gustarte