Solved

# Subset creation/formulation

• 164 views

• Newcomer
• 0 replies

Hello all,

I am trying to create a subset of a main set for a constraint. See the attached figure of the constraint*. The index k should be a subset of its set. The main set consists for example of three classes {1,2,3}, then its subset should consist be{1,2}, so the main (ordered) set minus the last element, as it is used in the constraint by (k+1) on the right-hand side. Can anybody help me out how to formulate this?

* I am aware on the non-linearity

icon

Best answer by gdiepen 5 October 2020, 10:38

View original

Userlevel 5
+7

Hi Thijs,

what you are looking for is the | operator (such-that operator), which allows you to limit the range of an index.

In your constraint, you could set the domain condition to:

(k,t) | ord(k) < card(k)

(In plain english: all combinations of k,t  such that the ordinal value (position in the set) of index k is strictly smaller than the cardinality of the total set (the total size of the set that k belongs to).