Gams nurse scheduling urgent help

Archive of Gamsworld Google Group
Archiver
User
User
Posts: 7876
Joined: 7 years ago

Gams nurse scheduling urgent help

Post by Archiver »


Hi,

i'm new on gams optimization programming. i trying to solve nurse scheduling problem bu it doesn't work.
it doesnt complete. but this statement has error:

Sbt1.. sum ( (k,i)$( ord(k) ord(i) ), XD(i,k) ) =g= Di;

sets
n /28/
m /12/
i /1*28/
k /1*12/
Di /5/
Ni /3/;

variables
XD(i,k)
XN(i,k)
XR(i,k);

equations
Sbt1



Sbt1.. sum ( (k)$( ord(k) ord(i) ), XD(i,k) ) =g= Di;

model nurseproblem /all/;
solve nurseproblem minimizing z using MIP;


for now i only want sum XDi,k for all i
how can do this. please help.

--
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 https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.
Archiver
User
User
Posts: 7876
Joined: 7 years ago

Re: Gams nurse scheduling urgent help

Post by Archiver »


Sengul: If you have no restriction on which terms should be summed, you don't need any conditional $ operator.

Sbt1.. sum ((i,k), XD(i,k) ) =g= Di;

Regards!
Claudio

On Fri, Feb 19, 2016 at 11:12 AM, sengul can wrote:

Hi,

i'm new on gams optimization programming. i trying to solve nurse scheduling problem bu it doesn't work.
it doesnt complete. but this statement has error:

Sbt1.. sum ( (k,i)$( ord(k) ord(i) ), XD(i,k) ) =g= Di;

sets
n /28/
m /12/
i /1*28/
k /1*12/
Di /5/
Ni /3/;

variables
XD(i,k)
XN(i,k)
XR(i,k);

equations
Sbt1



Sbt1.. sum ( (k)$( ord(k) ord(i) ), XD(i,k) ) =g= Di;

model nurseproblem /all/;
solve nurseproblem minimizing z using MIP;


for now i only want sum XDi,k for all i
how can do this. please help.

--
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 https://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 https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.
Archiver
User
User
Posts: 7876
Joined: 7 years ago

Re: Gams nurse scheduling urgent help

Post by Archiver »


Hi Dear Claudio,
first thank you for your helps.
I am developing code yet and have another question.

My gams code is as following;

sets
n number of day /28/
m number of nurse /12/
i index of day /n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16,n17,n18,n19,n20,n21,n22,n23,n24,n25,n26,n27,n28/
k index of nurse /h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11,12/
j shift /Di,Ni/
Di number of nurse in working day shift /5/
Ni number of nurse in working day at night shift /3/
h weekend days into mount /6,7,13,14,20,21,27,28/

variables
XD(i,k)
XN(i,k)
XR(i,k)
z;

equations
Sbt1
Sbt11
Sbt2
Sbt3
Sbt4
DKisit1
DKisit2
DKisit3
DKisit33
DKisit4
DKisit5
DKisit6
DKisit66
DKisit7
DKisit8
DKisit88
DKisit9
Amac;


Sbt1.. sum((i,k),XD(i,k)) =g= 5;
Sbt11.. sum((i,k),XD(i,k)) =g= 3;
Sbt2.. sum((i,k),XD(i,k))+sum((i,k),XN(i,k))+sum((i,k),XR(i,k)) =l= 1;
Sbt3.. sum((i(i+1),k),XD(i,k))+sum((i,k),XN(i,k)) =e= 1;
Sbt4.. sum((i,k),XN(i,k))+sum((i(i+1),k),XN(i,k)) =e= 1;
DKisit1.. sum((i,k)$(ord(i) eq 6 or ord(i) eq 7 or ord(i) eq 13 or ord(i) eq 14 or ord(i) eq 20 or ord(i) eq 21 or ord(i) eq 27 or ord(i) eq 28),XR(i,k)) =g= 4;
DKisit2.. sum((i,k)$(ord(i) eq 6 or ord(i) eq 13 or ord(i) eq 20 or ord(i) eq 27),XR(i,k)+XR(i+1,k)) =l= 1;
DKisit3.. sum((i,k),XD(i,k)+XN(i,k)) =g= 15;
DKisit33.. sum((i,k),XD(i,k)+XN(i,k)) =l= 18;
DKisit4.. sum((i,k),XD(i,k)) =g= 6;
DKisit5.. sum((i,k),XD(i,k)) - sum((i,k),XN(i,k)) =g= 0;
Dkisit6.. sum((i,k)$(ord(k) eq 3 or ord(k) eq 4 or ord(k) eq 5 or ord(k) eq 6),XD(i,k)) =g= 1;

model nurseproblem /all/;


this line

Dkisit6.. sum((i,k)$(ord(k) eq 3 or ord(k) eq 4 or ord(k) eq 5 or ord(k) eq 6),XD(i,k)) =g= 1;

shows a error indicating "Set used in 'ord' or lag is not ordered." in which my mathematical model is Σ𝐗𝐃𝐢,𝐤 ≥ 1, k= 3, 4, 5, 6

here, i want that it sum XDi,k for all i and k=3,4,5,6

Finally, my question is that my code line is true and how can i make it correctly for this line?


if you help me about this subject ı will be pleased.

Sincerely,

Şengül




19 Şubat 2016 Cuma 17:16:15 UTC+2 tarihinde Claudio Delpino yazdı:

Sengul: If you have no restriction on which terms should be summed, you don't need any conditional $ operator.

Sbt1.. sum ((i,k), XD(i,k) ) =g= Di;

Regards!
Claudio

On Fri, Feb 19, 2016 at 11:12 AM, sengul can wrote:

Hi,

i'm new on gams optimization programming. i trying to solve nurse scheduling problem bu it doesn't work.
it doesnt complete. but this statement has error:

Sbt1.. sum ( (k,i)$( ord(k) ord(i) ), XD(i,k) ) =g= Di;

sets
n /28/
m /12/
i /1*28/
k /1*12/
Di /5/
Ni /3/;

variables
XD(i,k)
XN(i,k)
XR(i,k);

equations
Sbt1



Sbt1.. sum ( (k)$( ord(k) ord(i) ), XD(i,k) ) =g= Di;

model nurseproblem /all/;
solve nurseproblem minimizing z using MIP;


for now i only want sum XDi,k for all i
how can do this. please help.

--
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+...@googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at https://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 https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.
Archiver
User
User
Posts: 7876
Joined: 7 years ago

RE: Gams nurse scheduling urgent help

Post by Archiver »


Hi Sengüel



If you put the k set as the first set in your declarion, it works fine.

Sets

k …

n..

…



This has to do with the UEL (search the documentation for this or the mailing list).



Cheers

Renger



From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of sengul can
Sent: Dienstag, 23. Februar 2016 21:33
To: gamsworld
Subject: Re: Gams nurse scheduling urgent help



Hi Dear Claudio,

