Filtering controlling indices in summation

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

Filtering controlling indices in summation

Post by Archiver »


Hi every body

I have a problem filtering time index in summation . in my model i have time index ( t ) which is defined as a set , in one equation i want to filter the domain of time index , actually in my summation i want to do the summation over a part of set t (not the whole set
: for example i want my summation to be done over time index t but just for

[t-p(i,l)+1,t]

where p(i,l) is a parameter , i wrote it this way but it doesnt look to be correct ,here is part of my code
sets
/ t index of time /1,hl
/activity /a1*a4
(alias(activity,i,j
/m index of staffs /1*8
/l index of projects /1,2

parameters
/h(l) due date of projects /1 8,2 5

table
p(i,l) duration of activities

2 1
a1 2 3
a2 5 4
a3 3 2
; a4 3

variables
(integer variable x(i,m,l,t


co4(m,l) ..sum((i,t)$(t>=(t-p(i,l)+1)),x(i,m,l,t))=l=1

If any body can help me please it would be appreciated


--
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: Filtering controlling indices in summation

Post by Archiver »


Hi Razie



You could use the ord operator



sum((i,t)$(ord(t)t>=(ord(t)-p(i,l)+1)),x(i,m,l,t))=l=1;



Cheers

Renger



From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of razie
Sent: Sonntag, 7. Februar 2016 17:14
To: gamsworld
Subject: Filtering controlling indices in summation



Hi every body



I have a problem filtering time index in summation . in my model i have time index ( t ) which is defined as a set , in one equation i want to filter the domain of time index , actually in my summation i want to do the summation over a part of set t (not the whole set

: for example i want my summation to be done over time index t but just for



[t-p(i,l)+1,t]



where p(i,l) is a parameter , i wrote it this way but it doesnt look to be correct ,here is part of my code

sets

/ t index of time /1,hl

/activity /a1*a4

(alias(activity,i,j

/m index of staffs /1*8

/l index of projects /1,2



parameters

/h(l) due date of projects /1 8,2 5



table

p(i,l) duration of activities



2 1

a1 2 3

a2 5 4

a3 3 2

; a4 3



variables

(integer variable x(i,m,l,t





co4(m,l) ..sum((i,t)$(t>=(t-p(i,l)+1)),x(i,m,l,t))=l=1



If any body can help me please it would be appreciated





--
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: Filtering controlling indices in summation

Post by Archiver »




در یکشنبه 7 فوریهٔ 2016، ساعت 23:08:27 (UTC+3:30)، razie نوشته:

Hi every body

I have a problem filtering time index in summation . in my model i have time index ( t ) which is defined as a set , in one equation i want to filter the domain of time index , actually in my summation i want to do the summation over a part of set t (not the whole set
: for example i want my summation to be done over time index t but just for

[t-p(i,l)+1,t]

where p(i,l) is a parameter , i wrote it this way but it doesnt look to be correct ,here is part of my code
sets
/ t index of time /1,hl
/activity /a1*a4
(alias(activity,i,j
/m index of staffs /1*8
/l index of projects /1,2

parameters
/h(l) due date of projects /1 8,2 5

table
p(i,l) duration of activities

2 1
a1 2 3
a2 5 4
a3 3 2
; a4 3

variables
(integer variable x(i,m,l,t


co4(m,l) ..sum((i,t)$(t>=(t-p(i,l)+1)),x(i,m,l,t))=l=1

If any body can help me please it would be appreciated

thanks for your help Renger.

--
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