Hi every body

I want to enter a model in GAMS and i need it for my thesis so I should solve it as soon as possible.

please check the pdf file I attached . I described my problem in it.

–

gams model.pdf (111 KB)

Hi every body

I want to enter a model in GAMS and i need it for my thesis so I should solve it as soon as possible.

please check the pdf file I attached . I described my problem in it.

–

gams model.pdf (111 KB)

hi Ms etemadi …

it is simple you must use ord(i) & ord (j) …

for example in your goal function summation … write : sum((i,j)$ (ord(j)>ord(i)) , c(i,j)*w(i,j)-z)

and in all of your orders you must use ord of your index …

good luck …

On Mon, Aug 17, 2015 at 2:47 PM, Maryam Etemadi wrote:

Hi every body

I want to enter a model in GAMS and i need it for my thesis so I should solve it as soon as possible.

please check the pdf file I attached . I described my problem in it.

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.

To post to this group, send email to gamsworld@googlegroups.com.

Visit this group at http://groups.google.com/group/gamsworld.

For more options, visit https://groups.google.com/d/optout.

\

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.

To post to this group, send email to gamsworld@googlegroups.com.

Visit this group at http://groups.google.com/group/gamsworld.

For more options, visit https://groups.google.com/d/optout.

Hi

You must define the objective function so that Amin said, and the constraints as follows.

Con1(I,J)$(Ord(J)>Ord(I)) … W(i,j)=L=Y(I);

Con2(I,J)$(Ord(J)>Ord(I)) … W(i,j)=L=Y(J);

Con(I,J)$(Ord(J)>Ord(I)) … W(i,j)=L=Y(I) + Y(J) - 1;

On Mon, Aug 17, 2015 at 2:47 PM, Maryam Etemadi wrote:

Hi every body

please check the pdf file I attached . I described my problem in it.

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.

To post to this group, send email to gamsworld@googlegroups.com.

Visit this group at http://groups.google.com/group/gamsworld.

For more options, visit https://groups.google.com/d/optout.

\

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.

To post to this group, send email to gamsworld@googlegroups.com.

Visit this group at http://groups.google.com/group/gamsworld.

For more options, visit https://groups.google.com/d/optout.

$onsymxref

$onsymlist

$title Maryam Etemadi

sets

i row / 1*5/
j column /1*6/

k read /1*6/

;

Table c(i,j) distance between reads

1 2 3 4 5 6

1 0 5 6 3 3 4

2 0 0 5 4 3 3

3 0 0 0 4 5 6

4 0 0 0 0 6 6

5 0 0 0 0 0 5

;

Variables

w(i,j)

yi(i)

yj(j)

yk(k)

z

ObjectiveFunction

;

Binary Variables w,yi,yj,yk;

Positive Variable z;

w.lo(i,j)=0;

yi.lo(i)=0;

yj.lo(j)=0;

yk.lo(k)=0;

Equations

obj

c1_1(j)

c1_2(j)

c1_3(j)

c1_4(j)

c1_5(j)

c2_2(i)

c2_3(i)

c2_4(i)

c2_5(i)

c2_6(i)

c3_1(j)

c3_2(j)

c3_3(j)

c3_4(j)

c3_5(j)

c4

c5

;

obj … ObjectiveFunction =e= sum((i,j)$(ord(j) ge (ord(i)+1)),c(i,j)*w(i,j))-z ;

c1_1(j)(ord(j) gt 1).. (w('1',j)-yi('1')) =l= 0 ;
c1_2(j)(ord(j) gt 2)… (w(‘2’,j)-yi(‘2’)) =l= 0 ;

c1_3(j)(ord(j) gt 3).. (w('3',j)-yi('3')) =l= 0 ;
c1_4(j)(ord(j) gt 4)… (w(‘4’,j)-yi(‘4’)) =l= 0 ;

c1_5(j)$(ord(j) gt 5)… (w(‘5’,j)-yi(‘5’)) =l= 0 ;

c2_2(i)(ord(i) lt 2).. (w(i,'2')-yj('2')) =l= 0 ;
c2_3(i)(ord(i) lt 3)… (w(i,‘3’)-yj(‘3’)) =l= 0 ;

c2_4(i)(ord(i) lt 4).. (w(i,'4')-yj('4')) =l= 0 ;
c2_5(i)(ord(i) lt 5)… (w(i,‘5’)-yj(‘5’)) =l= 0 ;

c2_6(i)$(ord(i) lt 6)… (w(i,‘6’)-yj(‘6’)) =l= 0 ;

