abp
Class Adaptive<C,A>

java.lang.Object
  extended by abp.Adaptive<C,A>
Type Parameters:
C - The parameter type of the context used in calls to suggest(C, java.util.Set). Note, if this adaptive is contextless (only involves one state, then the Void class and null reference will suffice perfectly. See suggest for a list of the constraints on this type.
A - The type corresponding to permissible actions that calls to suggest(C, java.util.Set) can use.
All Implemented Interfaces:
java.io.Serializable

public class Adaptive<C,A>
extends java.lang.Object
implements java.io.Serializable

Represents a contextual adaptive or simply adaptive. This is the most useful learning element and should represent a clear point of uncertainty in the program. Adaptives are created through an AdaptiveProcess. We request a value from the adaptive value via the suggest method.

See Also:
Serialized Form

Method Summary
 java.util.Map<C,A> constructPolicy()
          This constructs an optimal policy for the given adaptive.
 void disableLearning()
          Disables learning on this adaptive...
 void enableLearning()
          Enables learning on this adaptive.
 A suggest(C ctx, java.util.Set<A> actions)
          For a given context and non-empty set of permissible actions, this method suggests a potential action.
 java.lang.String toShortString()
          Returns a short unique representation of this adaptive object.
 java.lang.String toString()
          This returns a string showing a table of all the contexts that this adaptive knows about and other related information.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

suggest

public A suggest(C ctx,
                 java.util.Set<A> actions)
For a given context and non-empty set of permissible actions, this method suggests a potential action. Initially, the values returned by this method will be exploratory. It is expected that the user will call AdaptiveProcess.reward(double) to indicate success or failure of a given suggestion.

Note: The context argument may be hashed internally. Hence, it should not be modified after it is initially passed in. Moreover, if the context type's class overrides Object.equals it must also override Object.hashCode. This is not a problem for immutable types such as String and Integer. If one is using some sort of complex world state object as the current context, an immutable copy should be used instead.

Throws:
java.lang.IllegalArgumentException - if the action set is empty
See Also:
AdaptiveProcess.reward(double)

constructPolicy

public java.util.Map<C,A> constructPolicy()
This constructs an optimal policy for the given adaptive. It maps each known context to the greedy action (best known action for each context).


disableLearning

public void disableLearning()
Disables learning on this adaptive...

See Also:
enableLearning(), AdaptiveProcess.disableLearning()

enableLearning

public void enableLearning()
Enables learning on this adaptive. See disableLearning for further discussion.

See Also:
disableLearning(), AdaptiveProcess.enableLearning()

toShortString

public java.lang.String toShortString()
Returns a short unique representation of this adaptive object.


toString

public java.lang.String toString()
This returns a string showing a table of all the contexts that this adaptive knows about and other related information. Note: This can generate an obscene amount of output for large adaptives.

Overrides:
toString in class java.lang.Object