L03: Sequences Flashcards

1
Q

Explain this Essence’ Model:

language ESSENCE’ 1.0

given n : int
find x: matrix indexed by [int(0..n)] of int(0..n)
such that gcc(x, [i | i : int(0..n)], x)

A

This is the Essence’ model for the Magic Sequence
- Given an integer n
- Find a sequence of integers indexed from 0-n, each with a domain of 0-n
- Such that the number of occurrences of i (from all values of i from 0-n) in the sequence x is x[i]

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

How can we build a constraint model for unbounded sequences?

A

We can solve a series of CSPs, incrementally increasing the length of the sequence (if not 1, then 2, then 3, and so on).

This way, we can find the solution with the shortest sequence.

In the worst-case scenario this is an infinite process.

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

How do we know which viewpoint to use?

A

It depends on the constraints of the problem

For example, if the values must be adjacent (consecutive indexes), then the second viewpoint is easier to visualise the solution

For example, if the first 3 variables of the sequence must form an English word, then we just need a table constraint one the first 3 variables, in which case the first viewpoint is easier to understand.

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

What are some types of sequences?

A
  • Fixed-length sequence
  • Bounded-length sequence
  • Unbounded sequence
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are the 5 stages of constraint modelling?

A

Ill-defined problem statement
-> Well-defined problem defined statement
-> Abstract constraint model
-> Solver-independent constraint model
-> Solver-specific constraint model

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

What does constraint modelling do?

A

Constraint modelling maps a well-defined problem statement to a solver-independent constraint model.

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

What does Savile Row do?

A

Savile Row maps a solver-independent constraint model to a solver-specific constraint model.

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

What does the global cardinality constraint (gcc) do?

A

gcc(X, Vals, C)

For each non-decisions expression Vals[i], the number of occurrences of Vals[i] in X equals C[i]

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

What is a permutation?

A

A permutation of a sequence is the ordering of elements in the sequence.

When finding the permutation of a sequence, the elements of the sequence is known but their correct arrangement is not.

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

What is a sequence?

A
  • A sequence is an ordered list of elements
  • Ordered in the sense that a sequence has a first element, second element, etc.
  • Repetition is allowed
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is a viewpoint?

A

A viewpoint is a choice of variables and domains sufficient to characterise the problem

I.e. from a certain assignment of variables, we can derive a solution

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

What is an Abstract Constraint Model?

A

When there are patterns in the problems we want to solve, we can write our abstract constraint model in terms of these patterns.

However these are typically not supported by constraint solvers and so they need to be modelled as constrained collections of more primitive objects.

We can develop corresponding modelling patterns for representing and constraining these combinatorial objects and reduce the effort when modelling a new problem.

When viewed abstractly, many combinatorial problems that we wish to tackle with constraint solving exhibit common features.

Abstractly: above the level at which constraint modelling decisions are made.

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

What is an equivalence class and how are they created and avoided?

A

An equivalence class is a set of assignments that have the same value or will be interpreted the same.

Equivalence classes can be created when dummy values are used.

We can avoid equivalence classes by placing constraints on the dummy variables, for example if we are using 0 as the dummy variable (therefore is not in the domain), then all 0s must appear at the end of the sequence.

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

What is the first viewpoint of permutations?

A

Assume all the elements of the permutation are distinct
First viewpoint is as fixed-length

Sequence is indexed 1-n, and the domain is represented as alphabetical letters

E.g. if the index is 1-6, then the domain for each decision variable is a-f

We are assigning a value to each index

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

What is the problem with infinite domains in constraint modelling?

A

With infinite domains in the abstract specification, it will not be possible to map the abstract constraint specification down to a finite-domain CSP.

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

What is the purpose of a dummy variable?

A

A dummy value in the domain is used to show that the variable in a bounded-length sequence is not used (not all the decision variables in a bounded-length sequence need to be assigned).

17
Q

What is the purpose of having different viewpoints?

A

The permutations of a sequence in different viewpoints solve the same problem, however one viewpoint may make the problem harder/easier to solve.

18
Q

What is the second viewpoints of permutations?

A

We know the elements that appear in the sequence

We can use alphabetical characters to index the sequence

E.g. for a sequence of 6 elements indexed a-f, each decision variable has a domain of 1-6

The domain variables represent the position in the sequence the element is in.

Rather than assigning a value to an index, we are assigning an index to a value.

19
Q

What is the significance of patterns in Abstract Constraint Modelling?

A

When we look at a number of individual patterns, we can see how these patterns can be combined to solve more complex problems.

20
Q

What is the skeleton for modelling a bounded-length sequence?

A
  • Given n
  • Find a sequence of objects of a length of at most n
  • Such that …
21
Q

What is the skeleton for modelling a fixed-length sequence?

A
  • Given n
  • Find a sequence of objects of length n
  • Such that …
22
Q

What is the skeleton for modelling an unbounded sequence?

A

As unbounded sequences have infinite domains, it is not possible to build a constraint model for a CSP.

23
Q

What skeleton do we use when writing Abstract Constraint Models?

A
  • Given the parameters
  • Find decision variables
  • Such that the constraints are satisfied

We have a much richer set of decision variables:
- sequence
- set
- multiset

Constraints and objective functions are usually operators on these types of objects:
- set union
- membership of a set/relation
- function application