L05: Multisets Flashcards

1
Q

What is the occurrence model for the Golomb Ruler Problem?

A
  • In our explicit model, we could create a set with 2^n - 1 elements
  • Invoking our occurrence representation pattern, we begin with an array O indexed 0..2^n - 1
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How can we express the distinct distances constraint for the occurrence model of the Golomb Ruler Problem?

A
  • Bit shifting
  • We can consider an array O1, which contains the same variables as O, shifted 1 position right
  • That means that O[0] is O1[1]
  • We can then assign the variables such that the scalar vector of the arrays is 1
  • By shifting the array by 1, we can determine how many ticks have a distance of 1 (hence why we want the scalar product to only be one)
  • We can then get the scalar product for a shift of 2, 3, 4, etc, until we have a scalar product of 1 for each
  • This will give us unique ticks for each value, and the solution will be optimal (minimising the maximum length of the ruler for a given n)
  • This does not introduce new variables, it just re-uses existing variables in new arrays
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a multiset?

A
  • A collection of distinct objects
  • Repetition is allowed
  • Elements are not arranges in any particular order
  • E.g. {1, 2, 3, 1}
  • E.g. {red, green, blue, green, red}
  • Characterised by the number of times each object occurs in the multiset
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the domain of a set?

A
  • Sets have a finite size as all the elements can only appear once
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the domain of a multiset?

A
  • The domain is infinite (if the domain S is non-empty)
  • If S = {1}, then the multiset of S = {{}, {1}, {1, 1}, {1 ,1, 1}, …}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How can we bound the number of elements in a multiset?

A

To ensure that the length of a multiset is finite, we do either of the following:
- Limit the total number of elements in the set (cardinality of the set)
- Bound the number of occurrences of each value

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

What is the explicit fixed-cardinality representation of a multiset?

A
  • Explicit fixed-cardinality: find a multiset of n digits
  • We can have an array indexed 1..n where the domain of each variable is 0..9 (for this example)
  • We do not apply the AllDifferent constraint
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How do we remove equivalence classes in a multiset?

A

We can order the set in an ascending order, but use the operator <= as we can have more than one of the same element

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

What is the occurrence representation of a multiset?

A
  • We use the same representation for both fixed- and bounded-cardinality sets
  • Find a multiset of n (or at most n) digits
  • We have an array indexed by our domain (in this example 0..9), with the domain for each variable being 0..n (as each variable in the multiset can appear multiple times)
  • Fixed-cardinality n: Sum is n
  • Bounded-cardinality: Sum is at most n
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the explicit bounded-cardinality representation of a multiset?

A
  • Explicit bounded-cardinality: find a multiset of at most n digits
  • We have an array indexed 1..n where the domain of each variable is 0..9 (for this example)
  • We also have a switch array indexed 1..n where the domain of each variable is 0/1 (or we can use a marker variable)
  • As this is a bounded-cardinality multiset, we need to know which values are unused
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is a relation?

A
  • Assigns truth values to tuples of values
  • In this sense, constraints are relations that are true

Examples
- Set P is {Bill, Bert, Tom}
- Binary relation ‘likes’ on PxP might assign:
- <Bill, Bert>, <Bert, Tom> true
- Bill likes Bert, Bert likes Tom
- All other combinations are false

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

What is the occurrence representation of a relation?

A

Find a relation R between the sets
- A = {1, 2, 3}
- B = {2, 3, 4}
such that each element of A is related to at least one element of B

We can draw a table with the heading as the values of A and B
The value in each cell of the table is 0/1, depending on whether the tuple is false/true

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

What is the projection of a relation?

A
  • A common operation on relations
  • We project a relation onto 1 or more of its arguments to result in a relation with a reduced arity

Example:
- Set P is {Bill, Bert, Tom}.
- Relation likes on P x P = {<Bill, Bert>, <Bert, Tom>, <Bert, Bill>}.
- Project likes onto Bert (first position): {Tom, Bill}

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

How can we find a relation R between sets
A = {1, 2, 3} and B = {2, 3, 4}
such that each element of A is related to at least one element of B

A

To fulfil this constraint, we can look at the table and do a summation of each row (where we see all the relations for each value of A) and if it is >= 1, then there is at least one relation for that element of A

The projection of R onto each element of A has a size of at least 1

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

How do we use a occurrence representation for k-ary relations?

A

We use a k-dimensional matrices

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

What is an alternate way of representing a relation?

A

Consider binary case, AxB
(A = {1, 2, 3}, B = {2, 3, 4})

Introduce a matrix indexed by elements of A and by 1 .. |B|
Might refer to this as the semi-explicit representation

  • For each cell, the domain is {0, 2, 3, 4} to represent a relation for each element of A
  • The 0 is used if there are no or no more relations for that element of A
  • The 0 is used as the number of relations is not fixed but bounded
  • The constraints to apply to this matrix is AllDifferent for each row (except for 0s)
  • We can say that the relations represented (if any) must be in ascending order with any 0s pushed to the end