first thank you for your helps.

I am developing code yet and have another question.



My gams code is as following;



sets

n number of day /28/

m number of nurse /12/

i index of day /n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16,n17,n18,n19,n20,n21,n22,n23,n24,n25,n26,n27,n28/

k index of nurse /h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11,12/

j shift /Di,Ni/

Di number of nurse in working day shift /5/

Ni number of nurse in working day at night shift /3/

h weekend days into mount /6,7,13,14,20,21,27,28/



variables

XD(i,k)

XN(i,k)

XR(i,k)

z;



equations

Sbt1

Sbt11

Sbt2

Sbt3

Sbt4

DKisit1

DKisit2

DKisit3

DKisit33

DKisit4

DKisit5

DKisit6

DKisit66

DKisit7

DKisit8

DKisit88

DKisit9

Amac;





Sbt1.. sum((i,k),XD(i,k)) =g= 5;

Sbt11.. sum((i,k),XD(i,k)) =g= 3;

Sbt2.. sum((i,k),XD(i,k))+sum((i,k),XN(i,k))+sum((i,k),XR(i,k)) =l= 1;

Sbt3.. sum((i(i+1),k),XD(i,k))+sum((i,k),XN(i,k)) =e= 1;

Sbt4.. sum((i,k),XN(i,k))+sum((i(i+1),k),XN(i,k)) =e= 1;

DKisit1.. sum((i,k)$(ord(i) eq 6 or ord(i) eq 7 or ord(i) eq 13 or ord(i) eq 14 or ord(i) eq 20 or ord(i) eq 21 or ord(i) eq 27 or ord(i) eq 28),XR(i,k)) =g= 4;

DKisit2.. sum((i,k)$(ord(i) eq 6 or ord(i) eq 13 or ord(i) eq 20 or ord(i) eq 27),XR(i,k)+XR(i+1,k)) =l= 1;

DKisit3.. sum((i,k),XD(i,k)+XN(i,k)) =g= 15;

DKisit33.. sum((i,k),XD(i,k)+XN(i,k)) =l= 18;

DKisit4.. sum((i,k),XD(i,k)) =g= 6;

DKisit5.. sum((i,k),XD(i,k)) - sum((i,k),XN(i,k)) =g= 0;

Dkisit6.. sum((i,k)$(ord(k) eq 3 or ord(k) eq 4 or ord(k) eq 5 or ord(k) eq 6),XD(i,k)) =g= 1;



model nurseproblem /all/;





this line



Dkisit6.. sum((i,k)$(ord(k) eq 3 or ord(k) eq 4 or ord(k) eq 5 or ord(k) eq 6),XD(i,k)) =g= 1;



shows a error indicating "Set used in 'ord' or lag is not ordered." in which my mathematical model is Σ𝐗𝐃𝐢,𝐤 ≥ 1, k= 3, 4, 5, 6



here, i want that it sum XDi,k for all i and k=3,4,5,6



Finally, my question is that my code line is true and how can i make it correctly for this line?





if you help me about this subject ı will be pleased.



Sincerely,



Şengül







19 Şubat 2016 Cuma 17:16:15 UTC+2 tarihinde Claudio Delpino yazdı:

Sengul: If you have no restriction on which terms should be summed, you don't need any conditional $ operator.



Sbt1.. sum ((i,k), XD(i,k) ) =g= Di;



Regards!

Claudio



On Fri, Feb 19, 2016 at 11:12 AM, sengul can wrote:

Hi,



i'm new on gams optimization programming. i trying to solve nurse scheduling problem bu it doesn't work.

it doesnt complete. but this statement has error:



Sbt1.. sum ( (k,i)$( ord(k) ord(i) ), XD(i,k) ) =g= Di;



sets

n /28/

m /12/

i /1*28/

k /1*12/

Di /5/

Ni /3/;



variables

XD(i,k)

XN(i,k)

XR(i,k);



equations

Sbt1







Sbt1.. sum ( (k)$( ord(k) ord(i) ), XD(i,k) ) =g= Di;



model nurseproblem /all/;

solve nurseproblem minimizing z using MIP;





for now i only want sum XDi,k for all i

how can do this. please help.

--
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+...@googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at https://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 https://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 https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.
Archiver
User
User
Posts: 7876
Joined: 7 years ago

Re: Gams nurse scheduling urgent help

Post by Archiver »


Hi again,
thanks for your help.
however, i have other question.

My mathematical model is as follow;

𝐗𝐑𝐢,𝐤 + 𝐗𝐑𝐢+𝟏,𝐤 ≤ 1, i= 6, 13, 20, 27 for all k

and part of my gams code;

n number of day /28/
m number of nurse /12/
i index of day /n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16,n17,n18,n19,n20,n21,n22,n23,n24,n25,n26,n27,n28/
k index of nurse /h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11,12/
j shift /Di,Ni/
Di number of nurse in working day shift /5/
Ni number of nurse in working day at night shift /3/
h weekend days into mount /6,7,13,14,20,21,27,28/

equations
DKisit2;

DKisit2.. sum((i,k)$(ord(i) eq 6 or ord(i) eq 13 or ord(i) eq 20 or ord(i) eq 27),XR(i,k)+XR(i+1,k)) =l= 1;


For my mathematical model, this syntax is true?

Sincerely.


24 Şubat 2016 Çarşamba 10:37:22 UTC+2 tarihinde Renger van Nieuwkoop yazdı:

Hi Sengüel



If you put the k set as the first set in your declarion, it works fine.

Sets

k …

n..

…



This has to do with the UEL (search the documentation for this or the mailing list).



Cheers

Renger



From: gams...@googlegroups.com [mailto:gams...@googlegroups.com] On Behalf Of sengul can
Sent: Dienstag, 23. Februar 2016 21:33
To: gamsworld
Subject: Re: Gams nurse scheduling urgent help



Hi Dear Claudio,

first thank you for your helps.

I am developing code yet and have another question.



My gams code is as following;



sets

n number of day /28/

m number of nurse /12/

i index of day /n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16,n17,n18,n19,n20,n21,n22,n23,n24,n25,n26,n27,n28/

k index of nurse /h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11,12/

j shift /Di,Ni/

Di number of nurse in working day shift /5/

Ni number of nurse in working day at night shift /3/

h weekend days into mount /6,7,13,14,20,21,27,28/



variables

XD(i,k)

XN(i,k)

XR(i,k)

z;



equations

Sbt1

Sbt11

Sbt2

Sbt3

Sbt4

DKisit1

DKisit2

DKisit3

DKisit33

DKisit4

DKisit5

DKisit6

DKisit66

DKisit7

DKisit8

DKisit88

DKisit9

Amac;





Sbt1.. sum((i,k),XD(i,k)) =g= 5;

Sbt11.. sum((i,k),XD(i,k)) =g= 3;

Sbt2.. sum((i,k),XD(i,k))+sum((i,k),XN(i,k))+sum((i,k),XR(i,k)) =l= 1;

