[AIMMS] question about sum

50 views
Skip to first unread message

luc kendra

unread,
May 7, 2010, 5:32:43 PM5/7/10
to AIMMS - The Modeling System
Hi,
i want to implement constraints into aimms
now i have for example the constraints: [ r=1 sum i+2] Xr + [ r=23
sum i] Pr >=0 where i=1,2,...,24
and (r=2 sum i) Fr = 0 where i=20,21,...,40
how do i programm this in aimss?

i have 2 sets:
set periods, index r: 1,2,...40 and
set periods2, index r2:1,2,...,40 (and put r2 as a subset of periods,
this one is used for i)

for the first constraint i tried:
sum(r|1<=ord(r)<=ord('24',r2)+1,X(r)) + sum(p|
23<=ord(r<=ord('24',r2) but it doesnt work
since the first constraint didnt work out i have no clue how the
second one should be put into aimms
can someone help me out??

--
You received this message because you are subscribed to the Google Groups "AIMMS - The Modeling System" group.
To post to this group, send email to ai...@googlegroups.com.
To unsubscribe from this group, send email to aimms+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/aimms?hl=en.

Marcel Roelofs

unread,
May 9, 2010, 5:19:02 PM5/9/10
to AIMMS - The Modeling System
Hi Luc,

Maybe you can start explaining what you exactly mean with, for
instance, the expression

[ r=1 sum i+2] Xr

Nor this expression nor how you thought it should be modeled in AIMMS
gives me any clue as to how to interpret it.

Cheers,
Marcel

luc kendra

unread,
May 10, 2010, 3:09:24 PM5/10/10
to ai...@googlegroups.com
hi marcel,
im sorry i wasnt clear but what i meant was the constraint: http://img191.imageshack.us/img191/2151/constraint.png

luc


2010/5/9 Marcel Roelofs <marcel....@gmail.com>

Daniel Lie

unread,
May 10, 2010, 9:12:22 PM5/10/10
to ai...@googlegroups.com
Hi Luc,

In the equation you sent, it looks like there are two indexes: r and i. Is this your intent?

Also, it looks like you haven't actually specified what the function X(r) means. Eg: X(r) = r^2

Maybe you could describe in words the problem you are trying to solve?

Cheers,
Daniel

Marcel Roelofs

unread,
May 12, 2010, 7:32:17 PM5/12/10
to AIMMS - The Modeling System
If you want express everything into the exact notation you presented
the problem
- you declare two integer sets (ie. subsets of the predefined set
Integers), say SetI, SetR
- your constraint is indexed over i: FirstConstraint(i | 1 <= i <= 24)
- the definition of the constraint is:

sum(r | 1 <= r <= i+2, x(r)) + sum(r | 23 <= r <= i, P(r)) >= 0

Notice that i+2 in the above expression is actual a lead operator (if
you don't know what it is, look it up in the Language reference),
so the lead value only coincides with the numerical value if there are
no consecutive integers missing from it. Otherwise you have to
resort to using the ord operator.

Alternatively, you should skip using meaningless names integer sets
and set elements, parameters and variables alltogether, and start
using more meaningful names for sets, set elements, parameters and
variables..This is especially useful if your model grows, and
remembering where all the silly identifier and element names stand for
becomes very, very cumbersome.

Cheers,
Marcel

luc kendra

unread,
May 15, 2010, 8:55:53 PM5/15/10
to ai...@googlegroups.com
hi marcel,

thank you very much for your help, it solved my problem!


2010/5/13 Marcel Roelofs <marcel....@gmail.com>
Reply all
Reply to author
Forward
0 new messages