Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
Expand all | Collapse all

set initialization

  • 1.  set initialization

    Posted 06/27/13 09:07 AM

    Originally posted by: adsi


    hello,

     

    i am currently working on establishing a negotiation between a buyer and a supplier on basis of the multi-capacitated lot sizing problem, implemented in cplex.

    in a small scenario, the buyer is producing items 1-4, whereas the supplier is responsible for supplying items 5-7.

    what i want to do is create three sets:

    {int} buyeroperations

    {int} supplieroperations

    {int} operations = buyerops union supplierops

    my question now, as i am fairly new to cplex/opl, is how to initialize the sets with the respective items in order to work with them in my models.

    i guess i could initialize them internally by means of:

    {int} buyeroperations = asSet(1..4) 
    
    {int} supplieroperations = asSet(5..7) 
    
    {int} operations = buyeroperations union supplieroperations
    
     
    am i correct?

    could i however initialize the sets differently via script and a for loop?

    thank you for any help in advance.

     

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: set initialization

    Posted 06/27/13 11:09 AM

    Hi,

     

    let me give you an example:

     

    {int} buyeroperations = asSet(1..4) ;

    {int} supplieroperations = asSet(5..7) ;

    {int} operations = buyeroperations union supplieroperations;

    execute
    {
      buyeroperations.add(10);
      supplieroperations.remove(6);
     writeln(operations);
    }

     

    gives

     {1 2 3 4 10 5 7}

     

    regards

     

    Alex Fleischer

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: set initialization

    Posted 06/27/13 12:36 PM

    Originally posted by: adsi


    hey alex, 

    thanks for your reply.

    in other words,my approach was right?

    Let's assume i have a capacity constraint e.g.:

    //capacity constraint

    for all( j in buyeroperations, t in periods)

          "constraint";

    what i want to achieve is that cplex only applies the constraint to buyeroperations (operations/items 1-4)!

    is that to be realized with my approach?

    thanks for the input!

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: set initialization

    Posted 06/27/13 12:47 PM

    Hi

     

    forall( j in buyeroperations, t in periods)

    will apply the constraints for all  buyeroperations and all t in periods

     

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer