How to set the data order

193 views
Skip to first unread message

icefrancis

unread,
May 24, 2012, 6:10:21 AM5/24/12
to AIMMS - The Modeling System
Dear all,

I have a sql table with data :
{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20}, but when I map
to a set :ODpoint, it turns to:

ODpoint: {1,10,11,12,13,14,15,16,17,18,19,2,20,3,4,5,6,7,8,9},
normally it does not matter, but in my model these numbers have some
connection, e.g. (1,20),(2,19) are pairs, and I have couples of
constraint, so if these data show in a sequence order it will be much
easier to solve:
How to change the data sequence to :
{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20},

This question looks a bit stupid :-), but will help me a lot if it is
solved
Thank you in advance


Francis

Guido Diepen

unread,
May 25, 2012, 3:31:48 AM5/25/12
to ai...@googlegroups.com
Hi Francis,

It looks like the data is provided in this order by the database when reading from it.

There actually are two possible solutions in your case:
  • Make use of the order by attribute of the set ODpoint. If it has the index i, then use the following expression for the order by  attribute:
    val(i)
    Please note however, that this might have a negative impact on the performance of the engine. For more information about this, please see the chapter Execution Efficiency Cookbook in the AIMMS Language Reference.
  • Make the set ODpoint a subset of the predefined set Integers. As there is already an ordering on the set of all integers, the elements in the set ODpoint will automatically follow this order. Please note that this solution only works if your set ODpoints only contains integer elements.
Guido Diepen
AIMMS Specialist

icefrancis

unread,
May 25, 2012, 4:45:19 AM5/25/12
to AIMMS - The Modeling System
Dear Guido,

Thanks a lot for your reply! It is solved by using the third method
you mentioned.

Francis


On May 25, 9:31 am, Guido Diepen <Guido.Die...@aimms.com> wrote:
> Hi Francis,
>
> It looks like the data is provided in this order by the database when
> reading from it.
>
> There actually are two possible solutions in your case:
>
>    - Make use of the order by attribute of the set ODpoint. If it has the
>    index i, then use the following expression for the order by  attribute:
>    val(i)
>    Please note however, that this might have a negative impact on the
>    performance of the engine. For more information about this, please see the
>    chapter Execution Efficiency Cookbook in the AIMMS Language Reference.
>    - Make the set ODpoint a subset of the predefined set Integers. As there

Guido Diepen

unread,
May 25, 2012, 6:18:53 AM5/25/12
to ai...@googlegroups.com
Hi Francis,

really interested to know what my third method was and how you implemented that method, as I only provided two methods :)

Guido Diepen
AIMMS Specialist
Reply all
Reply to author
Forward
0 new messages