Transcript
Page 1: 1 EUROPA An open source platform for Planning, Scheduling and Constraint Programming Javier Barreiro

1

EUROPA

An open source platform for Planning, Scheduling

and Constraint Programming

Javier Barreiro

Page 2: 1 EUROPA An open source platform for Planning, Scheduling and Constraint Programming Javier Barreiro

2

Talk Outline

EUROPA Overview

Brief History Overview of EUROPA architecture and modules

What's new in EUROPA 2.1

Client Interface Interpreted NDDL Constraint Violation reporting UI components Open source release and EUROPA portal

What's next for EUROPA

Road Map Using / Contributing to EUROPA

Page 3: 1 EUROPA An open source platform for Planning, Scheduling and Constraint Programming Javier Barreiro

3

EUROPA – Brief History Timeline

• HSTS (1998) - Initial DDL and planning paradigm.

• RAX (1999) – first deployment

• EUROPA (2002) - Initial implementation of current approach

• EUROPA 2 (2005) - Modular architecture, more robust implementation

• EUROPA 2.1 (2007) - Open source, architecture evolution.

Project Sample• Science activity planning

• Airborne observatory SOFIA • Remote Agent Experiment (RAX)• Mars Exploration Rovers(MER)• Phoenix Mars Mission.

• Power Systems Control of the International Space Station through the Solar Array Constraint Engine (SACE).

• Planning and scheduling support for experiments • Life in the Atacama (LITA)• Bed Rest study.

Page 4: 1 EUROPA An open source platform for Planning, Scheduling and Constraint Programming Javier Barreiro

4

EUROPA - Overview

• EUROPA can be used to model and solve problems in :

• Constraint Satisfaction : See Nqueens example

• Scheduling : See RCPSP Example

• Planning : See Rover Example

• Combinatorial Optimization

• Typical EUROPA workflow :

• Model Problem

• Create/Invoke Solver

• Modify problem, iterate.

• Embed model/solver into larger application

• See Light Switch Example

Page 5: 1 EUROPA An open source platform for Planning, Scheduling and Constraint Programming Javier Barreiro

5

EUROPA - Overview

Constraint

Engine

Plan

Database

Rules

Engine

Modeling

Languages

NDDLANML

...

ResourcesTemporal Network

Solver

Client APIC++ Java ...

Plan Works PSUI User Apps

Page 6: 1 EUROPA An open source platform for Planning, Scheduling and Constraint Programming Javier Barreiro

6

Constraint Engine

• Domains• int,float,bool,string,object

• Enumeration, Range

• Variables• Have base and current domain

• Constraints• Built-in constraint library (42

constraints, see EUROPA portal)

• Constraint Propagation• Each constraint has a

propagator

• Constraint Engine allows propagators to perform domain reduction

NDDL

// Domains

typedef int [0 8] Queen;

typedef double [0.0 100.0] myRange;

// Variables

Queen q1,q2, ... , q8;

// Constraints

neq(q1,q2);

allDiff(q1,q2, ... , q8);

Page 7: 1 EUROPA An open source platform for Planning, Scheduling and Constraint Programming Javier Barreiro

7

Plan Database• Classes

• Inheritance

• Constructor

• Objects

• Contain Tokens, Variables, other objects

• Tokens

• Object-scoped

• Temporal entities (start, end, duration). Typically represent activities or states.

• Variables

• Object attribute

• Token parameter

• Global variable

NDDL

class LightSwitch extends Timeline

{

predicate turnOn { duration=1; }

predicate turnOff { duration=1; }

}

class LightBulb extends Timeline

{

LightSwitch mySwitch_;

LightBulb(LightSwitch b) { mySwitch_ = b; }

predicate On {}

predicate Off {}

}

Page 8: 1 EUROPA An open source platform for Planning, Scheduling and Constraint Programming Javier Barreiro

8

Rules Engine

• Subgoals • Token Master-Slave

relationships

• Allen Relations• before, after,

meets,met_by,equals, contains, contained_by, paralleled_by, parallels, starts, ends, ends_after, ends_before, ends_after_start, starts_before_end, starts_during, contains_start, ends_during, contains_end, starts_after, starts_before, any

• Token Activate-Merge-Reject mechanisms

NDDLLightBulb::On

{

// Bulb must be Off to be turned On

met_by(object.Off);

met_by(object.mySwitch_.turnOn);

}

LightBulb::Off

{

// Bulb must be On to be turned Off

met_by(object.On);

// Must be turned off through the switch

met_by(object.mySwitch_.turnOff);

}