Sbt3.. sum((i(i+1),k),XD(i,k))+sum((i,k),XN(i,k)) =e= 1;

Sbt4.. sum((i,k),XN(i,k))+sum((i(i+1),k),XN(i,k)) =e= 1;

DKisit1.. sum((i,k)$(ord(i) eq 6 or ord(i) eq 7 or ord(i) eq 13 or ord(i) eq 14 or ord(i) eq 20 or ord(i) eq 21 or ord(i) eq 27 or ord(i) eq 28),XR(i,k)) =g= 4;

DKisit2.. sum((i,k)$(ord(i) eq 6 or ord(i) eq 13 or ord(i) eq 20 or ord(i) eq 27),XR(i,k)+XR(i+1,k)) =l= 1;

DKisit3.. sum((i,k),XD(i,k)+XN(i,k)) =g= 15;

DKisit33.. sum((i,k),XD(i,k)+XN(i,k)) =l= 18;

DKisit4.. sum((i,k),XD(i,k)) =g= 6;

DKisit5.. sum((i,k),XD(i,k)) - sum((i,k),XN(i,k)) =g= 0;

Dkisit6.. sum((i,k)$(ord(k) eq 3 or ord(k) eq 4 or ord(k) eq 5 or ord(k) eq 6),XD(i,k)) =g= 1;



model nurseproblem /all/;





this line



Dkisit6.. sum((i,k)$(ord(k) eq 3 or ord(k) eq 4 or ord(k) eq 5 or ord(k) eq 6),XD(i,k)) =g= 1;



shows a error indicating "Set used in 'ord' or lag is not ordered." in which my mathematical model is Σ𝐗𝐃𝐢,𝐤 ≥ 1, k= 3, 4, 5, 6



here, i want that it sum XDi,k for all i and k=3,4,5,6



Finally, my question is that my code line is true and how can i make it correctly for this line?





if you help me about this subject ı will be pleased.



Sincerely,



Şengül







19 Şubat 2016 Cuma 17:16:15 UTC+2 tarihinde Claudio Delpino yazdı:

Sengul: If you have no restriction on which terms should be summed, you don't need any conditional $ operator.



Sbt1.. sum ((i,k), XD(i,k) ) =g= Di;



Regards!

Claudio



On Fri, Feb 19, 2016 at 11:12 AM, sengul can wrote:

Hi,



i'm new on gams optimization programming. i trying to solve nurse scheduling problem bu it doesn't work.

it doesnt complete. but this statement has error:



Sbt1.. sum ( (k,i)$( ord(k) ord(i) ), XD(i,k) ) =g= Di;



sets

n /28/

m /12/

i /1*28/

k /1*12/

Di /5/

Ni /3/;



variables

XD(i,k)

XN(i,k)

XR(i,k);



equations

Sbt1







Sbt1.. sum ( (k)$( ord(k) ord(i) ), XD(i,k) ) =g= Di;



model nurseproblem /all/;

solve nurseproblem minimizing z using MIP;





for now i only want sum XDi,k for all i

how can do this. please help.

--
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+...@googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at https://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+...@googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at https://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 https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.
Archiver
User
User
Posts: 7876
Joined: 7 years ago

Re: Gams nurse scheduling urgent help

Post by Archiver »


Sengul:

No. Why are you using sum ?

DKisit2(i,k)$(ord(i) eq 6 or ord(i) eq 13 or ord(i) eq 20 or ord(i) eq 27)..XR(i,k)+XR(i+1,k) =l= 1;

Best way to check, the "Equation Listing" section of the listing file (.lst). If you don't get to see what you need, you can tune the number shown using Limrow.

Regards!
Claudio


On Wed, Feb 24, 2016 at 5:14 PM, sengul can wrote:

Hi again,
thanks for your help.
however, i have other question.

My mathematical model is as follow;

𝐗𝐑𝐢,𝐤 + 𝐗𝐑𝐢+𝟏,𝐤 ≤ 1, i= 6, 13, 20, 27 for all k

and part of my gams code;

n number of day /28/
m number of nurse /12/
i index of day /n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16,n17,n18,n19,n20,n21,n22,n23,n24,n25,n26,n27,n28/
k index of nurse /h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11,12/
j shift /Di,Ni/
Di number of nurse in working day shift /5/
Ni number of nurse in working day at night shift /3/
h weekend days into mount /6,7,13,14,20,21,27,28/

equations
DKisit2;

DKisit2.. sum((i,k)$(ord(i) eq 6 or ord(i) eq 13 or ord(i) eq 20 or ord(i) eq 27),XR(i,k)+XR(i+1,k)) =l= 1;


For my mathematical model, this syntax is true?

Sincerely.


24 Şubat 2016 Çarşamba 10:37:22 UTC+2 tarihinde Renger van Nieuwkoop yazdı:

Hi Sengüel



If you put the k set as the first set in your declarion, it works fine.

Sets

k …

n..

…



This has to do with the UEL (search the documentation for this or the mailing list).



Cheers

Renger



From: gams...@googlegroups.com [mailto:gams...@googlegroups.com] On Behalf Of sengul can
Sent: Dienstag, 23. Februar 2016 21:33
To: gamsworld

Subject: Re: Gams nurse scheduling urgent help



Hi Dear Claudio,

first thank you for your helps.

I am developing code yet and have another question.



My gams code is as following;



sets

n number of day /28/

m number of nurse /12/

i index of day /n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16,n17,n18,n19,n20,n21,n22,n23,n24,n25,n26,n27,n28/

k index of nurse /h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11,12/

j shift /Di,Ni/

Di number of nurse in working day shift /5/

Ni number of nurse in working day at night shift /3/

h weekend days into mount /6,7,13,14,20,21,27,28/



variables

XD(i,k)

XN(i,k)

XR(i,k)

z;



equations

Sbt1

Sbt11

Sbt2

Sbt3

Sbt4

DKisit1

DKisit2

DKisit3

DKisit33

DKisit4

DKisit5

DKisit6

DKisit66

DKisit7

DKisit8

DKisit88

DKisit9

Amac;





Sbt1.. sum((i,k),XD(i,k)) =g= 5;

Sbt11.. sum((i,k),XD(i,k)) =g= 3;

Sbt2.. sum((i,k),XD(i,k))+sum((i,k),XN(i,k))+sum((i,k),XR(i,k)) =l= 1;

Sbt3.. sum((i(i+1),k),XD(i,k))+sum((i,k),XN(i,k)) =e= 1;

Sbt4.. sum((i,k),XN(i,k))+sum((i(i+1),k),XN(i,k)) =e= 1;

DKisit1.. sum((i,k)$(ord(i) eq 6 or ord(i) eq 7 or ord(i) eq 13 or ord(i) eq 14 or ord(i) eq 20 or ord(i) eq 21 or ord(i) eq 27 or ord(i) eq 28),XR(i,k)) =g= 4;

