L04: Sets Flashcards

1
Q

Can we have a combined representation?

A
  • Obviously, can have combinations of the two representations (e.g. OA, OB and EC)
  • For example the intersection of two occurrence representations is an explicit representation
  • Constraints on original sets have to be modelled appropriately
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How can we derive a finite domain from an infinite domain for the GRP?

A

It is possible to generate one feasible solution
- 0, 1, 3, 7, 15, …, (2^n) -1

So every tick must be between 0 and (2^n) -1

We can then modify the model:
- Given a positive integer n
- Find a set of n integer ticks on a ruler, each within 0.. (2^n)-1
- Such that all inter-tick distances are distinct
- Minimising the maximum tick distance

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How can we use explicit representation for a bounded-cardinality set without switches?

A

Instead of using a switches array, we can use a marker.
The marker is a variable that indicates the last index at which an element of the set appears, usually a 0.

The values at all the indexes AFTER THE MARKER will be 0.

Constraints:
- For i in 1..n-1. i+1 ≤ marker -> E[I] < E[i+1]
- For i in 1..n. i > marker -> E[I] = 0
- Sum(E) = s

These constraints say that if the index is less than the marker, then the value is valid (in the part of the array that is valid), this removes the equivalence classes.
Otherwise, we are in the area of the set that is unused, and so the value is assigned to 0.
Again the sum remains unchanged with this representation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are some constraints on sets?

A
  • Intersection
  • Union
  • Subsets
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What constraint we can use to remove equivalence for explicit representation for a fixed cardinality set?

A
  • We can choose a canonical element from each class
  • The obvious choose is to require an ascending order (all elements must be in ascending order)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a fixed-cardinality set?

A
  • Given n and s
  • Find a set of n digits that sum to s.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a set?

A
  • A collection of distinct objects (no repetition)
  • Not arranged in any particular order
  • Uses bracket notation
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is an occurrence bounded-cardinality set?

A
  • Given n and s
  • Find a set of at most n digits that sum to s

Constraints:
- Sum(O) <= n
- O[1] + 2O[2] + 3O[3] + … + 9O[9] = s

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is an explicit bounded-cardinality set?

A
  • Given n and s
  • Find a set of at most n digits that sum to s.

Constraints:
- The switches are in non-ascending order (push 0s to the end)
- For i in 1..n-1
Switches[i+1] ≠ 0 -> E[i] < E[i+1]
- For i in 1..n
Switches[i] = 0 -> E[i] = 0
- Sum(E) = s

Explanation:
We are adding a new array of variables (switches) that are 0 or 1 depending on whether the corresponding index in the set is ‘active’ (whether or not the variable is used in the set). This is because we have a bounded-cardinality set and so we do not know if all the decision variables in the set will be assigned. In this sense, all the ones in the switches array will be at the start and any 0s will be at the end.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is decomposition in the context of complex constraints?

A

Complex constraints can be decomposed to simple
constraints, each of which has at most one operator and
possibly one equality sign.
For example
- (A U B) ⊆(C ∩ D)

Can be decomposed into three constraints
- X = A U B
- Y = C ∩ D
- X ⊆ Y

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is occurrence representation in fixed-cardinality sets?

A
  • Given n and s
  • Find a set of n digits that sum to s.

Introduce O, an array of decision variables indexed by x (defined domain) where the domain for each variable is {0,1}

Constraints:
- Sum(O) = n (get size of set)
- O[1] + 2O[2] + 3O[3] + … + 9O[9] = s (get sum of set)

This representation does not introduce an equivalence class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is explicit representation in fixed cardinality sets?

A
  • Given n and s
  • Find a set of n digits that sum to s.

Introduce an array E of decision variables indexed 0-n where the domain of each is x (defined domain)

The constraints are:
- AllDifferent(E)
- Sum(E) = s

This representation introduces an equivalence class of assignments

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the explicit representation of a subset?

A

Model A ⊆ B
- B is a set of digits

