Skip to content
Michael Iatauro edited this page Dec 5, 2014 · 3 revisions

EUROPA Quick Start

This tutorial provides just enough information for you to create and run simple planning problems using EUROPA. Once you're familiar with the basics, see the Documentation page for more details.

EUROPA can be used to solve Constraint Programming, Scheduling and Planning problems. For the purposes of this Quick Start guide we will use a simple planning problem.

These are the typical steps a EUROPA user will follow to solve a problem :

  • Create a model of the problem domain using NDDL, EUROPA's modeling language
  • Create a particular instance of the problem using NDDL
  • Instantiate a solver and ask it to look for a solution
  • Inspect the plan and possibly modify the problem, tune the solver and re-plan
  • When the model and the solver are working as expected, embed them into a larger application

To try the steps below yourself, you must have already downloaded and installed EUROPA.

For our example, assume that we want a plan to turn a light bulb on and off. Here are the steps to take (the files for this example can be found here):

Create a NDDL model for the domain

The New Domain Description Language (NDDL) is a simple but powerful language used to describe both problem domains and problem instances in EUROPA:

// Light-model.nddl

class LightBulb extends Timeline
{
    predicate On  {}
    predicate Off {}
}

class LightSwitch extends Timeline
{
    LightBulb myBulb_;

    LightSwitch(LightBulb b)
    {
        myBulb_ = b;
    }

    action turnOn  { duration=1; }
    action turnOff { duration=1; }
}

LightSwitch::turnOn
{
    met_by(condition object.myBulb_.Off);  // Bulb must be Off to be turned On
    meets(effect object.myBulb_.On);   // Must be turned on through the switch
}

LightSwitch::turnOff
{
    met_by(condition object.myBulb_.On);   // Bulb must be On to be turned Off
    meets(effect object.myBulb_.Off);      // Must be turned off through the switch
}

Create a problem instance

// Light-initial-state.nddl

#include "Light-model.nddl"

// Problem instance: turning the light off

LightBulb bulb1 = new LightBulb();
LightSwitch switch1 = new LightSwitch(bulb1);

// At time 0, the bulb is on
fact(bulb1.On initialCondition);
eq(initialCondition.start,0);

// We want the bulb to be off by time 10
goal(bulb1.Off goal1);
lt(0,goal1.start);
lt(goal1.start,10);

Instantiate and run a Solver

EUROPA comes with a simple script called makeproject which generates the minimal C++ and Java applications to run a planner on your model. You can then tailor those applications to your own purposes, or use them as an example to embed EUROPA into your own application. This will create a new project called Light in your ~/Light directory :

% $EUROPA_HOME/bin/makeproject Light ~

Replace the default model and initial state generated by makeproject with the model and initial state for the Light problem as seen above :

% cp $EUROPA_HOME/examples/Light/*.nddl ~/Light
% cp $EUROPA_HOME/examples/Light/*.bsh ~/Light

Let's run the Java application generated by makeproject :

% cd ~/Light
% ant
Buildfile: build.xml

init:

compile:

run:
     [echo] Running Light project
     [java]  autoWrite 0

Note that the Light model is part of the EUROPA distribution; if you don't want to create your own project to try this, you can run it directly from the EUROPA directories :

% cd $EUROPA_HOME/examples/Light
% ant
Buildfile: build.xml

init:

compile:

run:
     [echo] Running Light project
     [java]  autoWrite 0

You should see the following window come up :

![light example] (images/Examples-Light0.jpg)

In the "Solver" window, hit the "Go" button to have the solver run. The solver should finish after 5 steps, satisfying the goal that was specified in Light-initial-state.nddl (that is, to turn the light off by time=10).

Examine Results

You can now run the method showPlan() defined in Light.bsh. Just go into the "Console" window, type showPlan() then .

example light1

You can now see that the planner decided that :

  • bulb1 is On from [to 1,9and Off from[to [infinity](1,9])`
  • lightSwitch1 is turned off at time [The intervals mean that the action or state change could happen at any point in the interval, so for instance, "lightSwitch1 is turned off at time 0,8`" means that lightSwitch1 could be turned off at time 0, or at time 1, ..., or at time 8. You can modify your model or EUROPA's configuration to generate grounded plans (where all the values are points, instead of intervals), if that's what you want for your particular application.

Embed your model into an application

Sometimes, what we have done so far is all you may want to do : create a model, a problem instance, generate a plan, visualize the results, and perhaps dump them to a file. In other cases you may want to embed this model as part of a bigger application. In that case, you will need to link in EUROPA as a library into your application and use the programmatic API (Java or C++) to perform the steps described above, you can see how this is done for this particular example in C++ and Java (the Java version uses scripting, so Main.java is complemented by Light.bsh).

The details of how to embed EUROPA into your application are provided here.

Next Steps

  • See the Examples page for more advanced examples that can serve as starting points for your own model, or just to learn more about what EUROPA can do.
  • Read a high-level overview of the planning components in EUROPA.
  • Learn the details about modeling in NDDL, configuring the built-in solver, extending EUROPA with custom constraints/solvers/etc and using EUROPA's debugging tools.
  • How to create your own makeproject project.
  • How to embed your model into a C++ or Java application.
Clone this wiki locally