DKisit2.. sum((i,k)$(ord(i) eq 6 or ord(i) eq 13 or ord(i) eq 20 or ord(i) eq 27),XR(i,k)+XR(i+1,k)) =l= 1;

DKisit3.. sum((i,k),XD(i,k)+XN(i,k)) =g= 15;

DKisit33.. sum((i,k),XD(i,k)+XN(i,k)) =l= 18;

DKisit4.. sum((i,k),XD(i,k)) =g= 6;

DKisit5.. sum((i,k),XD(i,k)) - sum((i,k),XN(i,k)) =g= 0;

Dkisit6.. sum((i,k)$(ord(k) eq 3 or ord(k) eq 4 or ord(k) eq 5 or ord(k) eq 6),XD(i,k)) =g= 1;



model nurseproblem /all/;





this line



Dkisit6.. sum((i,k)$(ord(k) eq 3 or ord(k) eq 4 or ord(k) eq 5 or ord(k) eq 6),XD(i,k)) =g= 1;



shows a error indicating "Set used in 'ord' or lag is not ordered." in which my mathematical model is Σ𝐗𝐃𝐢,𝐤 ≥ 1, k= 3, 4, 5, 6



here, i want that it sum XDi,k for all i and k=3,4,5,6



Finally, my question is that my code line is true and how can i make it correctly for this line?





if you help me about this subject ı will be pleased.



Sincerely,



Şengül







19 Şubat 2016 Cuma 17:16:15 UTC+2 tarihinde Claudio Delpino yazdı:

Sengul: If you have no restriction on which terms should be summed, you don't need any conditional $ operator.



Sbt1.. sum ((i,k), XD(i,k) ) =g= Di;



Regards!

Claudio



On Fri, Feb 19, 2016 at 11:12 AM, sengul can wrote:

Hi,



i'm new on gams optimization programming. i trying to solve nurse scheduling problem bu it doesn't work.

it doesnt complete. but this statement has error:



Sbt1.. sum ( (k,i)$( ord(k) ord(i) ), XD(i,k) ) =g= Di;



sets

n /28/

m /12/

i /1*28/

k /1*12/

Di /5/

Ni /3/;



variables

XD(i,k)

XN(i,k)

XR(i,k);



equations

Sbt1







Sbt1.. sum ( (k)$( ord(k) ord(i) ), XD(i,k) ) =g= Di;



model nurseproblem /all/;

solve nurseproblem minimizing z using MIP;





for now i only want sum XDi,k for all i

how can do this. please help.

--
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+...@googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at https://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+...@googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at https://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 https://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 https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.
Archiver
User
User
Posts: 7876
Joined: 7 years ago

Re: Gams nurse scheduling urgent help

Post by Archiver »


Hi Claudio,
thank you for your quick reply.

i'm using sum function because i want check for all k value, and for only i=6,13,20,17
if i dont use sum, my syntax is

DKisit2.. 1 =l= ((i,k)$(ord(i) eq 6 or ord(i) eq 13 or ord(i) eq 20 or ord(i) eq 27),XR(i,k)+XR(i+1,k));

and then i got this error : Dimension Different , ) expected etc.

i searched LIMROW but i didn't understood very well. Ä°s this function verification my gams code?
Thank you for your help.
Sincerely.


25 Şubat 2016 Perşembe 17:39:58 UTC+2 tarihinde Claudio Delpino yazdı:

Sengul:

No. Why are you using sum ?

DKisit2(i,k)$(ord(i) eq 6 or ord(i) eq 13 or ord(i) eq 20 or ord(i) eq 27)..XR(i,k)+XR(i+1,k) =l= 1;

Best way to check, the "Equation Listing" section of the listing file (.lst). If you don't get to see what you need, you can tune the number shown using Limrow.

Regards!
Claudio


On Wed, Feb 24, 2016 at 5:14 PM, sengul can wrote:

Hi again,
thanks for your help.
however, i have other question.

My mathematical model is as follow;

𝐗𝐑𝐢,𝐤 + 𝐗𝐑𝐢+𝟏,𝐤 ≤ 1, i= 6, 13, 20, 27 for all k

and part of my gams code;

n number of day /28/
m number of nurse /12/
i index of day /n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16,n17,n18,n19,n20,n21,n22,n23,n24,n25,n26,n27,n28/
k index of nurse /h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11,12/
j shift /Di,Ni/
Di number of nurse in working day shift /5/
Ni number of nurse in working day at night shift /3/
h weekend days into mount /6,7,13,14,20,21,27,28/

equations
DKisit2;

DKisit2.. sum((i,k)$(ord(i) eq 6 or ord(i) eq 13 or ord(i) eq 20 or ord(i) eq 27),XR(i,k)+XR(i+1,k)) =l= 1;


For my mathematical model, this syntax is true?

Sincerely.


24 Şubat 2016 Çarşamba 10:37:22 UTC+2 tarihinde Renger van Nieuwkoop yazdı:

Hi Sengüel



If you put the k set as the first set in your declarion, it works fine.

Sets

k …

n..

…



This has to do with the UEL (search the documentation for this or the mailing list).



Cheers

Renger



From: gams...@googlegroups.com [mailto:gams...@googlegroups.com] On Behalf Of sengul can
Sent: Dienstag, 23. Februar 2016 21:33
To: gamsworld

Subject: Re: Gams nurse scheduling urgent help



Hi Dear Claudio,

first thank you for your helps.

I am developing code yet and have another question.



My gams code is as following;



sets

n number of day /28/

m number of nurse /12/

i index of day /n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16,n17,n18,n19,n20,n21,n22,n23,n24,n25,n26,n27,n28/

k index of nurse /h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11,12/

j shift /Di,Ni/

Di number of nurse in working day shift /5/

Ni number of nurse in working day at night shift /3/

h weekend days into mount /6,7,13,14,20,21,27,28/



variables

XD(i,k)

XN(i,k)

XR(i,k)

z;



equations

Sbt1

Sbt11

Sbt2

Sbt3

Sbt4

DKisit1

DKisit2

DKisit3

DKisit33

DKisit4

DKisit5

DKisit6

DKisit66

DKisit7

DKisit8

DKisit88

DKisit9

Amac;





Sbt1.. sum((i,k),XD(i,k)) =g= 5;

Sbt11.. sum((i,k),XD(i,k)) =g= 3;

Sbt2.. sum((i,k),XD(i,k))+sum((i,k),XN(i,k))+sum((i,k),XR(i,k)) =l= 1;

Sbt3.. sum((i(i+1),k),XD(i,k))+sum((i,k),XN(i,k)) =e= 1;

Sbt4.. sum((i,k),XN(i,k))+sum((i(i+1),k),XN(i,k)) =e= 1;

DKisit1.. sum((i,k)$(ord(i) eq 6 or ord(i) eq 7 or ord(i) eq 13 or ord(i) eq 14 or ord(i) eq 20 or ord(i) eq 21 or ord(i) eq 27 or ord(i) eq 28),XR(i,k)) =g= 4;

