Skip to main content

Hello everybody,

I have a little question regarding an optimization problem. In the problem I define my binary variables by use of two sets (matrix). Rows: Set 1, Columns: Set 2.

The first set contains different parts (Set1 contains: Part 1, Part 2, Part 3… and so on)

The second set contains different variants for each part (Set 2 contains: Version 1, Version 2, Version 3 and so on).

The definition of the indices is no problem. Later in the model I want to use not the whole Matrix (Set1 X Set2) but just a Single vector. For example the vector should have the size of Set 1, and of Set 2 just the colum Version 2. So in the constraint I just want to use the yellow colum. Is this possible or do I have to define for every Element of Set 2 an own Set?

 

 

Hi @Simon Küter. You can define sets using a set expression (as long as the definition attribute of the set is empty or uses initial data). So you can use something like:

 

Set2 := { Version1 };

solve MP;

Set2 := { Version2 };

solve MP;

 

The supported set expressions are described here. (Set2 might be a subset of some other set containing all possible versions.)


Hi @Marcel Hunting ,

thanks again for your help!!

I guess my best choice is to create In the Set 2 the Subsets (Version1, Version2, Version3). This elements of the set are fixed and do not change.

In a constraint I wand to do a skalar vector mulitplication. Until now I did a summation of the whole matrix like sum((Set1, Set2) Variables(Set1,Set2)*Parameter(Set1,Set2)).

Now I want to rebuild that Formula. like.

sum((Set1,Version2)Variables(Set1,Version2)*Parameter(Set1,Version2)) - do I have to define each header of the colums as as Subset or can I use the name of the colums to use the values below?


I think the best approach would be to create a superset of Set2 containing the power set of (Version1, Version2, Version3), and then define Set2 using set expressions. Then there is no need to adjust expression

 

sum((Set1, Set2) Variables(Set1,Set2)*Parameter(Set1,Set2)).

 

because the contents of Set2 is defined by a set expression:

 

Set2 := { Version2 };

sum((Set1, Set2) Variables(Set1,Set2)*Parameter(Set1,Set2)).

 

This sum will be evaluated for elements in Version2 only.


Hi @Simon Küter,

Just wanted to check back - did you find the help you needed in this thread, or maybe you found another solution you could share with us? Thank you so much!:)


Reply


Didn't find what you were looking for? Try searching on our documentation pages:

AIMMS Developer & PRO | AIMMS How-To | AIMMS SC Navigator