53
Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

  • View
    218

  • Download
    3

Embed Size (px)

Citation preview

Page 1: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney

CP 2010, 522—536

Presented by Heath Roehr

Page 2: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

The G12 Platform Zinc: Constraint Modeling Language

The G12 IDE Modeling Layer: Meet-Pass Scenario Solving Layer Visualization Layer

Debugging with the G12 IDE Conclusion & Questions

HEATH ROEHR 2

Page 3: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

• Software platform for solving large-scale combinatorial optimization problems

• Supports • Linear & mixed integer programming• Constraint propagation & inference ┼ A variety of other search & inference

techniques for solving complex problems

3HEATH ROEHR

Page 4: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

• Zinc is a first-order functional language with simple, declarative semantics

• Modeling languages separate the constraint model from the constraint program

• It provides• Mathematical notation-like syntax

• Expressive constraints (finite domain and integer, set and linear arithmetic)

• Separation of data from model

• High-level data structures and data encapsulation including constrained types

• User defined functions and constraints

HEATH ROEHR 4

Page 5: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

HEATH ROEHR 5

Page 6: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

HEATH ROEHR 6

Page 7: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

•SolvingThe problems are computationally challenging

•Debugging?Remember your homework...

•Conceptualizing & improving searchStaring at code is not really the smartest strategy

7HEATH ROEHR

Page 8: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

8HEATH ROEHR

Page 9: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

9HEATH ROEHR

Page 10: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

HEATH ROEHR 10

Write constraint models in the input languages of G12 (Zinc & MiniZinc)

• Vector-oriented drawing tool • Associated script editor to

build custom animations

Page 11: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

HEATH ROEHR 11

MEET-PASS SCENARIO• Five sectors of railway track, S1,

. . . S5, are linearly connected• There is a siding accessible

from S3 big enough to hold one train

• Initially, there are trains in sectors S1, S2 and S4

S1 S2

S3 S4 S5

• The safety rules are that • No two trains may be in the

same sector at the same time• No train may enter a sector

occupied by another train, even if that other train is about to move on

• Trains may only move to adjacent sectors, of course

Constraints

Siding

Page 12: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

HEATH ROEHR 12

MEET-PASS SCENARIO

• Find the shortest plan that moves the train on S1 to S5 and returns the other two trains to their starting positions.

Initial

Goal

Page 13: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

HEATH ROEHR 13

Step 0

MEET-PASS SCENARIO: A POSSIBLE SOLUTION

Page 14: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

HEATH ROEHR 14

Step 1

MEET-PASS SCENARIO: A POSSIBLE SOLUTION

Page 15: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

HEATH ROEHR 15

Step 2

MEET-PASS SCENARIO: A POSSIBLE SOLUTION

Page 16: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

HEATH ROEHR 16

Step 3

MEET-PASS SCENARIO: A POSSIBLE SOLUTION

Page 17: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

HEATH ROEHR 17

Step 4

MEET-PASS SCENARIO: A POSSIBLE SOLUTION

Page 18: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

HEATH ROEHR 18

Step 5

MEET-PASS SCENARIO: A POSSIBLE SOLUTION

Page 19: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

HEATH ROEHR 19

Step 6

MEET-PASS SCENARIO: A POSSIBLE SOLUTION

Page 20: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

HEATH ROEHR 20

Step 7

MEET-PASS SCENARIO: A POSSIBLE SOLUTION

Page 21: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

HEATH ROEHR 21

Step 8

MEET-PASS SCENARIO: A POSSIBLE SOLUTION

Page 22: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

HEATH ROEHR 22

Step 9

MEET-PASS SCENARIO: A POSSIBLE SOLUTION

Page 23: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

HEATH ROEHR 23

Step 10

MEET-PASS SCENARIO: A POSSIBLE SOLUTION

Page 24: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

HEATH ROEHR 24

Step 11

MEET-PASS SCENARIO: A POSSIBLE SOLUTION

Page 25: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

HEATH ROEHR 25

Step 12

MEET-PASS SCENARIO: A POSSIBLE SOLUTION

Page 26: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

HEATH ROEHR 26

Step 13

MEET-PASS SCENARIO: A POSSIBLE SOLUTION

Page 27: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

HEATH ROEHR 27

Step 14

MEET-PASS SCENARIO: A POSSIBLE SOLUTION

Page 28: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

HEATH ROEHR 28

Step 15

MEET-PASS SCENARIO: A POSSIBLE SOLUTION

Page 29: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

HEATH ROEHR 29

Step 16

MEET-PASS SCENARIO: A POSSIBLE SOLUTION

Page 30: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