E.g. if the cardinality is 5
- EA, EB will be indexed 1-5 and the domain is 1-n.

We can then use a switch array or a marker:
Using a switch:
- For i in 1..5 . If SA = 1, then EA[i] exists at some index in
EB

Using a marker:
- For i in 1..5 . If i ≤ marker then EA[i] exists at some index in EB

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the explicit representation of set intersection?

A

Model A ∩ B = C
- A, B are sets of digits
- We have an array C which tells us the values from A and B that intersect
- A AND B

E.g. if the cardinality is 5
- EA, EB will be indexed 1-5 and the domain is 1-n.
- EC will also be indexed 1-5 as there is a maximum of 5 intersecting values
- If there is a value in A AND B, the value will be stored somewhere in EC
- We need to check vice-versa: if there is a value in EC, then it must also appear in EA AND EB
- We need this constraint for the solver to work correctly

We can then use a switch array or a marker to indicate which if the indices are unused (when not all the values intersect).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the explicit representation of set union?

A

Model A U B = C
- A, B are sets of digits
- We have an array C which tells us the union of values from A and B
- A OR B

E.g. if the cardinality is 5
- EA, EB will be indexed 1-5 and the domain is 1-n.
- EC will also be indexed 1-10 as there is a maximum of 10 union values
- If there is a value in A OR B, the value will be stored somewhere in EC
- We need to check vice-versa: if there is a value in EC, then it must also appear in EA OR EB
- We need this constraint for the solver to work correctly

We can then use a switch array or a marker to indicate which if the indices are unused (when not all the values in either A or B are used).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the Golomb Ruler Problem (GRP)?

A
  • Given a positive integer n
  • Find a set of n integer ticks on a ruler
  • Such that all inter-tick distances are distinct
  • Minimising the maximum tick distance
15
Q

What is the occurrence representation for set union?

A

Model A U B = C
- A, B are sets of digits
- We have an an array C to represent the union of values in A, B
- A OR B

E.g. if the cardinality is 5
- Each set will be indexed from 0-n and there should be 5 1s
- If both A and B have a cardinality of 5, then the sum of union values will be:
sum <= 10

Constraint:
- OC[i] = (OA[i] = 1 V OB[i] = 1) (for each i in 0..9)
or
- OC[i] = max(OA[i], OB[i]) (for each i in 0..9)

16
Q

What is the occurrence representation of a subset?

A

Model A ⊆ B.
- B is a set of digits

E.g. B has a cardinality of 5 (5 values)
-Each set will be indexed from 0-n and there should be 5 1s

Subset constraints:
- OA[i] <= OB[i] (foreach i in 0..9)
- For every index of A, the value of the index is less than or equal to the value of the same index in B.

This means that for every value in B, the same value can be in A or not present at all.
Vice-versa, for every value in A, the value must be in B

17
Q

What is the occurrence representation of set intersection?

A

Model A ∩ B = C
- A, B are sets of digits
- We have an an array C to represent which values intersect
- A AND B

E.g. if the cardinality is 5
- Each set will be indexed from 0-n and there should be 5 1s
- If both A and B have a cardinality of 5, then the sum of intersecting values will be:
sum <= 5

Constraint:
- OC[i] = OA[i] x OB[i] (for each i in 0..n)
- If either of the elements are 0, then the value in C will be zero (same as bit AND operation)

18
Q

What kind of representation is ideal for the GRP?

A

The constraints need direct access to the values of the set.
As we know that the values are in ascending order, we can exploit this in our model

Our objective is to minimise the maximum tick- again we can exploit ascending order to find the suitable assignments

19
Q

When would we use explicit representation over occurrence representation?

A

If we want to compare the values of adjacent variables (we are concerned about the position within the set), then we would use explicit representation

20
Q

When would we use occurrence representation over explicit representation?

A

If we want to check the presence of variables

E.g. if a constraint is: “If 5 is in the set then so is 4”

Then we can check:
(O[5] = 1) -> (O[4] = 1)

This is easier than checking the value for each index