Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Tuple in concert with C++

    Posted 07/23/13 07:41 AM

    Originally posted by: ostaz


    Hi everyone,

    In OPL, it is possible to declare a tuple of data, like this

    tuple link{

    int Origin;

    int Destination;

    };

    {link} Links=...;

    and then use an identifier l for Links in expressions, such that

    for (l in Links)

        do_something (l.origin, l.destination);

     

    Is it possible to do such declaration  with Concert /C++ ?

    Thanks in advance


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Tuple in concert with C++

    Posted 07/23/13 04:09 PM

    Yes, but it does not involve anything from Concert; you just need to use some container classes from the Standard Template Library.

    Paul


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Tuple in concert with C++

    Posted 07/23/13 05:30 PM

    Originally posted by: ostaz


    Thanks Paul. You mean that it is only related to C++


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Tuple in concert with C++

    Posted 07/23/13 05:52 PM

    Yes. In Java I would use a custom class to represent tuples, or maybe a third-party library, or maybe just a length two vector. (Java does not have a native tuples class.) For the set of links, I'd use a HashSet<my tuple class>. I've long since forgotten what container classes the C++ STL has, but I'm sure it has sets, and it may well have a Pair class.

    Paul


    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Tuple in concert with C++

    Posted 07/24/13 02:06 AM

    Originally posted by: ostaz


    Many thaks for your valuable advice

    Sincerely yours


    #CPLEXOptimizers
    #DecisionOptimization