Deleting members from set based on defined rules

14 views
Skip to first unread message

simon_onair

unread,
Aug 18, 2017, 7:10:47 AM8/18/17
to AMPL Modeling Language
Hi all,

I am trying to formulate an algorithm that gives me reasonable connections in an airline network. The input is the timetable of an airline. To do so, I use some set-operations to find possible direct or connecting flights between an O&D pair.

The problem is, that the algorithm creates sometimes inefficient connections (e.g. flying from Paris to Madrid via Los Angeles). Therefore based on some rules I want to delete these members from the set.

One example:
The original set ist described as:
Set All_connections:=
...
(Paris,Madrid,dep_time:290, arr_time:390)
(Paris,Madrid,dep_time:190, arr_time:990)
...

As you can see, connection 2 doesn't make sense. My plan is an algorithm of the following form:
{Check for each i and j in O&D-pair
    if dep_time(i)<=dep.time(j) && arr_time(i)>arr_time(j)
       delete i from the set.}

My main problem is: How can I delete members from an existing set based on some business rule as explained in the example?

Hope you can help me :)

Robert Fourer

unread,
Aug 18, 2017, 10:47:53 AM8/18/17
to am...@googlegroups.com
This does not look like AMPL syntax. In AMPL you would write something like

let All_connections := All_connections diff
{(c,d,i1,j1) in All_connections:
exists {(c,d,i2,j2) in All_connections} i1 <= i2 and j1 > j2};

Bob Fourer
am...@googlegroups.com

=======

simon_onair

unread,
Aug 24, 2017, 10:08:37 AM8/24/17
to AMPL Modeling Language, 4...@ampl.com
Thanks! It works perfectly!

One additional question: In my case I have to add addition information in each set-member (e.g. type of aircraft that is used, total flight time, flight number etc.). That leads to the problem that each set-member has more than 20 tupel. But AMPL gives me the error that dimen 20 is the maximum value.

Is there a way to increase the number of possible tupel?

Thanks!!
Reply all
Reply to author
Forward
0 new messages