DKisit2.. sum((i,k)$(ord(i) eq 6 or ord(i) eq 13 or ord(i) eq 20 or ord(i) eq 27),XR(i,k)+XR(i+1,k)) =l= 1;

DKisit3.. sum((i,k),XD(i,k)+XN(i,k)) =g= 15;

DKisit33.. sum((i,k),XD(i,k)+XN(i,k)) =l= 18;

DKisit4.. sum((i,k),XD(i,k)) =g= 6;

DKisit5.. sum((i,k),XD(i,k)) - sum((i,k),XN(i,k)) =g= 0;

Dkisit6.. sum((i,k)$(ord(k) eq 3 or ord(k) eq 4 or ord(k) eq 5 or ord(k) eq 6),XD(i,k)) =g= 1;



model nurseproblem /all/;





this line



Dkisit6.. sum((i,k)$(ord(k) eq 3 or ord(k) eq 4 or ord(k) eq 5 or ord(k) eq 6),XD(i,k)) =g= 1;



shows a error indicating "Set used in 'ord' or lag is not ordered." in which my mathematical model is Σ𝐗𝐃𝐢,𝐤 ≥ 1, k= 3, 4, 5, 6



here, i want that it sum XDi,k for all i and k=3,4,5,6



Finally, my question is that my code line is true and how can i make it correctly for this line?





if you help me about this subject ı will be pleased.



Sincerely,



Şengül







19 Şubat 2016 Cuma 17:16:15 UTC+2 tarihinde Claudio Delpino yazdı:

Sengul: If you have no restriction on which terms should be summed, you don't need any conditional $ operator.



Sbt1.. sum ((i,k), XD(i,k) ) =g= Di;



Regards!

Claudio



On Fri, Feb 19, 2016 at 11:12 AM, sengul can wrote:

Hi,



i'm new on gams optimization programming. i trying to solve nurse scheduling problem bu it doesn't work.

it doesnt complete. but this statement has error:



Sbt1.. sum ( (k,i)$( ord(k) ord(i) ), XD(i,k) ) =g= Di;



sets

n /28/

m /12/

i /1*28/

k /1*12/

Di /5/

Ni /3/;



variables

XD(i,k)

XN(i,k)

XR(i,k);



equations

Sbt1







Sbt1.. sum ( (k)$( ord(k) ord(i) ), XD(i,k) ) =g= Di;



model nurseproblem /all/;

solve nurseproblem minimizing z using MIP;





for now i only want sum XDi,k for all i

how can do this. please help.

--
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+...@googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at https://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+...@googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at https://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+...@googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at https://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 https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.
Archiver
User
User
Posts: 7876
Joined: 7 years ago

Re: Gams nurse scheduling urgent help

Post by Archiver »


Sengul:

That is because the correct syntax for that is what I wrote:

DKisit2(i,k)$(ord(i) eq 6 or ord(i) eq 13 or ord(i) eq 20 or ord(i) eq 27).. XR(i,k)+XR(i+1,k) =l= 1;

Where you declare
​that particular declaration of ​
equation DKisit2 to be indexed over set k and set i, with some conditions on the i index.


If you're working from the gamside, look at the output .lst file. It has a section called "Equation Listing". Look into that and you will understand what limrow is for. You will see that only a certain amount of equations are shown per block, limrow allows to change that cutoff value, so that you can look at a complete block if needed. Anyway, it's always nice to see what the model is actually made of, so check out that part of the .lst.


On Thu, Feb 25, 2016 at 6:12 PM, sengul can wrote:

Hi Claudio,
thank you for your quick reply.

i'm using sum function because i want check for all k value, and for only i=6,13,20,17
if i dont use sum, my syntax is

DKisit2.. 1 =l= ((i,k)$(ord(i) eq 6 or ord(i) eq 13 or ord(i) eq 20 or ord(i) eq 27),XR(i,k)+XR(i+1,k));

and then i got this error : Dimension Different , ) expected etc.

i searched LIMROW but i didn't understood very well. Ä°s this function verification my gams code?
Thank you for your help.
Sincerely.


25 Şubat 2016 Perşembe 17:39:58 UTC+2 tarihinde Claudio Delpino yazdı:

Sengul:

No. Why are you using sum ?

DKisit2(i,k)$(ord(i) eq 6 or ord(i) eq 13 or ord(i) eq 20 or ord(i) eq 27)..XR(i,k)+XR(i+1,k) =l= 1;

Best way to check, the "Equation Listing" section of the listing file (.lst). If you don't get to see what you need, you can tune the number shown using Limrow.

Regards!
Claudio


On Wed, Feb 24, 2016 at 5:14 PM, sengul can wrote:

Hi again,
thanks for your help.
however, i have other question.

My mathematical model is as follow;

𝐗𝐑𝐢,𝐤 + 𝐗𝐑𝐢+𝟏,𝐤 ≤ 1, i= 6, 13, 20, 27 for all k

and part of my gams code;

n number of day /28/
m number of nurse /12/
i index of day /n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16,n17,n18,n19,n20,n21,n22,n23,n24,n25,n26,n27,n28/
k index of nurse /h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11,12/
j shift /Di,Ni/
Di number of nurse in working day shift /5/
Ni number of nurse in working day at night shift /3/
h weekend days into mount /6,7,13,14,20,21,27,28/

equations
DKisit2;

DKisit2.. sum((i,k)$(ord(i) eq 6 or ord(i) eq 13 or ord(i) eq 20 or ord(i) eq 27),XR(i,k)+XR(i+1,k)) =l= 1;


For my mathematical model, this syntax is true?

Sincerely.


24 Şubat 2016 Çarşamba 10:37:22 UTC+2 tarihinde Renger van Nieuwkoop yazdı:

Hi Sengüel



If you put the k set as the first set in your declarion, it works fine.

Sets

k …

n..

…



This has to do with the UEL (search the documentation for this or the mailing list).



Cheers

Renger



From: gams...@googlegroups.com [mailto:gams...@googlegroups.com] On Behalf Of sengul can
Sent: Dienstag, 23. Februar 2016 21:33
To: gamsworld

Subject: Re: Gams nurse scheduling urgent help



Hi Dear Claudio,

first thank you for your helps.

I am developing code yet and have another question.



My gams code is as following;



sets

n number of day /28/

m number of nurse /12/

i index of day /n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16,n17,n18,n19,n20,n21,n22,n23,n24,n25,n26,n27,n28/

k index of nurse /h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11,12/

j shift /Di,Ni/

Di number of nurse in working day shift /5/

Ni number of nurse in working day at night shift /3/

h weekend days into mount /6,7,13,14,20,21,27,28/



variables

XD(i,k)

XN(i,k)

XR(i,k)

z;



equations

Sbt1

Sbt11

Sbt2

Sbt3

Sbt4

DKisit1

DKisit2

