Docsity

Nested Types in Constraint Programming: Representing Sets, Functions, and Relations, Study notes of Computer Numerical Control

Partial preview of the text

Download Nested Types in Constraint Programming: Representing Sets, Functions, and Relations and more Study notes Computer Numerical Control in PDF only on Docsity!

Alan M. Frisch Artificial Intelligence Group Department of Computer Science University of York

Modelling with Constraints

Formulating Concrete Models: 2

Constraint Programming Last updated: 3 December 2010 Ian Miguel School of Computing University of St Andrews

Recap

  • We have seen how abstract constraint models can be reformulated as concrete constraint models that are equivalent in a certain sense.
  • The reformulation is driven by the types. The types we have considered so far are - sequences of τ, including permutations - sets of τ, multisets of τ - relations on τ τ - functions on from τ1 to τ 2 , including surjective, injective and bijective functions where T is atomic (Boolean or integer).

Basic Idea

  • A set of integers is represented by a 1-dimensional array.
  • So a set of sets of integers is represented by a 1-dimensional array in which each element is a 1-dimensional array --- that is, a 2-dimensional array.
  • So the basic process is to combine the representations we have seen so far.

Nesting

Abstract Models Often Employ

Nested Types

  • Planning Problems:
    • Find a sequence of actions to transform an initial state into a goal state.
  • When a planning problem allows

actions to be performed in parallel in a

single step, it is natural to characterise it

as a sequence of sets of actions.

Abstract Models Often Employ

Nested Types

  • Example: The Gripper Problem Room A Room B Robby left right 1 2 3 4
  • Goal : All balls in Room B.
  • Operators : pick up, put down, move.

10

Abstract Models Often Employ

Nested Types

  • Example: The Gripper Problem Room A Room B Robby left right 1 2 3 4
  • When Robby moves, he can’t pick

up/put down.

  • So at most 2 actions per step.

Abstract Models Often Employ

Nested Types

  • Example: The Gripper Problem Room A Room B Robby left right 1 2 3 4
  • Natural to characterise this problem

as finding a sequence of sets of

maximum cardinality 2.

Abstract Models Often Employ

Nested Types

  • Example: Steel Mill Slab Design (CSPLib 38).
  • Capacity:
    • Total weight of orders assigned to a slab cannot exceed slab capacity.
  • Colour:
    • Each slab can contain at most p of k total colours.
    • Reason: expensive to cut slabs up to send them to different parts of the mill.

Abstract Models Often Employ

Nested Types

  • Example: Steel Mill Slab Design (CSPLib 38).
  • Slab Sizes: {1, 3, 4} (σ = 3)
  • Orders: {o a , …, o i } ( d = 9)
  • Colours: {red, green, blue, orange, brown} ( k = 5)
  • p = 2 2 3 1 1 1 1 1 2 1 a b c d e f g h i

Abstract Models Often Employ

Nested Types

  • Example: Steel Mill Slab Design (CSPLib 38).
  • A slab can be represented as a set of orders.
  • We must also determine the size of each slab.
  • So this problem can be characterised as a function from sets of orders to the set of sizes.
  • The function is partial , since not all possible sets of orders will be mapped to a slab size.

Nesting Inside Sequences

Nesting Inside Sequences

  • Assume now that we must find a sequence

of sets, functions, relations, …

  • We can no longer use a single variable at

each index to represent the object at that

position.

  • Because 1 variable is not enough to represent our set, function or relation. ???? 1 2 3 4 ? n … NestedSeqArray

Nesting Inside Sequences

  • Simple solution:
    • Extend the dimension of the array. 1 2 3 4 n … NestedSeqArray E.g. 2 dimensions. We now have a column of variables to represent our set, relation, function …