goal(LightBulb.Off g1);

eq(g1.start,10);

Page 9: 1 EUROPA An open source platform for Planning, Scheduling and Constraint Programming Javier Barreiro

9

Temporal Network

• Temporal Constraints are mirrored in Distance Graph• temporalDistance,

precedes, concurrent

• Negative cycle detection provides earlier conflict detection

NDDL

activity4.start, [ -inf 25 ], activity9.start );

temporalDistance(

activity10.start, [ 5 +inf ], activity11.start );

precedes(0,activity0.start);

precedes(activity0.end,maxDuration);

precedes(0,activity1.start);

precedes(activity1.end,maxDuration);

mporalDistance(

Page 10: 1 EUROPA An open source platform for Planning, Scheduling and Constraint Programming Javier Barreiro

10

Resources

• Multiple Resource types• Reservoirs : Independent

produce/consume• Reusables : Matching

produce/consume• Unary : Reusable

specialization

• Profile Envelope Computation• Resource Profile internally

transformed into flow network representation. Efficient Max Flow computation provides earlier conflict detection

NDDL

class Allocation {

int m_actId; float m_qty; Reusable m_resource;

Allocation( Reusable r, int id, float qty) {

m_actId = id; m_resource = r; m_qty = qty;

}

}

class ProblemInstance {

predicate Activity { int m_actId; }

}

ProblemInstance::Activity

{

Allocation allocations;

eq( allocations.m_actId, m_actId );

foreach( a in allocations ) {

equals( a.m_resource.uses u );

eq( u.quantity, a.m_qty );

}

}

Page 11: 1 EUROPA An open source platform for Planning, Scheduling and Constraint Programming Javier Barreiro

11

Built-in Solver

• Flaws• Open Condition

• Unbound Variable

• Threat

• XML-Configuration• Flaw Managers

• Flaw Filters

• Priorities

• This is just one kind of solver that can be built using EUROPA

Chronological Backtracking algorithmResult plan(PlanDatabase db, FlawManagers fms) {

if(!isConsistent(db)) return INITIALLY_INCONSISTENT;

Stack s = {};

DecisionPoint dp = selectDecisionPoint(db, fms); // Uses priorities, filters.

while(dp != NULL) {

while(dp.hasNext()) {

dp.tryNext();

if (!isConsistent(db)) dp.undo();

}

if (!isConsistent(db)) { // Exhausted choices

if(s.isEmpty() return SEARCH_EXHAUSTED;

else dp = backtrack (s);

}

else {

s.push(dp);

dp = selectDecisionPoint(db, fms);

}

}

return PLAN_FOUND;

}

Page 12: 1 EUROPA An open source platform for Planning, Scheduling and Constraint Programming Javier Barreiro

12

Toolkit

• Plan Works (see EUROPA portal)

• PSUI Components• Gantt

• Resource Chart

• Table views

• Mouse Listeners

Page 13: 1 EUROPA An open source platform for Planning, Scheduling and Constraint Programming Javier Barreiro

13

What's new in EUROPA 2.1

• What's new in EUROPA 2.1

Client Interface

Interpreted NDDL

Constraint Violation reporting

UI components

An example to tie everything together : RCPSP Benchmarks

Open source release and EUROPA portal

Page 14: 1 EUROPA An open source platform for Planning, Scheduling and Constraint Programming Javier Barreiro

14

What's New – Client Interface

Constraint

Engine

Plan

Database

Rules

Engine

Modeling

Languages

NDDLANML

...

ResourcesTemporal Network

Solver

Client APIC++ Java ...

Plan Works PSUI User Apps

Page 15: 1 EUROPA An open source platform for Planning, Scheduling and Constraint Programming Javier Barreiro

15

What's New – Client Interface

• EUROPA packaged as an engine• Clean startup/shutdown

• Standard pieces all preconfigured (constraint library, built-in data types, etc)

• User can still do fine-grained configuration, but only if desired

• PSEngine interface• Defined in C++.

• Using SWIG makes it easy to map to Java, Python, C#, LISP, and many others. Only Java binding provided with release for now.

• SACE, A4O already using it.

• Assembly interface still supported • Has been migrated to package EUROPA as an engine

• Hard to map to SWIG

• Exposes internal interfaces

• Will eventually be unified with PSEngine

Page 16: 1 EUROPA An open source platform for Planning, Scheduling and Constraint Programming Javier Barreiro

16

What's New – Client Interface

PSEngine

Constraint Engine

PSVariable*

getVariableByKey/Name(key/name)

bool/void get/setAutoPropagation() const

bool propagate()

bool/void get/setAllowViolations() const

double getViolation() const

string getViolationExpl() const

Plan Database PSList<PSObject*> getObjectsByType(type)

PSObject* getObjectByKey/Name(key/name)

PSList<PSToken*> getTokens()

PSToken* getTokenByKey(PSEntityKey key)

PSList<PSVariable*> getGlobalVariables()

Solver PSSolver* createSolver(config)

PSVariable PSVarType getType();

PSEntity* getParent();

bool isSingleton();

bool isInterval();

bool isEnumerated();

PSVarValue getSingletonValue();

double getLowerBound();

double getUpperBound();

PSList<PSVarValue> getValues();

void specifyValue(PSVarValue& v);

void reset();

double getViolation() const;

std::string getViolationExpl() const;

PSObject string getObjectType() const;

PSList<PSVariable*>

getMemberVariables();

PSVariable* getMemberVariable(name);

PSList<PSToken*> getTokens();

PSToken bool isFact();

PSObject* getOwner();

PSToken* getMaster();

PSList<PSToken*> getSlaves();

PSTokenState getTokenState() const;

PSVariable* getStart/End/Duration();

double getViolation() const;

std::string getViolationExpl() const;

PSList<PSVariable*> getParameters();

PSVariable* getParameter(name);

void activate();

void reject();

void merge(PSToken* activeToken);

void cancel();

PSResourceResourceProfile getLimits/Levels()

PSSolver void step();

void solve(int maxSteps,int maxDepth);

void reset();

PSList<std::string> getFlaws();

bool isExhausted();

bool isTimedOut();

bool isConstraintConsistent();

Page 17: 1 EUROPA An open source platform for Planning, Scheduling and Constraint Programming Javier Barreiro

17

What's new – Interpreted NDDL

• Interpreted NDDL

• Code generation still supported

• NDDL supported in java, NDDL-XML supported in C++.

• Significant time savings during development.

• Allows model run-time modification/generation. This is useful for application

and tool development.

• Small performance penalty at object creation (<10%)

• Currently used by SACE, Bed Rest, A4O.

Page 18: 1 EUROPA An open source platform for Planning, Scheduling and Constraint Programming Javier Barreiro

18

What's new – Constraint Violation Reporting

• API

• Enabled by calling ConstraintEngine::setAllowViolation(true)

• GetViolation() and GetViolationExpl()

• Granularity

• Constraint Engine – Constraint – Variable

• Token – Variable

• See NQueens example

Page 19: 1 EUROPA An open source platform for Planning, Scheduling and Constraint Programming Javier Barreiro

19

What's New – UI Components

• Pre-packaged components for debugging/visualization

• PSDesktop application

• Drive EUROPA interactively through Java and NDDL listeners

• Solver

• Gantt

• Resource Profile chart

• Table views for Tokens/Objects

Page 20: 1 EUROPA An open source platform for Planning, Scheduling and Constraint Programming Javier Barreiro

20

Example – RCPSP solver

• An Example to put everything together. Solving the RCPSP

• Minimize project makespan subject to temporal and resource constraints

• Motivation : STAR, Crew Planning, Bed Rest.

• NDDL generated from UBO benchmark problems (size 10,20,50, test sets

available up to 1000 activities)

• PSUI used to visualize and debug solvers

• Constraint Violation Reporting used to support search

Page 21: 1 EUROPA An open source platform for Planning, Scheduling and Constraint Programming Javier Barreiro

21

UBO Benchmarks – Built-in Solver

• NDDL generation

• Problem instances auto

generated from UBO files

• See NDDL model and UI

• Simple configuration <SAVHThreatManager order="most,earliest,lower">

<FlawHandler component="SAVHThreatHandler" filter="both" />

</SAVHThreatManager>

• Scales poorly

ubo 10

ubo 20

ubo 50

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

Built-In ~10%

Built-In

ubo 10 ubo 20 ubo 50

0

5

10

15

20

25

30

35

40

45

50

Built-In

% Solved

Avg Time (secs)

Page 22: 1 EUROPA An open source platform for Planning, Scheduling and Constraint Programming Javier Barreiro

22

UBO Benchmarks – IFIR Solver

• IFlatIRelax

• Always respect temporal

constraints. Iteratively add and

remove precedence constraints

to fix resource violations.

• Record no-goods to deal with

min/max temporal distance

constraints

• Custom solver written using

PSEngine. Leverages Constraint

Engine, Temporal Network,

Resources.

ubo 10

ubo 20

ubo 50

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

IFIR ~10%

IFIR

Built-In ~10%

Built-in

ubo 10 ubo 20 ubo 50

0

5

10

15

20

25

30

35

40

45

50

Built-In

IFIR

% Solved

Avg Time in secs

Page 23: 1 EUROPA An open source platform for Planning, Scheduling and Constraint Programming Javier Barreiro

23

UBO Benchmarks – Hybrid Solver

• Local + Exhaustive Search

• Use Local Search to quickly find good

solution

• Use exhaustive search to improve on

good solution. Strong bound and

typical clustering of good solutions

should help

• 2 Versions of Exhaustive search

• Start from scratch and use IFIR

solution as oracle

• Start from IFIR solution, removing N

precedences.

• In both cases, IFIR solution used as

strong upper bound

ubo 10

ubo 20

ubo 50

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

Hybrid ~10%

Hybrid

Series6

IFIR ~10%

IFIR

Series3

Built-In ~10%

Built-in

ubo 10 ubo 20 ubo 50

0

5

10

15

20

25

30

35

40

45

50

Built-In

IFIR

Hybrid

% Solved

Avg Time (secs)

Page 24: 1 EUROPA An open source platform for Planning, Scheduling and Constraint Programming Javier Barreiro

24

UBO Benchmarks – Wrap up

• Easy to use tool stack

• EUROPA modules, API, SWIG-

generated binding, UI tools

• Real-life problems normally require

• Interleaving search, inference and

relaxation

• composition/interleaving of solvers

• Adding RCPSP solver to Built-in solvers

• Improve branch selection (mine

existing B&B solvers)

• See if breaking temporal constraints

leads to faster initial solution ubo 10 ubo 20 ubo 50

0

5

10

15

20

25

Built-In

IFIR

Hybrid

Avg Time (secs) for Solved Problems

ubo 10

ubo 20

ubo 50

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

Hybrid

IFIR

Built-in

% Solved within 10% of BKB

Page 25: 1 EUROPA An open source platform for Planning, Scheduling and Constraint Programming Javier Barreiro

25

What's new – Open Source

• Available under NOSA since Oct-07

• Release 2.1.0 made available to small group in Nov-07

• Release 2.1.1 announced more widely 1/14/08

• EUROPA portal contains everything

• Code, docs, examples, publications, road map.

• External europa-users group created Jan-08

• 34 non-NASA members as of 1/30/08

• MBARI already using EUROPA for AUV

Page 26: 1 EUROPA An open source platform for Planning, Scheduling and Constraint Programming Javier Barreiro

26

Europa Road Map

• Drivers

• Component-based Architecture with state of the art components

• Ease of Use : Creating, debugging, embedding.

• Industrial Strength : Fast, Robust, Easy to deploy and manage.

Page 27: 1 EUROPA An open source platform for Planning, Scheduling and Constraint Programming Javier Barreiro

27

EUROPA Road Map

• Search support

• Refine solver API to facilitate composition and extensions

• Expose flaws more cleanly in solver client interface

• Smarter

• Provide hooks/implementation for back-jumping, dynamic backtracking

• Domain-independent heuristics from (Smith & Bernardini)

• Explicit support for relaxations (SIMPL)

• Easier :

• Solver checkpoints (Comet)

• Faster

• more efficient backtracking implementation

Page 28: 1 EUROPA An open source platform for Planning, Scheduling and Constraint Programming Javier Barreiro

28

EUROPA Road Map

• Architecture

• Refine PSEngine interface

• Plug-in architecture

• Refine module interfaces (extension points)

• Debug/Visualization tools

• Improve PSUI (auto-refresh, improve gantt, table components)

• Provide better built-in search visualization tools

• Industrial strength

• Add systematic performance measurement and profiling. Model and run Benchmark

problems from CP, Scheduling and Planning.

• Windows support

• Continuous Integration server

• Standard logging using Log4Cpp

• Binary release

Page 29: 1 EUROPA An open source platform for Planning, Scheduling and Constraint Programming Javier Barreiro

29

EUROPA Road Map

• Modeling

• Streamline Plan Database so that parsers/interpreters can be supported

directly by it.

• NDDL

• move parser to C++

• add infix notation for constraints

• add new kinds of propagators (state, setup, etc)

• ANML

• Plan Database and search (native POCL solver?) extensions needed to fully

support it

• PDDL (through ANML?)

Page 30: 1 EUROPA An open source platform for Planning, Scheduling and Constraint Programming Javier Barreiro

30

•THANKS!


Recommended