|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object dk.deepthought.sidious.rules.Rule dk.deepthought.sidious.rules.ConstrainingRule
public class ConstrainingRule
Rule to keep conventionally unconstrained sensors constrained. I.e. adds cost to otherwise "free" adjustments.
Field Summary | |
---|---|
private java.util.Collection<SuperLinkID> |
idsToConstrain
A list of sensor id's which will be constrained by this. |
Constructor Summary | |
---|---|
ConstrainingRule(SuperLinkID... sensorIDs)
Constructs a constraining rule that constrains sensors with input IDs. |
Method Summary | |
---|---|
double |
desire(State currentState,
State newState,
Step step)
Method returns the calculated desire associated with the change from currentState to newState . |
java.util.Collection<Goal> |
getGoals()
Method returns a collection of immediate goals. |
private double |
normalizedDistance(SensorInput currentSensor,
SensorInput newSensor)
Calculates the normalized distance between two sensors. |
Methods inherited from class dk.deepthought.sidious.rules.Rule |
---|
getAdjustableSetting, getAdjustableSettingFromParent, getExplanation, getParentID, getSensorValue, setParentID |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.util.Collection<SuperLinkID> idsToConstrain
Constructor Detail |
---|
public ConstrainingRule(SuperLinkID... sensorIDs)
sensorIDs
- the ids of the sensors to constrainMethod Detail |
---|
public double desire(State currentState, State newState, Step step)
Rule
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.
desire
in class Rule
currentState
- the current statenewState
- the new statestep
- the step
public java.util.Collection<Goal> getGoals()
Rule
If there are no immediate goals, an empty collection is returned.
getGoals
in class Rule
private double normalizedDistance(SensorInput currentSensor, SensorInput newSensor)
It takes two sensors and normalizes the distance between them to a value between 0 and 1.
currentSensor
- the first sensornewSensor
- the second sensor
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |