Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  splitting a set into 2 subset using CPLEX

    Posted 05/06/20 09:19 AM
    Hi everyone
    I'm now in CPLEX and have a problem with splitting a set into 2 subset.
    I have P = 1..15 which should be split up so e.g. N = { 1,6,14 } M = { 2,3,4,5,7,8,9,10,11,12,13,15} .
    In the model I want to refer to both P,N and M.
    Can any help me with the problem?
    Is there maybe an example in CPLEX where I can find the solution?

    Thanks in advance.
    Baldur


    ------------------------------
    Baldur Jonsson
    ------------------------------

    #DecisionOptimization


  • 2.  RE: splitting a set into 2 subset using CPLEX

    Posted 05/06/20 09:34 AM
    Could you please clarify two things:
    1. What programming API are you using? Or are you using OPL?
    2. What is the criterion for numbers to go into N or M?


    ------------------------------
    Daniel Junglas
    ------------------------------



  • 3.  RE: splitting a set into 2 subset using CPLEX

    Posted 05/06/20 10:04 AM
    Thanks for the reply,
    Im using OPL and P is for shipping ports, N for supplying ports and M for receiving ports.


    ------------------------------
    Baldur Jonsson
    ------------------------------



  • 4.  RE: splitting a set into 2 subset using CPLEX

    Posted 05/06/20 10:41 AM
    Hi

    {int} P = asSet(1..15);
     {int} N = {1,6,14};
     
     {int} M=P diff N;
     
     execute
     {
       writeln(M);
     }​


    gives

    {2 3 4 5 7 8 9 10 11 12 13 15}


    ------------------------------
    ALEX FLEISCHER
    ------------------------------