HEATH ROEHR 30

Step 17

MEET-PASS SCENARIO: A POSSIBLE SOLUTION

Page 31: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

HEATH ROEHR 31

Step 18: Solution Found

MEET-PASS SCENARIO: A POSSIBLE SOLUTION

Page 32: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

HEATH ROEHR 32

ZINC EDITOR: MEET-PASS IMPLEMENTATION • Five sectors of railway

track, S1, . . . S5, are linearly connected

• There is a siding accessible from S3 big enough to hold one train• Initially, there are trains in sectors S1, S2 and S4• Move the train on S1 to S5 and return the other two trains to their starting positions.

Page 33: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

HEATH ROEHR 33

ZINC EDITOR: MEET-PASS IMPLEMENTATION

• Safety rules• Specific

implementation is outside the scope of this talk

• Assume they are accurate and valid

• Execute the search

Page 34: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

HEATH ROEHR 34

ZINC EDITOR: MEET-PASS IMPLEMENTATION

Variable Declaration

Constraints

Variable Definition

Page 35: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

HEATH ROEHR 35

ZINC EDITOR: SCREENSHOT

Syntax highlighting

Project-based code management

Outline views

Page 36: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

HEATH ROEHR 36

VISUALIZATION EDITOR

• Define arbitrary visualizations• Vector-based graphics editor• Script editor

• Scripting language• Any language that supports java

integration• Python• Lisp

• Default language is Lua• Lightweight• Portable• Suited for animation: used in video games

Page 37: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

HEATH ROEHR 37

VISUALIZATION EDITOR

Vector-based graphics editorGraphics properties editor

Project-based code management

Page 38: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

HEATH ROEHR 38

VISUALIZATION EDITOR• g12GetFromData(var)

• This method fetches the current contents of the decision variable var and makes its value available to the script.

• g12Draw(obj, props)• This method sets a list of properties, props, for object obj, where props may contain items such as the object’s positions on the canvas, color, opacity, scaling factor, etc.

Written in Java

Written in Lua

Page 39: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

HEATH ROEHR 39

The actual solver

Control the starting & stopping of the solving process

Collect detailed information about the solving process

Page 40: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

HEATH ROEHR 40

XML-based messaging

Separate Processes

Page 41: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

HEATH ROEHR 41

Build & display a constraint graphBuild & display a search tree

Render visualization based on custom animation script

Pre-defined visualizations

Page 42: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

HEATH ROEHR 42

Constraint Graph

Search Tree

Sample Pre-Defined Visualizations

Collapsed sub treeDomain split

Page 43: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

HEATH ROEHR 43

Page 44: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

HEATH ROEHR 44

Page 45: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

HEATH ROEHR 45

HOW IS DEBUGGING DIFFERENT IN THE G12 IDE?

Page 46: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

HEATH ROEHR 46

USER DEFINED BREAKPOINT VIEW

User defined breakpoints

“Search Events”(Events that induce the breakpoint)

The breakpoint “subscribes” to these search eventsEnable/disable breakpoints

Page 47: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

HEATH ROEHR 47

Page 48: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

HEATH ROEHR 48

• Accomplished by • drawing objects• binding their animation to events that fire

during program execution

• Debugging is happening• At the conceptual level• Graphically: Domain-specific

CUSTOM VISUALIZATION AND ANIMATION

Page 49: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

HEATH ROEHR 49

“MEET-PASS” EXAMPLE

Propagation should deduce the position of the train…

Original formulation failed to deduce correctly, identifying an incorrect constraint model…

Page 50: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

• IDEs tailored to CSP solving• ECLiPSE CLP

• Draw charts and graphs for solver output

• ILOG OPL Studio• Offers a search-tree view similar to that of the G12 IDE

• Choco• Java based visualizations from scratch

• Vector-based graphics processing programs• Most are more advanced than G12’s graphics

processor

• Using a custom visualization tool that is tightly integrated with debugging facilities is novel

HEATH ROEHR 50

RELATED WORK

Page 51: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

HEATH ROEHR 51

Page 52: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

HEATH ROEHR 52

• G12 IDE redefines the way users can interact with their solving CSPs

• Users• Can not only view classic CSP visualizations (such as

search tress)• They can also customize animations straight from

the IDE• G12 IDE Allows users to

• Update their constraint definitions & solver logic on the fly

• Based on feedback from the event-driven debugger & real-time visualizations

Page 53: Andreas Bauer, Viorica Botea, Mark Brown, Matt Gray, Daniel Harabor & John Slaney CP 2010, 522—536 Presented by Heath Roehr

HEATH ROEHR 53