Comparing subset with parameter in constraint

210 views
Skip to first unread message

rasa raufi

unread,
Jun 9, 2013, 3:56:35 AM6/9/13
to ai...@googlegroups.com
Dear All,


I have a LP model, which have defined time horizon in it, in one of the constraint I have to make a comparison between the current time horizon and another parameter ( time transportation takes from point A to B).

Unfortunately dont know how to set this Using AIMMS ( already have tried different tricks like a subset of ''t'' but didnt worked out and i got the error :
There is no operation defined for operator ">" with arguments of data type set and data type numeric; the arguments themselves are "TH(t)" and "TT(k,d)".


I have attached the model in word, and my current written constraint is:

sum(c,TX(d,c,t)+ETY(d,c,t))-sum[(c,k)|k<>d AND TH(t)>TT(k,d),TX(k,d,(TH(t)-TT(k,d)))+ETY(k,d,(TH(t)-TT(k,d)))]-ETY(d,d,(TH(t)-1))-ETY(d,d,(TH(t)-1))=FAVT(d,t)

The Bold part, where error is happening, here TH(t) is a subset of time{t} which is defined as planning horizon in the model, and TT(k,d) is parameter showing how long takes from point k to d.

Thank you very much for your help in advance.

Best,
Rasa.
first model.docx

Chris Kuip

unread,
Jun 9, 2013, 4:21:08 AM6/9/13
to ai...@googlegroups.com
Hi Rasa,

Is TH a subset of integers?

Best,

Chris. 

Op zondag 9 juni 2013 09:56:35 UTC+2 schreef rasa raufi het volgende:

rasa raufi

unread,
Jun 9, 2013, 4:42:17 AM6/9/13
to ai...@googlegroups.com
Hi Chris,

TH is subset of Time which is defined as : Elementrange( from:1, to:24) 
I`m not 100% sure if it explicitly means that it's an integer though.
I have attached the text file of the model so you can see how I defined Time and TH.

Thanks a lot for helping me with this in advance.

Best,
Rasa.


--
You received this message because you are subscribed to a topic in the Google Groups "AIMMS - The Modeling System" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/aimms/L28retsq-nk/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to aimms+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

9thjunemodel.aim

Chris Kuip

unread,
Jun 9, 2013, 5:37:59 AM6/9/13
to ai...@googlegroups.com
Hi Rasa,

For the set Tme, I think you want: 
- to add 'Integers' to the subset of attribute
- to remove the prefix: "Horizon" from the call to ElementRange in the definition attribute.
This will make your time set Tme both integer and thus numeric and a discrete finite set.
Because the set is numeric AIMMS will allow you to compare its elements using the ">" operator with a numeric parameter.

Note that with this change, the elements of Tme will be 1, 2, 3, ... instead of Horizon1, Horizon2, ... .

Best,

Chris.

Op zondag 9 juni 2013 09:56:35 UTC+2 schreef rasa raufi het volgende:
Dear All,

rasa raufi

unread,
Jun 9, 2013, 5:48:55 AM6/9/13
to ai...@googlegroups.com
Hi Chris, 

Thanks for the trick! I believe this is going to be the situation, just another question ( maybe a bit simple but i`m new using AIMMS), how should i add integer to the subset of attribute?  ( assume need to define in the definition part but could you let me know how to?)


Kind regards,
Rasa.


--

Chris Kuip

unread,
Jun 9, 2013, 6:01:27 AM6/9/13
to ai...@googlegroups.com
Hi Rasa,

Click the wizard button just to the at the "subset of" attribute.
Type in Integers
Click the button with the double down arrow
Click ok

Best,

Chris

Op zondag 9 juni 2013 09:56:35 UTC+2 schreef rasa raufi het volgende:
Dear All,

rasa raufi

unread,
Jun 9, 2013, 6:23:38 AM6/9/13
to ai...@googlegroups.com
Dear Chris, If I do it, then TH wont be anymore subset of Time (t), it will be a subset of Integers, right?

Unfortunately tried it in the constraint and still have the same error there.
Isn`t possible for TH to be both subset of Time and Integers?


Best,
Rasa


--

Chris Kuip

unread,
Jun 9, 2013, 2:52:07 PM6/9/13
to ai...@googlegroups.com
Hi Rasa,

I suggest to let TH stay a subset of Tme, Tme should become a subset of Integers. Thus, yes, TH becomes a subsest of both Tme and Integers in this way.

Hope this helps,

Chris.


Op zondag 9 juni 2013 09:56:35 UTC+2 schreef rasa raufi het volgende:
Dear All,

rasa raufi

unread,
Jun 10, 2013, 1:28:34 AM6/10/13
to ai...@googlegroups.com
Dear Chris,

I have tried that, so now time is a subset of Integers, and TH is subset of time, but still have the same error unfortunately ( on the same spot- TH(t) ). Any Idea?- Its getting really annoying at this point with this error.


All the best,

Rasa.


Chris Kuip

unread,
Jun 10, 2013, 2:16:47 AM6/10/13
to ai...@googlegroups.com
Hi Rasa,

Can you publish your project in this forum, then I'll have a look at it.

Best,

Chris.

Op zondag 9 juni 2013 09:56:35 UTC+2 schreef rasa raufi het volgende:
Dear All,

rasa raufi

unread,
Jun 10, 2013, 2:30:02 AM6/10/13
to ai...@googlegroups.com
Goodmorning Chris, 

Herewith I attached the project (including all files).

Thank you very much in advance.


Kind regards,
Rasa.


--
JDRplanningfirstreallattempt.zip

rasa raufi

unread,
Jun 10, 2013, 2:48:56 AM6/10/13
to ai...@googlegroups.com
Dear Chris, 


Sorry for the inconvenience, this is the latest version of the project ( with the details that we have discussed).


JDRplanningfirstreallattempt.zip

Chris Kuip

unread,
Jun 10, 2013, 3:36:36 AM6/10/13
to ai...@googlegroups.com
Hi Rasa,

With your project it becomes more clear.

At the identifier TH you have specified the index domain attribute; you have made that set an indexed set.  
So the reference TH(t) is also a set and with the expression "TH(t)>TT(k,d)" you are comparing a set to a number.  

Hope this clarifies things.

Best regards,

Chris.

Op maandag 10 juni 2013 08:48:56 UTC+2 schreef rasa raufi het volgende:
Reply all
Reply to author
Forward
0 new messages