|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object dk.deepthought.sidious.rules.Rule
public abstract class Rule
This is the base class for representing a Rule. It is designed to be extended by classes defining rules of the system.
Rules can be goal-oriented and work towards a specific goal. They can also represent a conflict or an expense.
Field Summary | |
---|---|
private SuperLinkID |
parentID
The ID of the originating PlanRequester . |
Constructor Summary | |
---|---|
Rule()
|
Method Summary | |
---|---|
abstract double |
desire(State currentState,
State newState,
Step step)
Method returns the calculated desire associated with the change from currentState to newState . |
protected double |
getAdjustableSetting(Step step,
SuperLinkID id)
Returns the setting of an adjustable contained in the step
identified by the id . |
protected double |
getAdjustableSettingFromParent(SuperLinkID adjustableID)
Method returns the setting of the input adjustable. |
java.lang.String |
getExplanation()
Gets the explanation/reasoning from a rule. |
abstract java.util.Collection<Goal> |
getGoals()
Method returns a collection of immediate goals. |
SuperLinkID |
getParentID()
Gets the parent id of this rule. |
protected double |
getSensorValue(State state,
SuperLinkID sensorID)
Method returns the value of the input sensorID in the
input state . |
void |
setParentID(SuperLinkID parentID)
Sets the parent id for this rule. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private SuperLinkID parentID
PlanRequester
.
Constructor Detail |
---|
public Rule()
Method Detail |
---|
public abstract java.util.Collection<Goal> getGoals()
If there are no immediate goals, an empty collection is returned.
public abstract double desire(State currentState, State newState, Step step)
currentState
to newState
.
The calculated desire must evaluate to [0,1], where 0 represents no desire for changing state, and 1 represents maximum desire for change.
Some rules are allowed to evaluate to values (much) larger than 1. This exception is only allowed if the outcome of not respecting the rule is fatal.
currentState
- the current statenewState
- the new statestep
- the step
public java.lang.String getExplanation()
Override this method if a more detailed explanation is needed.
public SuperLinkID getParentID()
public void setParentID(SuperLinkID parentID)
parentID
- the parentID to setprotected double getSensorValue(State state, SuperLinkID sensorID)
sensorID
in the
input state
. If the sensor isn't represented in the
state, 0 is returned.
state
- the statesensorID
- the id
protected double getAdjustableSettingFromParent(SuperLinkID adjustableID)
adjustableID
- id of the adjustable
protected double getAdjustableSetting(Step step, SuperLinkID id)
step
identified by the id
.
step
- the stepid
- the id
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |