Creating an object as an effect of an action/ assigning a variable of object as an effect

16 views
Skip to first unread message

Lenka Mudrová

unread,
Jun 18, 2015, 4:56:11 PM6/18/15
to europa...@googlegroups.com
Dear all,

first of all, thanks for EUROPA as open source. I am currently getting in to nddl and I would like to be able to create an object as an effect of an action or change a property of an existing object. I cant figure how to do that. It kind of feels it relates to dynamic object creation where is written only "TODO" in documentation :) Any comments will be very welcomed!


Frédéric Py

unread,
Jun 18, 2015, 6:08:25 PM6/18/15
to europa...@googlegroups.com
Hi,

Just a remark here, creating an object as the result of an action would go completely against the closed world assumption. While indeed europa allows to run a problem without closing the world it raises a lot of issues and this especially when you consider that they are done through tokens that can be created by tokens (which in turns can be removed should the planner need to backtrack but there’s even more than that)

Now for the more simple aspect conditions and effect of actions are tokens (i.e. temporally scoped predicates) as opposed to objects which are things that exist during all the plan. So creating an object as en effect of an action is creating something that is permanent which is a pure and simple contradiction.


Now allowing to create objects in a temporal scoped token (action or predicate) also raises the question of their scope. 
- Do they exist only until the end of the token or is their scope until the end of the mission ?
- if the token is removed (due to a backtrack for example) does the object created is removed too ? (technically, based on the way EUROPA::Id references counts this would be indeed what would happened to your object as of right now) 
- does the object impacts constraints that where established before this object was created ?

This last one is important indeed picture the objects:

class Node  {
Node() {}

class Edge {
Node from, to;
DirectPath(Node a, Node b) {
from = a;
to = b;
}
}

Now our initial instantiation is:

Node a = new Node();
Node b = new Node();
Node c = new Node();
Node d = new Node();

Edge ab = new Edge(a,b);
Edge bc = new Edge(b,c);

So far there’s no way to go to d the only paths that exists are from a to b and from b to c (and by transitivity you can go from a to c)



Now lets have a robot class that have the action Move

class Robot extends Timeline {

predicate At {
  Node pos;
}

action Move {}

// ...
}

Robot::Move {
meets(effect At dest);
met_by(condition At source);

Edge path;
path.from == source.pos;
path.to == dest.pos;
}

Robot roby = new Robot();

Now lets try to instantiate our problem

// roby is initially at  a
fact(Robot.At initial);
initial.object.specify(roby)
initial.start.specify(0);
initial.pos == a; 

// we want roby to be at d in the future)
rejectable(Robot.At final);
final.object.specify(roby);
final.start >= 1;
final.pos == d;


Well there’s no way to go to d so the problem will lend up identify that the “final” goal need to be rejected. 
But wait you said that actions could create objects then what prohibit us to create a path later on, but we rejected final already, does that mean that we were wrong ?

Of course you can say “but the planner should have see my create_path action and identify that it can create a new path” Ok but what if this action is in a class that has no instance yet but can  be created through create_class_that_can_create_path ? 
You see that suddenly you have a problem that is order of magnitude more complex than if you considered the classic “closed world assumption” if you let the plan modify the world it means that every time it restrict the domain of a variable there’s the possibility that this restriction is no longer valid due to new truth emerging in the future which makes then the maintinance of constraints much more complex, we are already dealing with a PSPACE problem adding this kind of operation would lead the problem solver in a complexity class way beyond this.



--
Frederic Py




On Jun 18, 2015, at 12:18 PM, Lenka Mudrová <lenka....@gmail.com> wrote:

Dear all,

first of all, thanks for EUROPA as open source. I am currently getting in to nddl and I would like to be able to create an object as an effect of an action or change a property of an existing object. I cant figure how to do that. It kind of feels it relates to dynamic object creation where is written only "TODO" in documentation :) Any comments will be very welcomed!



--
You received this message because you are subscribed to the Google Groups "europa-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to europa-users...@googlegroups.com.
To post to this group, send email to europa...@googlegroups.com.
Visit this group at http://groups.google.com/group/europa-users.
For more options, visit https://groups.google.com/d/optout.

Michael J Iatauro

unread,
Jun 18, 2015, 6:31:47 PM6/18/15
to europa...@googlegroups.com
I (hopefully) answered half of your question in another e-mail, so I'll try to address the
other half here. As Frederic points out, being able to create objects in the model at
planning time violates the "closed world assumption", which makes planning very very hard,
which is why NDDL doesn't let you new-up objects in rules.

NDDL cheats this a bit--you can have open object types (that is, a class whose instances
aren't all known at the beginning of planning), but be aware that constraints can't reason
well about open domains. In particular, it's hard to tell if a constraint is violated,
because it's possible there's some member of the domain that it doesn't know about yet
that satisfies.

The fact that NDDL allows you to have open object types means that it *is* possible to
create objects *outside of NDDL*. We took advantage of this here in a UAV firefighting
project, where both the set of UAVs to observe fires and the set of fires to observe got
elaborated at execution time. However, it meant that the planner couldn't be in the
process of planning when new objects got introduced. Essentially, the problem with the
new objects was treated as an entirely new planning problem.

That doesn't exactly help you if all you want to do is run the stock planner in the
Eclipse plugin, but it is there.

~MJI
> --
> You received this message because you are subscribed to the Google Groups "europa-users"
> group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
> europa-users...@googlegroups.com <mailto:europa-users...@googlegroups.com>.
> To post to this group, send email to europa...@googlegroups.com
> <mailto:europa...@googlegroups.com>.
> Visit this group at http://groups.google.com/group/europa-users.
> For more options, visit https://groups.google.com/d/optout.


--
------------------
Michael J. Iatauro
Software Engineer
QTS, Inc.

NASA Ames Research Center
Office: 650-604-0662
Mail stop: 269-2
P.O. Box 1
Moffett Field, CA 94035-0001

Frédéric Py

unread,
Jun 18, 2015, 7:24:10 PM6/18/15
to europa...@googlegroups.com
Besides creating objects you also have the ability to implement your own constraint which then can do its inference “outside” of europa.

This require a little know how on C++ but also on the intricacies of how a constraint is called — and also what is the temporal scope associated to this constraint and/or the variables passed as argument to this variable. 

Still it is a possibility. Europa engine allows you to extend it and implement any new constraint and then declare them so that they can be used in NDDL. The difficulty again is that a constraint should always return a result that is either the same or a subset of  what it has returned before for each of its arguments. and you need to bare in mind that same constraint will be called many times as the planner continues its search (and this even if it does not backtrack). So if your constraint path_exist(bool test, point a, point b) sets first a to false but then sets a to true with the same a and b argument you probably will end up having your planner keeping backtracking to eventually being exhausted.

Still I have done such thing before and by either having a “loose” constraint (i.e. not trying to recompute values that are already singletons, which is very bad in general but can helps at times for quick and dirty solutions) or doing a much more refined version that looks at the temporal scope of certain of its arguments which can be done with the following code (taken from https://code.google.com/p/trex-autonomy/source/browse/trunk/agent/base/Utilities.cc)

  TokenId getParentToken(const ConstrainedVariableId& var){
    if(var->parent().isId()){ // check if the variable is a direct attribute of a token
      if(TokenId::convertable(var->parent()))
        return var->parent();
// check if the variable is local to a rule (which then is associated to a token)
      if(RuleInstanceId::convertable(var->parent())){
        RuleInstanceId r = var->parent();
        return r->getToken();
      }
    }

    return TokenId::noId();
  }

and then look at the start duration and end of the token though tok->start(), tok->duration() and tok->end()

As you can see we are going on some advanced stuff here and this is still “faking” it by doing this dynamic stuff outside of europa so it does not know that we mess with things. Still if you are ready to get your hand dirty it is an alternate solution that I used more than once with success in some shape or form.


--
Frederic Py




To unsubscribe from this group and stop receiving emails from it, send an email to europa-users...@googlegroups.com.
To post to this group, send email to europa...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages