Collapse All Expand All

C#

Clarion Library 6.1.1
Agent Class
Members Example See Also Send Feedback

[This is preliminary documentation and is subject to change.]

This class implements an agent within the Clarion Library

Namespace: Clarion.Framework
Assembly: ClarionLibrary (in ClarionLibrary.dll) Version: 6.1.1.0 (6.1.1.0)

# Syntax

C#
    public class Agent : IWorldObject, ISubscribes<ParameterChangeRequestedEventArgs>,
    	ISubscribes<ExternalActionRecommendedEventArgs>, ISubscribes<PerceivedSensoryInformationModifiedEventArgs>, ISubscribes<TimingHoldRequestedEventArgs>,
    	ISubscribes, IPublishes<SensoryInformationPerceivedEventArgs>, IPublishes<LearningRequestedEventArgs>,
    	IPublishes<GoalStructureUpdateRequestedEventArgs>, IPublishes<WorkingMemoryUpdateRequestedEventArgs>, IPublishes<NewExternalActionChosenEventArgs>,
    	IPublishes

# Remarks

This class acts as the vehicle for actualizing everything related to the initialization and operation of an Agent. All of the capabilities implemented by this class are conceptualized by the Clarion theory. Before attempting to construct an agent using the Clarion Library, you should make sure you have a firm understanding of the Clarion theory. A detailed technical specification for the Clarion theory can be found at http://www.cogsci.rpi.edu/~rsun/clarion-pub.html.

For the most part, initializing an agent is accomplished using either the World singleton or the AgentInitializer. The World is in charge of the creating of an agent, while the AgentInitializer is in charge of initializing the internal (functional) aspects of the agent once it is created. A simple example of how to initialize an agent can be found in the "Examples" section (below). Furthermore, a detailed walkthrough of this example can be found in the "Setting Up & Using the ACS" guide (located in the "Basics Tutorials" section of the "Tutorials" folder). More advanced configuration options can be found in the various other tutorials (see the "Tutorials" folder of the Clarion Library package).

Copyright 2011. Nicholas Wilson

# Examples

The code below is excerpted from the "HelloWorld - Simple.cs" sample (located in the "Beginner" folder under the "Samples" folder of the Clarion Library package)
CopyC#

    //Initialize the World
    DimensionValuePair hi = World.NewDimensionValuePair("Salutation", "Hello");
    DimensionValuePair bye = World.NewDimensionValuePair("Salutation", "Goodbye");

    ExternalActionChunk sayHi = World.NewExternalActionChunk("Hello");
    ExternalActionChunk sayBye = World.NewExternalActionChunk("Goodbye");

    //Initialize the Agent
    Agent John = World.NewAgent("John");
    SimplifiedQBPNetwork net = AgentInitializer.InitializeImplicitDecisionNetwork(John, SimplifiedQBPNetwork.Factory);

    net.Input.Add(hi);
    net.Input.Add(bye);

    net.Output.Add(sayHi);
    net.Output.Add(sayBye);

    John.Commit(net);

    net.Parameters.LEARNING_RATE = 1;
    John.ACS.Parameters.PERFORM_RER_REFINEMENT = false;

    //Run the task
    SensoryInformation i;
    ExternalActionChunk chosen;

    for (int i = 0; i < NumberTrials; i++)
    {
        i = World.NewSensoryInformation(John);

        //Randomly choose setup the sensory information as either saying "Hello" or "Goodbye"
        if (rand.NextDouble() < .5)
        {
            //Say "Hello"
            i.Add(hi, John.Parameters.MAX_ACTIVATION);
            i.Add(bye, John.Parameters.MIN_ACTIVATION);
        }
        else
        {
           //Say "Goodbye"
           i.Add(hi, John.Parameters.MIN_ACTIVATION);
           i.Add(bye, John.Parameters.MAX_ACTIVATION);
       }

       //Perceive the sensory information
       John.Perceive(i);

       //Choose an action
       chosen = John.GetChosenExternalAction(i);

       //Deliver appropriate feedback to the agent
       if (chosen == sayHi)
       {
           //The agent said "Hello"
           if (i[hi] == John.Parameters.MAX_ACTIVATION)
           {
               //The agent chose the correct response
               John.ReceiveFeedback(i, 1.0);
           }
           else
           {
               //The agent chose the incorrect response
               John.ReceiveFeedback(i, 0.0);
           }
       }
       else
       {
           //The agent said "Goodbye"
           if (i[bye] == John.Parameters.MAX_ACTIVATION)
           {
               //The agent chose the correct response
               John.ReceiveFeedback(i, 1.0);
           }
           else
           {
               //The agent chose the incorrect response
               John.ReceiveFeedback(i, 0.0);
           }
       }
    }

    //Kill the agent to end the task
    John.Die();

# Inheritance Hierarchy

System..::..Object
Clarion.Framework..::..Agent

# See Also

Agent Members
Clarion.Framework Namespace