DKisit3

DKisit33

DKisit4

DKisit5

DKisit6

DKisit66

DKisit7

DKisit8

DKisit88

DKisit9

Amac;





Sbt1.. sum((i,k),XD(i,k)) =g= 5;

Sbt11.. sum((i,k),XD(i,k)) =g= 3;

Sbt2.. sum((i,k),XD(i,k))+sum((i,k),XN(i,k))+sum((i,k),XR(i,k)) =l= 1;

Sbt3.. sum((i(i+1),k),XD(i,k))+sum((i,k),XN(i,k)) =e= 1;

Sbt4.. sum((i,k),XN(i,k))+sum((i(i+1),k),XN(i,k)) =e= 1;

DKisit1.. sum((i,k)$(ord(i) eq 6 or ord(i) eq 7 or ord(i) eq 13 or ord(i) eq 14 or ord(i) eq 20 or ord(i) eq 21 or ord(i) eq 27 or ord(i) eq 28),XR(i,k)) =g= 4;

DKisit2.. sum((i,k)$(ord(i) eq 6 or ord(i) eq 13 or ord(i) eq 20 or ord(i) eq 27),XR(i,k)+XR(i+1,k)) =l= 1;

DKisit3.. sum((i,k),XD(i,k)+XN(i,k)) =g= 15;

DKisit33.. sum((i,k),XD(i,k)+XN(i,k)) =l= 18;

DKisit4.. sum((i,k),XD(i,k)) =g= 6;

DKisit5.. sum((i,k),XD(i,k)) - sum((i,k),XN(i,k)) =g= 0;

Dkisit6.. sum((i,k)$(ord(k) eq 3 or ord(k) eq 4 or ord(k) eq 5 or ord(k) eq 6),XD(i,k)) =g= 1;



model nurseproblem /all/;





this line



Dkisit6.. sum((i,k)$(ord(k) eq 3 or ord(k) eq 4 or ord(k) eq 5 or ord(k) eq 6),XD(i,k)) =g= 1;



shows a error indicating "Set used in 'ord' or lag is not ordered." in which my mathematical model is Σ𝐗𝐃𝐢,𝐤 ≥ 1, k= 3, 4, 5, 6



here, i want that it sum XDi,k for all i and k=3,4,5,6



Finally, my question is that my code line is true and how can i make it correctly for this line?





if you help me about this subject ı will be pleased.



Sincerely,



Şengül







19 Şubat 2016 Cuma 17:16:15 UTC+2 tarihinde Claudio Delpino yazdı:

Sengul: If you have no restriction on which terms should be summed, you don't need any conditional $ operator.



Sbt1.. sum ((i,k), XD(i,k) ) =g= Di;



Regards!

Claudio



On Fri, Feb 19, 2016 at 11:12 AM, sengul can wrote:

Hi,



i'm new on gams optimization programming. i trying to solve nurse scheduling problem bu it doesn't work.

it doesnt complete. but this statement has error:



Sbt1.. sum ( (k,i)$( ord(k) ord(i) ), XD(i,k) ) =g= Di;



sets

n /28/

m /12/

i /1*28/

k /1*12/

Di /5/

Ni /3/;



variables

XD(i,k)

XN(i,k)

XR(i,k);



equations

Sbt1







Sbt1.. sum ( (k)$( ord(k) ord(i) ), XD(i,k) ) =g= Di;



model nurseproblem /all/;

solve nurseproblem minimizing z using MIP;





for now i only want sum XDi,k for all i

how can do this. please help.

--
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+...@googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at https://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+...@googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at https://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+...@googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at https://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 https://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 https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.
Archiver
User
User
Posts: 7876
Joined: 7 years ago

Re: Gams nurse scheduling urgent help

Post by Archiver »


Dear Claudio,

Thank you for your. Now my equation working true.
Bu i have another problem, my solve statement has an error.


Amac.. sum((i,k), XD(i,k) + XN(i,k) + XR(i,k)) =e=z;

but i have new problem my solve line:

model nurseproblem /all/;
solve nurseproblem minimizing z using MIP;

i have an error this line. my error : the symbol shown has been declared as an equation, but no symbolic equation (..) was found.

if you can help i will greateful.

26 Şubat 2016 Cuma 14:35:56 UTC+2 tarihinde Claudio Delpino yazdı:

Sengul:

That is because the correct syntax for that is what I wrote:

DKisit2(i,k)$(ord(i) eq 6 or ord(i) eq 13 or ord(i) eq 20 or ord(i) eq 27).. XR(i,k)+XR(i+1,k) =l= 1;

Where you declare
​that particular declaration of ​
equation DKisit2 to be indexed over set k and set i, with some conditions on the i index.


If you're working from the gamside, look at the output .lst file. It has a section called "Equation Listing". Look into that and you will understand what limrow is for. You will see that only a certain amount of equations are shown per block, limrow allows to change that cutoff value, so that you can look at a complete block if needed. Anyway, it's always nice to see what the model is actually made of, so check out that part of the .lst.


On Thu, Feb 25, 2016 at 6:12 PM, sengul can wrote:

Hi Claudio,
thank you for your quick reply.

i'm using sum function because i want check for all k value, and for only i=6,13,20,17
if i dont use sum, my syntax is

DKisit2.. 1 =l= ((i,k)$(ord(i) eq 6 or ord(i) eq 13 or ord(i) eq 20 or ord(i) eq 27),XR(i,k)+XR(i+1,k));

and then i got this error : Dimension Different , ) expected etc.

i searched LIMROW but i didn't understood very well. Ä°s this function verification my gams code?
Thank you for your help.
Sincerely.


25 Şubat 2016 Perşembe 17:39:58 UTC+2 tarihinde Claudio Delpino yazdı:

Sengul:

No. Why are you using sum ?

DKisit2(i,k)$(ord(i) eq 6 or ord(i) eq 13 or ord(i) eq 20 or ord(i) eq 27)..XR(i,k)+XR(i+1,k) =l= 1;

Best way to check, the "Equation Listing" section of the listing file (.lst). If you don't get to see what you need, you can tune the number shown using Limrow.

Regards!
Claudio


On Wed, Feb 24, 2016 at 5:14 PM, sengul can wrote:

Hi again,
thanks for your help.
however, i have other question.

My mathematical model is as follow;

𝐗𝐑𝐢,𝐤 + 𝐗𝐑𝐢+𝟏,𝐤 ≤ 1, i= 6, 13, 20, 27 for all k

and part of my gams code;

n number of day /28/
m number of nurse /12/
i index of day /n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16,n17,n18,n19,n20,n21,n22,n23,n24,n25,n26,n27,n28/
k index of nurse /h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11,12/
j shift /Di,Ni/
Di number of nurse in working day shift /5/
Ni number of nurse in working day at night shift /3/
h weekend days into mount /6,7,13,14,20,21,27,28/

equations
DKisit2;

DKisit2.. sum((i,k)$(ord(i) eq 6 or ord(i) eq 13 or ord(i) eq 20 or ord(i) eq 27),XR(i,k)+XR(i+1,k)) =l= 1;


For my mathematical model, this syntax is true?

Sincerely.


24 Şubat 2016 Çarşamba 10:37:22 UTC+2 tarihinde Renger van Nieuwkoop yazdı:

Hi Sengüel



If you put the k set as the first set in your declarion, it works fine.

Sets

k …

n..

…



This has to do with the UEL (search the documentation for this or the mailing list).



Cheers

Renger



From: gams...@googlegroups.com [mailto:gams...@googlegroups.com] On Behalf Of sengul can
Sent: Dienstag, 23. Februar 2016 21:33
To: gamsworld

Subject: Re: Gams nurse scheduling urgent help



Hi Dear Claudio,

first thank you for your helps.

I am developing code yet and have another question.



My gams code is as following;



sets

n number of day /28/

m number of nurse /12/

i index of day /n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16,n17,n18,n19,n20,n21,n22,n23,n24,n25,n26,n27,n28/

k index of nurse /h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11,12/

j shift /Di,Ni/

Di number of nurse in working day shift /5/

Ni number of nurse in working day at night shift /3/

h weekend days into mount /6,7,13,14,20,21,27,28/



variables

XD(i,k)

XN(i,k)

XR(i,k)

z;



equations

Sbt1

Sbt11

Sbt2

Sbt3

Sbt4

DKisit1

DKisit2

DKisit3

DKisit33

DKisit4

DKisit5

DKisit6

DKisit66

DKisit7

DKisit8

DKisit88

DKisit9

Amac;





Sbt1.. sum((i,k),XD(i,k)) =g= 5;

Sbt11.. sum((i,k),XD(i,k)) =g= 3;

Sbt2.. sum((i,k),XD(i,k))+sum((i,k),XN(i,k))+sum((i,k),XR(i,k)) =l= 1;

Sbt3.. sum((i(i+1),k),XD(i,k))+sum((i,k),XN(i,k)) =e= 1;

Sbt4.. sum((i,k),XN(i,k))+sum((i(i+1),k),XN(i,k)) =e= 1;

DKisit1.. sum((i,k)$(ord(i) eq 6 or ord(i) eq 7 or ord(i) eq 13 or ord(i) eq 14 or ord(i) eq 20 or ord(i) eq 21 or ord(i) eq 27 or ord(i) eq 28),XR(i,k)) =g= 4;

DKisit2.. sum((i,k)$(ord(i) eq 6 or ord(i) eq 13 or ord(i) eq 20 or ord(i) eq 27),XR(i,k)+XR(i+1,k)) =l= 1;

DKisit3.. sum((i,k),XD(i,k)+XN(i,k)) =g= 15;

DKisit33.. sum((i,k),XD(i,k)+XN(i,k)) =l= 18;

DKisit4.. sum((i,k),XD(i,k)) =g= 6;

DKisit5.. sum((i,k),XD(i,k)) - sum((i,k),XN(i,k)) =g= 0;

Dkisit6.. sum((i,k)$(ord(k) eq 3 or ord(k) eq 4 or ord(k) eq 5 or ord(k) eq 6),XD(i,k)) =g= 1;



model nurseproblem /all/;





this line



Dkisit6.. sum((i,k)$(ord(k) eq 3 or ord(k) eq 4 or ord(k) eq 5 or ord(k) eq 6),XD(i,k)) =g= 1;



shows a error indicating "Set used in 'ord' or lag is not ordered." in which my mathematical model is Σ𝐗𝐃𝐢,𝐤 ≥ 1, k= 3, 4, 5, 6



here, i want that it sum XDi,k for all i and k=3,4,5,6



Finally, my question is that my code line is true and how can i make it correctly for this line?





if you help me about this subject ı will be pleased.



Sincerely,



Şengül







19 Şubat 2016 Cuma 17:16:15 UTC+2 tarihinde Claudio Delpino yazdı:

Sengul: If you have no restriction on which terms should be summed, you don't need any conditional $ operator.



Sbt1.. sum ((i,k), XD(i,k) ) =g= Di;



Regards!

Claudio



On Fri, Feb 19, 2016 at 11:12 AM, sengul can wrote:

Hi,



i'm new on gams optimization programming. i trying to solve nurse scheduling problem bu it doesn't work.

it doesnt complete. but this statement has error:



Sbt1.. sum ( (k,i)$( ord(k) ord(i) ), XD(i,k) ) =g= Di;



sets

n /28/

m /12/

i /1*28/

k /1*12/

Di /5/

Ni /3/;



variables

XD(i,k)

XN(i,k)

XR(i,k);



equations

Sbt1







Sbt1.. sum ( (k)$( ord(k) ord(i) ), XD(i,k) ) =g= Di;



model nurseproblem /all/;

solve nurseproblem minimizing z using MIP;





for now i only want sum XDi,k for all i

how can do this. please help.

--
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+...@googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at https://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+...@googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at https://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+...@googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at https://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+...@googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at https://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 https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.
Archiver
User
User
Posts: 7876
Joined: 7 years ago

Re: Gams nurse scheduling urgent help

Post by Archiver »


Sengul: as the error states, you are declaring that an equation exists but not any symbolic structure for it.

Example:

Equations
A, b;

A(i).. foo =e= bar;

Will produce the same error, because there is no symbolic declaration for b.

If you add it, i e:

b.. foo2=l=bar2

It will solve the error.

regards!
Claudio
El 02/03/2016 18:07, "sengul can" escribió:

Dear Claudio,

Thank you for your. Now my equation working true.
Bu i have another problem, my solve statement has an error.


Amac.. sum((i,k), XD(i,k) + XN(i,k) + XR(i,k)) =e=z;

but i have new problem my solve line:

model nurseproblem /all/;
solve nurseproblem minimizing z using MIP;

i have an error this line. my error : the symbol shown has been declared as an equation, but no symbolic equation (..) was found.

if you can help i will greateful.

26 Şubat 2016 Cuma 14:35:56 UTC+2 tarihinde Claudio Delpino yazdı:

Sengul:

That is because the correct syntax for that is what I wrote:

DKisit2(i,k)$(ord(i) eq 6 or ord(i) eq 13 or ord(i) eq 20 or ord(i) eq 27).. XR(i,k)+XR(i+1,k) =l= 1;

Where you declare
​that particular declaration of ​
equation DKisit2 to be indexed over set k and set i, with some conditions on the i index.


If you're working from the gamside, look at the output .lst file. It has a section called "Equation Listing". Look into that and you will understand what limrow is for. You will see that only a certain amount of equations are shown per block, limrow allows to change that cutoff value, so that you can look at a complete block if needed. Anyway, it's always nice to see what the model is actually made of, so check out that part of the .lst.


On Thu, Feb 25, 2016 at 6:12 PM, sengul can wrote:

