|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectJSHOP2.DomainElement
JSHOP2.Operator
public abstract class Operator
Each operator at run time is represented as a class derived from this abstract class.
Field Summary | |
---|---|
private DelAddElement[] |
add
Represents the add list in case it is a real list and not a variable. |
private int |
addVarIdx
Represents the add list in case it is a variable (The integer value represents variable's index), otherwise it is -1. |
private Term |
cost
Cost of this operator. |
private DelAddElement[] |
del
Represents the delete list in case it is a real list and not a variable. |
private int |
delVarIdx
Represents the delete list in case it is a variable (The integer value represents variable's index), otherwise it is -1. |
Constructor Summary | |
---|---|
Operator(Predicate head,
int delVarIdxIn,
int addVarIdxIn,
Term costIn)
To initialize the operator. |
Method Summary | |
---|---|
boolean |
apply(Term[] binding,
State s,
java.util.Vector[] delAdd)
This function is used to apply this operator to a given state. |
double |
getCost(Term[] binding)
To get the cost of this operator. |
void |
setAdd(DelAddElement[] addIn)
To set the add list. |
void |
setDel(DelAddElement[] delIn)
To set the delete list. |
Methods inherited from class JSHOP2.DomainElement |
---|
getHead, getIterator, unify |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private DelAddElement[] add
private int addVarIdx
private Term cost
private DelAddElement[] del
private int delVarIdx
Constructor Detail |
---|
public Operator(Predicate head, int delVarIdxIn, int addVarIdxIn, Term costIn)
head
- head of the operator.delVarIdxIn
- the index of the delete list as a variable, -1 if the delete list
is not a variable.addVarIdxIn
- the index of the add list as a variable, -1 if the add list is
not a variable.costIn
- the cost of the operator.Method Detail |
---|
public boolean apply(Term[] binding, State s, java.util.Vector[] delAdd)
binding
- the current binding.s
- current state of the world.delAdd
- a 4-member array of type Vector
used to keep track
of the atoms and protections deleted from and added to the
current state of the world as the result of applying this
operator. This data can be used later in case of a backtrack to
undo these changes.
true
if the operator was applicable,
false
otherwise. An operator is not applicable when
at least one of the atoms it tries to delete is protected.public double getCost(Term[] binding)
binding
- the binding to be applied to the cost term.
public void setAdd(DelAddElement[] addIn)
addIn
- the add list.public void setDel(DelAddElement[] delIn)
delIn
- the delete list.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |