Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  conditional cardinality function

    Posted 07/29/08 01:55 AM

    Originally posted by: SystemAdmin


    [agus said:]

    Hi,

    Is there a way to find the cardinality of certain members of a set?

    Here is my code:

    tuple flight {
    key string flightID;
      {int} nodes;
      {int} holdingNodes;
      int destination;
      int origin;
      string status;
      string class;
      int OBT;
      int ETA;
    }

    {flight} Flights = {
    <", {6,1,2,3}, {3}, 3,6, "dept", "s", 1,0>,
    <", {6,7,2,3}, {3}, 3,6, "dept", "h", 1,0>,
    <", {35, 34, 33, 32, 31}, {35}, 31, 35, "arri", "h", 0, 700>,
    <", {35, 34, 33, 32, 31,26}, {35}, 26, 35, "arri", "s", 0, 800>
    };


    I would like to find the number of: i.status == "dept" in set the "Flights"

    I tried:

    subject to {

    //Fairness 2
    forall (i in Flights: i.status == "dept")
    t[i][i.origin] - i.OBT <= (sum (i in Flights: i.status == "dept") (t[i][i.origin] - i.OBT)) / card (Flights: i.status =="dept");<br />
    }


    But it didn't work.
    Like you can see I am trying to find an average value, but for that I need to find the cardinality first.

    Could anyone help me with this?

    Thanks,

    agus
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: conditional cardinality function

    Posted 07/29/08 02:49 AM

    Originally posted by: SystemAdmin


    [UDOPS said:]

    Here are things I tried. I don't know if they will paste into constraints, but I think you get the idea.


    tuple flight {
    key string flightID;
      {int} nodes;
      {int} holdingNodes;
      int destination;
      int origin;
      string status;
      string class;
      int OBT;
      int ETA;
    }

    {flight} Flights = {
    <", {6,1,2,3}, {3}, 3,6, "dept", "s", 1,0>,
    <", {6,7,2,3}, {3}, 3,6, "dept", "h", 1,0>,
    <", {35, 34, 33, 32, 31}, {, 31, 35, "arri", "h", 0, 700>,
    <", {35, 34, 33, 32, 31,26}, {35}, 26, 35, "arri", "s", 0, 800>
    };

    {flight} Flightdept = {f | f in Flights: f.status=="dept"};
    int Deptcount = card(Flightdept);
    int Deptcountalt = card({f | f in Flights: f.status=="dept"}); //alternate form

    //more ideas

    tuple shortlist {
    key string flightID;
    int destination;
    }

    {35}shortlist} Deptlist = {<f.flightID, f.destination> | f in Flights: f.status=="dept"};


    execute{
    for (var f in Flightdept) {
    writeln(f.flightID+", "+f.status)
    }
    writeln(Deptcount)
    writeln(Deptcountalt)
    writeln(Deptlist)
    }
    #DecisionOptimization
    #OPLusingCPLEXOptimizer