Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  "Expecting a tuple type, found int" Error

    Posted 10/29/18 07:35 PM

    Originally posted by: Mahmoud Fayek


    I am trying to formulate a constrain that forces the successors activities to have the same "Mode Id" as their predecessors, if anyone of the predecessors has a particular "Mode Id".

    I got " Expecting a tuple type, found int." error for the red part of the code.

    Here's the part of the model that concerns:

    1. tuple Activity {
    2.   key int     id;
    3.   string  name;
    4.   {int}       succs;
    5.   }
    6. {Activity} Activities = ...;
    7.  
    8. tuple Mode {
    9.   key int activityId;
    10.   key int id;
    11.   int Accomplishment;
    12.   int pt;
    13.   int dmdRenewable [RRs];
    14.   int dmdNonRenewable[NRs];
    15.   }
    16. {Mode} Modes = ...;
    17.  
    18. subject to {

    19. forall (a1 in Activities, a2 in a1.succs)
          forall ( m1, m2 in Modes : m1.activityId==a1.id && m2.activityId==a2.id &&  m1.Accomplishment=="Mode Id" )
             m2.Accomplishment=="same Mode Id";
    20. }

    I got the same error " Expecting a tuple type, found int." after simplification :

    1.   forall (a1 in Activities, a2 in a1.succs)
          forall ( m1 in Modes : m1.activityId==a1.id && m1.Accomplishment==0 )
            forall ( m2 in Modes : m2.activityId==a2.id)
              m2.Accomplishment==0;

    #DecisionOptimization
    #OPLusingCPOptimizer


  • 2.  Re: "Expecting a tuple type, found int" Error

    Posted 10/30/18 04:46 AM

    Originally posted by: FredericDelhoume


    I am no expert but it looks like in first line :

    a2 in a1.succs

    gives that a2 is an int (succs is a set of ints)

    So calling a2.id asks for a member of a tuple but applies to an int, hence the error.

     


    #DecisionOptimization
    #OPLusingCPOptimizer


  • 3.  Re: "Expecting a tuple type, found int" Error

    Posted 10/30/18 06:51 AM

    Originally posted by: Mahmoud Fayek


    any idea to go around it ?!!


    #DecisionOptimization
    #OPLusingCPOptimizer


  • 4.  Re: "Expecting a tuple type, found int" Error

    Posted 10/30/18 06:55 AM

    Originally posted by: FredericDelhoume


    Maybe

    forall ( m2 in Modes : m2.activityId==a2)

     

    but I am not sure at all. At least both should be the same int type.


    #DecisionOptimization
    #OPLusingCPOptimizer


  • 5.  Re: "Expecting a tuple type, found int" Error

    Posted 10/30/18 07:00 AM

    Originally posted by: Mahmoud Fayek


    Thank you very much for your help.
    I have no error message now.
    hopefully, it will work well after running the whole model.


    #DecisionOptimization
    #OPLusingCPOptimizer


  • 6.  Re: "Expecting a tuple type, found int" Error

    Posted 11/07/18 06:14 AM

    Originally posted by: Mahmoud Fayek


    I have shared the complete .dat and .mod files of my model seeking help, after a long time, a lot of questions, and search trying to figure it out by myself.

    I would be more than grateful if you can take a look.
    https://www.ibm.com/developerworks/community/forums/html/topic?id=83707767-1e4b-4168-a431-4a3bf400b234

    Thanks again for your consideration and generous help.

    Respectfully,
    Fayek


    #DecisionOptimization
    #OPLusingCPOptimizer