Problem with Summing Up withing a Set

Hey,

i want to check how many stations a bus can drive before running low on fuel (in this case battery charge since its an e-bus).

for that purpose i use the batteryload at a given station as a constraint to make sure the bus nonly drives if the load is greater than zero (and later on to decide whether there should be a charging station at a given step).

in this context i want to read out the batteryload at any given station in a set. in words:

“check for every step: load at given step is equal to the capacity of the battery minus consumption at all the steps before the given step”


batteryLoad(steps)… load(steps) =e= capacity - sum(steps,Y(steps) * consumption(steps)) ;



i know that i cant use steps as the fixing point in the equations as well as in the sum. my problem is: what is the way to get the result i want, e.g. the load for every step. i need to change the red steps so that the sum only sums up between 1 and the step the equation is currently fixed at.

note: capacity is a scalar, Y(steps) is a binary variable indication, if the bus did drive on a step.

much thx

\

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/groups/opt_out.

Florian:

A way I figure of doing what you want is using a second set as an alias for steps. i.e.

sets steps description /members/
alias(steps,i);

Then you can do (including the condition you mention):

batteryLoad(steps)… load(steps) =e= capacity - sum(i$(ord(i) le ord(steps)),Y(i) * consumption(i));

Hope to help!
Regards
Claudio




On Sun, Mar 2, 2014 at 4:04 PM, Florian Sinn wrote:

Hey,

i want to check how many stations a bus can drive before running low on fuel (in this case battery charge since its an e-bus).

for that purpose i use the batteryload at a given station as a constraint to make sure the bus nonly drives if the load is greater than zero (and later on to decide whether there should be a charging station at a given step).

in this context i want to read out the batteryload at any given station in a set. in words:

“check for every step: load at given step is equal to the capacity of the battery minus consumption at all the steps before the given step”


batteryLoad(steps)… load(steps) =e= capacity - sum(steps,Y(steps) * consumption(steps)) ;



i know that i cant use steps as the fixing point in the equations as well as in the sum. my problem is: what is the way to get the result i want, e.g. the load for every step. i need to change the red steps so that the sum only sums up between 1 and the step the equation is currently fixed at.

note: capacity is a scalar, Y(steps) is a binary variable indication, if the bus did drive on a step.

much thx

\

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/groups/opt_out.

\

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.