1
votes

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?

so as said,ultimately i want three sets with the first four items being assigned to buyeroperations, items 5-7 being assigned to supplieroperations and then a set operations regarding all of them.

thank you for any help in advance.

1

1 Answers

1
votes

I would separate out the model and data file to make things easier. In the model file, I will have:

{int} buyeroperations = ...;
{int} supplieroperations = ...;
{int} operations = buyeroperations union supplieroperations;

In the data file, I will have:

buyeroperations = [1,2,3,4] // same as [1..4]
supplieroperations = [5,6,7] // same as [5..7]

If there is a lot of data, the best way to initialize sets is with a database. What you showed should work as well.