the last lines i should have these:

X21+X22+X23+X24=55
X11+X12+X13+X14=90

so it should go around j so I wrote it

Barrel(i)..sum(j,X(i,j))=E=90;

But I should have 55 too then it is incorrect how can I write these 55 and 90?

SETS
i   regions   /shomal,jonub/
j   cities   /shiraz,esfahan,hamedan,yazd/
k   Refineries /p1,p2,p3/;

PARAMETERS
         S(k) initial investment /p1 400000,p2 600000,p3 950000/
         H(k) refinary capacity /p1 20,p2 35,p3 50/;
 Table C(i,j)  cost per 1million barrel
                    shiraz  esfahan   hamedan   yazd
      shomal         120        90         75     80
      jonub          45         65         110    95;
VARIABLES
       X(i,j)   quantity in million barrel
       Y(k,j)     1 if pk choosed and 0 if not
         Z       total cost;
POSITIVE VARIABLE X ;
BINARY VARIABLES Y(k,j);
EQUATIONS
       COST        define objective function
       City(j)     capacities in each city
       Barrel(i)                          ;

      COST.. Z=E=sum((i,j,k),C(i,j)*X(i,j)+S(k)*Y(k,j));
      City(j)..sum(i,X(i,j))=L=sum(k,H(k)*Y(k,j));
      Barrel(i)..sum(j,X(i,j))=E=90;
MODEL petrol /ALL/ ;
SOLVE petrol USING MINLP Minimizing Z ;
display X.l,Z.l,s;

asked 27 Jan '12, 02:10

nik's gravatar image

nik
514
accept rate: 0%

retagged 27 Jan '12, 02:50

Marco%20Luebbecke's gravatar image

Marco Luebbecke ♦
3.4k1615


you need to make the right hand side of the equation a parameter dependent on i as well.

is this a homework question?

link

answered 27 Jan '12, 02:24

Marco%20Luebbecke's gravatar image

Marco Luebbecke ♦
3.4k1615
accept rate: 16%

honestly this is my project but I modeled it correctly in paper I should use it in Gams now.sorry I didn't got your mean.and I have another question is it correct to define here a binary? binary will have value 1 or zero? or it is incorrect?

(27 Jan '12, 02:27) nik

if I write it sum((i,j),x(i,j)) then how to assign 55 and 90?

(27 Jan '12, 02:31) nik

I got it I should use another variable which has 2 values 55 and 90

(27 Jan '12, 02:38) nik

yes. actually, you use another parameter not a variable.

(27 Jan '12, 02:49) Marco Luebbecke ♦
1

G(i) region capacity /shomal 90,jonub 55/; yes my program is working Thank You so much Barrel(i)..sum(j,X(i,j))=E=G(i);

(27 Jan '12, 02:55) nik
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×127
×51
×18

Asked: 27 Jan '12, 02:10

Seen: 1,460 times

Last updated: 27 Jan '12, 02:55

OR-Exchange! Your site for questions, answers, and announcements about operations research.