c3_1(j)(ord(j) gt 1).. (-w('1',j)+yi('1')+yj(j)) =l= 1 ;
c3_2(j)(ord(j) gt 2)… (-w(‘2’,j)+yi(‘2’)+yj(j)) =l= 1 ;

c3_3(j)(ord(j) gt 3).. (-w('3',j)+yi('3')+yj(j)) =l= 1 ;
c3_4(j)(ord(j) gt 4)… (-w(‘4’,j)+yi(‘4’)+yj(j)) =l= 1 ;

c3_5(j)$(ord(j) gt 5)… (-w(‘5’,j)+yi(‘5’)+yj(j)) =l= 1 ;

ontext
** or these equations. the answers are the same.
c1_1(j).. (w('1',j)(ord(j) gt 1)-yi(‘1’)) =l= 0 ;

c1_2(j)… (w(‘2’,j)(ord(j) gt 2)-yi('2')) =l= 0 ;
c1_3(j).. (w('3',j)(ord(j) gt 3)-yi(‘3’)) =l= 0 ;

c1_4(j)… (w(‘4’,j)(ord(j) gt 4)-yi('4')) =l= 0 ;
c1_5(j).. (w('5',j)(ord(j) gt 5)-yi(‘5’)) =l= 0 ;

c2_2(i)… (w(i,‘2’)(ord(i) lt 2)-yj('2')) =l= 0 ;
c2_3(i).. (w(i,'3')(ord(i) lt 3)-yj(‘3’)) =l= 0 ;

c2_4(i)… (w(i,‘4’)(ord(i) lt 4)-yj('4')) =l= 0 ;
c2_5(i).. (w(i,'5')(ord(i) lt 5)-yj(‘5’)) =l= 0 ;

c2_6(i)… (w(i,‘6’)$(ord(i) lt 6)-yj(‘6’)) =l= 0 ;

c3_1(j)… (-w(‘1’,j)(ord(j) gt 1)+yi('1')+yj(j)(ord(j) gt 1)) =l= 1 ;

c3_2(j)… (-w(‘2’,j)(ord(j) gt 2)+yi('2')+yj(j)(ord(j) gt 2)) =l= 1 ;

c3_3(j)… (-w(‘3’,j)(ord(j) gt 3)+yi('3')+yj(j)(ord(j) gt 3)) =l= 1 ;

c3_4(j)… (-w(‘4’,j)(ord(j) gt 4)+yi('4')+yj(j)(ord(j) gt 4)) =l= 1 ;

c3_5(j)… (-w(‘5’,j)(ord(j) gt 5)+yi('5')+yj(j)(ord(j) gt 5)) =l= 1 ;

$offtext

c5… sum(k,yk(k))- sum(k,1-yk(k))+z =e= 0;

Model cluster /all/;

Option MIP = Cplex;

Solve cluster using MIP maximizing ObjectiveFunction;

Display w.l,yi.l,yj.l,yk.l,z.l,ObjectiveFunction.l;

\

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.

To post to this group, send email to gamsworld@googlegroups.com.

Visit this group at http://groups.google.com/group/gamsworld.

For more options, visit https://groups.google.com/d/optout.

Hi Maryam

Just do as you wrote in your pdf file:

Equations

obj

c1(i, j, k)

c2(i, j, k)

c3(i, j, k)

c4(j)

c5

c6

;

obj … ObjectiveFunction =e= sum((i,j,k),c(i,j)*w(i,j,k))-z ;

c1(i,j, k)… w(i, j,k) - yi(i, k) =l= 0;

c2(i, j, k)… w(i, j, k) - yj(j, k) =l= 0;

c3(i, j, k)… (-w(i, j, k)+yi(i, k)+yj(j,k)) =l= 1 ;

c4(j)… sum(k, yj(j,k)) =l= 1;

c5… sum(j, yj(j,‘1’)) - sum(j,yj(j,‘2’)) - z =e= 0;

c6… sum(j,yj(j,‘1’))- sum(j,yj(j,‘2’))+z =e= 0;

Hope this helps

Cheers

Renger

From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of Maryam Etemadi

Sent: Dienstag, 1. September 2015 20:59

To: gamsworld

Subject: urgent help please

Hello every one

I want to write a model in GAMS. I need it for my thesis. I would be grateful if some one help me. I attached the model in a pdf file.

Thanks a lot

–

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.

To post to this group, send email to gamsworld@googlegroups.com.

Visit this group at http://groups.google.com/group/gamsworld.

For more options, visit https://groups.google.com/d/optout.

–

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.

To post to this group, send email to gamsworld@googlegroups.com.

Visit this group at http://groups.google.com/group/gamsworld.

For more options, visit https://groups.google.com/d/optout.