300 likes | 593 Views
EUROPA An open source platform for Planning, Scheduling and Constraint Programming Javier Barreiro. 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
E N D
EUROPA An open source platform for Planning, Scheduling and Constraint Programming Javier Barreiro
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
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.
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
EUROPA - Overview Plan Works PSUI User Apps Client API C++ Java ... Temporal Network Resources Modeling Languages NDDL ANML ... Constraint Engine Plan Database Rules Engine Solver
Constraint Engine 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); • 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
Plan Database 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 {} } • 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
Rules Engine NDDL LightBulb::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); • 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
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(
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 ); } }
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 algorithm Result 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; }
Toolkit • Plan Works (see EUROPA portal) • PSUI Components • Gantt • Resource Chart • Table views • Mouse Listeners
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
What's New – Client Interface Plan Works PSUI User Apps Client API C++ Java ... Temporal Network Resources Modeling Languages NDDL ANML ... Constraint Engine Plan Database Rules Engine Solver
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
What's New – Client Interface 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; PSEngine PSObject string getObjectType() const; PSList<PSVariable*> getMemberVariables(); PSVariable* getMemberVariable(name); PSList<PSToken*> getTokens(); 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 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(); Plan Database PSList<PSObject*> getObjectsByType(type) PSObject* getObjectByKey/Name(key/name) PSList<PSToken*> getTokens() PSToken* getTokenByKey(PSEntityKey key) PSList<PSVariable*> getGlobalVariables() PSResource ResourceProfile getLimits/Levels() PSSolver void step(); void solve(int maxSteps,int maxDepth); void reset(); PSList<std::string> getFlaws(); bool isExhausted(); bool isTimedOut(); bool isConstraintConsistent(); Solver PSSolver* createSolver(config)
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.
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
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
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
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 % Solved Avg Time (secs)
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. % Solved Avg Time in secs
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 % Solved Avg Time (secs)
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 % Solved within 10% of BKB Avg Time (secs) for Solved Problems
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
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.
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
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
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?)