dk.deepthought.sidious.rules
Class ConstrainingRule

java.lang.Object
  extended by dk.deepthought.sidious.rules.Rule
      extended by dk.deepthought.sidious.rules.ConstrainingRule

public class ConstrainingRule
extends Rule

Rule to keep conventionally unconstrained sensors constrained. I.e. adds cost to otherwise "free" adjustments.

Author:
Deepthought

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

idsToConstrain

private java.util.Collection<SuperLinkID> idsToConstrain
A list of sensor id's which will be constrained by this.

Constructor Detail

ConstrainingRule

public ConstrainingRule(SuperLinkID... sensorIDs)
Constructs a constraining rule that constrains sensors with input IDs.

Parameters:
sensorIDs - the ids of the sensors to constrain
Method Detail

desire

public double desire(State currentState,
                     State newState,
                     Step step)
Description copied from class: Rule
Method returns the calculated desire associated with the change from 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.

Specified by:
desire in class Rule
Parameters:
currentState - the current state
newState - the new state
step - the step
Returns:
the calculated desire

getGoals

public java.util.Collection<Goal> getGoals()
Description copied from class: Rule
Method returns a collection of immediate goals.

If there are no immediate goals, an empty collection is returned.

Specified by:
getGoals in class Rule
Returns:
the goals of this rule

normalizedDistance

private double normalizedDistance(SensorInput currentSensor,
                                  SensorInput newSensor)
Calculates the normalized distance between two sensors.

It takes two sensors and normalizes the distance between them to a value between 0 and 1.

Parameters:
currentSensor - the first sensor
newSensor - the second sensor
Returns:
the normalized value of the distance.


Copyright © Deepthought Development - All Rights Reserved.