Re: Help on simple problem

23 views
Skip to first unread message
Message has been deleted

ptiwari

unread,
Jan 11, 2018, 2:01:32 PM1/11/18
to AMPL Modeling Language
Your problem is very similar to the other problem that we have been discussing in https://groups.google.com/forum/#!topic/ampl/aAx5CHWaUCw . I don't think you need to duplicate data. Could you please review the discussion in that forum and update your model?

Thanks,
Paras

On Wednesday, January 10, 2018 at 2:18:11 PM UTC-8, minio33...@gmail.com wrote:
Hi,

I have a test on AMPL in a couple of days but we've been given a strong hint that it'll be a very similar question to this one:

The production unit of Pharmaceuticals manufactures 3 products:

Profit per unit of each product is as follows:

1.    X1                   £1.75
2.    X2                   £2.49
3.    X3                   £1.99

Two out of four possible inspection systems must be implemented on each product.

The number of work hours required per unit of each product for each of the systems is given in the table below:

Inspection System                          X1                          X2                           X3

               1                                        0.50                       0.60                       0.75
               2                                        0.81                       0.50                       0.45
               3                                        0.38                       0.68                       0.77
               4                                        0.59                       0.82                       0.53

3500 work-hours capacity for each inspection system.

Maximise Profit.

and so I have began to make a data and a script file but I am struggling with making it so that only two inspection systems are applied, I tried to make a third set for the second inspection but feel I might be going round in circles.

If there is any advice you can give me, it would be greatly appreciated!


My MODfile so far:

set product;
set inspect1;
set inspect2;

param profit{product};

param inspect1_hours{product,inspect1};
param inspect2_hours{product,inspect2};

param inspect_cap{inspect1, inspect2};

param inspect_allowed{inspect1, inspect2};

var produce{p in product}integer >=0 ;
var inspect_A{inspect1}=1;
var inspect_B{inspect2}=1;
var ifinspect{i in inspect1, j in inspect2} binary >=2,<=2;

maximize 
prft:sum{p in product} profit[p]*produce[p];

subject to
xo: sum{i in inspect 1} inspect_A[i]<> sum{j in inspect 2} inspect_B[j]
x1: sum{p in product, i in inspect1} produce[p]*inspect1_hours[p,i]+sum{p in product, j in inspect2} produce[p]*inspect2_hours[p,j]<=sum{i in inspect1, j in inspect2} inspect_cap[i,j]

My DATAfile so far:

set inspect1:=1 2 3 4;
#Inspection systems 1st inspection
set inspect2:=1 2 3 4;
#Inspection systems 2nd inspection

param profit:= polymacrin 1.75 nanomacrin 2.49 balomacrin 1.99;
#Profit per product

param inspect1_hours (tr): polymacrin nanomacrin balomacrin:=
1 0.50 0.60 0.75
2 0.81 0.50 0.45
3 0.38 0.68 0.77
4 0.59 0.82 0.53; 
#Labour needed for 1st inspection per product
param inspect2_hours (tr): polymacrin nanomacrin balomacrin:=
1 0.50 0.60 0.75
2 0.81 0.50 0.45
3 0.38 0.68 0.77
4 0.59 0.82 0.53; 
#Labour needed for 2nd inspection per product

param inspect_cap: 1 2 3 4=
1 3500 3500 3500 3500
2 3500 3500 3500 3500
3 3500 3500 3500 3500
4 3500 3500 3500 3500;
#Monthly Capacity1
#Monthly Capacity2

param inspect_allowed: 1 2 3 4:=
1 0 1 1 1
2 1 0 1 1
3 1 1 0 1
4 1 1 1 0;

Reply all
Reply to author
Forward
0 new messages