Hi Claudio,
thank you for your quick reply.

i'm using sum function because i want check for all k value, and for only i=6,13,20,17
if i dont use sum, my syntax is

DKisit2.. 1 =l= ((i,k)$(ord(i) eq 6 or ord(i) eq 13 or ord(i) eq 20 or ord(i) eq 27),XR(i,k)+XR(i+1,k));

and then i got this error : Dimension Different , ) expected etc.

i searched LIMROW but i didn't understood very well. Ä°s this function verification my gams code?
Thank you for your help.
Sincerely.


25 Şubat 2016 Perşembe 17:39:58 UTC+2 tarihinde Claudio Delpino yazdı:

Sengul:

No. Why are you using sum ?

DKisit2(i,k)$(ord(i) eq 6 or ord(i) eq 13 or ord(i) eq 20 or ord(i) eq 27)..XR(i,k)+XR(i+1,k) =l= 1;

Best way to check, the "Equation Listing" section of the listing file (.lst). If you don't get to see what you need, you can tune the number shown using Limrow.

Regards!
Claudio


On Wed, Feb 24, 2016 at 5:14 PM, sengul can wrote:

Hi again,
thanks for your help.
however, i have other question.

My mathematical model is as follow;

𝐗𝐑𝐢,𝐤 + 𝐗𝐑𝐢+𝟏,𝐤 ≤ 1, i= 6, 13, 20, 27 for all k

and part of my gams code;

n number of day /28/
m number of nurse /12/
i index of day /n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16,n17,n18,n19,n20,n21,n22,n23,n24,n25,n26,n27,n28/
k index of nurse /h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11,12/
j shift /Di,Ni/
Di number of nurse in working day shift /5/
Ni number of nurse in working day at night shift /3/
h weekend days into mount /6,7,13,14,20,21,27,28/

equations
DKisit2;

DKisit2.. sum((i,k)$(ord(i) eq 6 or ord(i) eq 13 or ord(i) eq 20 or ord(i) eq 27),XR(i,k)+XR(i+1,k)) =l= 1;


For my mathematical model, this syntax is true?

Sincerely.


24 Şubat 2016 Çarşamba 10:37:22 UTC+2 tarihinde Renger van Nieuwkoop yazdı:

Hi Sengüel



If you put the k set as the first set in your declarion, it works fine.

Sets

k …

n..

…



This has to do with the UEL (search the documentation for this or the mailing list).



Cheers

Renger



From: gams...@googlegroups.com [mailto:gams...@googlegroups.com] On Behalf Of sengul can
Sent: Dienstag, 23. Februar 2016 21:33
To: gamsworld

Subject: Re: Gams nurse scheduling urgent help



Hi Dear Claudio,

first thank you for your helps.

I am developing code yet and have another question.



My gams code is as following;



sets

n number of day /28/

m number of nurse /12/

i index of day /n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16,n17,n18,n19,n20,n21,n22,n23,n24,n25,n26,n27,n28/

k index of nurse /h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11,12/

j shift /Di,Ni/

Di number of nurse in working day shift /5/

Ni number of nurse in working day at night shift /3/

h weekend days into mount /6,7,13,14,20,21,27,28/



variables

XD(i,k)

XN(i,k)

XR(i,k)

z;



equations

Sbt1

Sbt11

Sbt2

Sbt3

Sbt4

DKisit1

DKisit2

DKisit3

DKisit33

DKisit4

DKisit5

DKisit6

DKisit66

DKisit7

DKisit8

DKisit88

DKisit9

Amac;





Sbt1.. sum((i,k),XD(i,k)) =g= 5;

Sbt11.. sum((i,k),XD(i,k)) =g= 3;

Sbt2.. sum((i,k),XD(i,k))+sum((i,k),XN(i,k))+sum((i,k),XR(i,k)) =l= 1;

Sbt3.. sum((i(i+1),k),XD(i,k))+sum((i,k),XN(i,k)) =e= 1;

Sbt4.. sum((i,k),XN(i,k))+sum((i(i+1),k),XN(i,k)) =e= 1;

DKisit1.. sum((i,k)$(ord(i) eq 6 or ord(i) eq 7 or ord(i) eq 13 or ord(i) eq 14 or ord(i) eq 20 or ord(i) eq 21 or ord(i) eq 27 or ord(i) eq 28),XR(i,k)) =g= 4;

DKisit2.. sum((i,k)$(ord(i) eq 6 or ord(i) eq 13 or ord(i) eq 20 or ord(i) eq 27),XR(i,k)+XR(i+1,k)) =l= 1;

DKisit3.. sum((i,k),XD(i,k)+XN(i,k)) =g= 15;

DKisit33.. sum((i,k),XD(i,k)+XN(i,k)) =l= 18;

DKisit4.. sum((i,k),XD(i,k)) =g= 6;

DKisit5.. sum((i,k),XD(i,k)) - sum((i,k),XN(i,k)) =g= 0;

Dkisit6.. sum((i,k)$(ord(k) eq 3 or ord(k) eq 4 or ord(k) eq 5 or ord(k) eq 6),XD(i,k)) =g= 1;



model nurseproblem /all/;





this line



Dkisit6.. sum((i,k)$(ord(k) eq 3 or ord(k) eq 4 or ord(k) eq 5 or ord(k) eq 6),XD(i,k)) =g= 1;



shows a error indicating "Set used in 'ord' or lag is not ordered." in which my mathematical model is Σ𝐗𝐃𝐢,𝐤 ≥ 1, k= 3, 4, 5, 6



here, i want that it sum XDi,k for all i and k=3,4,5,6



Finally, my question is that my code line is true and how can i make it correctly for this line?





if you help me about this subject ı will be pleased.



Sincerely,



Şengül







19 Şubat 2016 Cuma 17:16:15 UTC+2 tarihinde Claudio Delpino yazdı:

Sengul: If you have no restriction on which terms should be summed, you don't need any conditional $ operator.



Sbt1.. sum ((i,k), XD(i,k) ) =g= Di;



Regards!

Claudio



On Fri, Feb 19, 2016 at 11:12 AM, sengul can wrote:

Hi,



i'm new on gams optimization programming. i trying to solve nurse scheduling problem bu it doesn't work.

it doesnt complete. but this statement has error:



Sbt1.. sum ( (k,i)$( ord(k) ord(i) ), XD(i,k) ) =g= Di;



sets

n /28/

m /12/

i /1*28/

k /1*12/

Di /5/

Ni /3/;



variables

XD(i,k)

XN(i,k)

XR(i,k);



equations

Sbt1







Sbt1.. sum ( (k)$( ord(k) ord(i) ), XD(i,k) ) =g= Di;



model nurseproblem /all/;

solve nurseproblem minimizing z using MIP;





for now i only want sum XDi,k for all i

how can do this. please help.

--
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+...@googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at https://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+...@googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at https://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+...@googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at https://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+...@googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at https://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 https://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 https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.
Post Reply