agents.head

## Class Head

- java.lang.Object
- - agents.Agent
  - - agents.SystemAgent
    - - agents.head.AbstractHead
      - - agents.head.Head

All Implemented Interfaces:
  java.io.Serializable

    public class Head
    extends AbstractHead

The Class Head.

See Also:
  Serialized Form

### Constructor Summary

Constructors
Constructor and Description
`Head(World world)` Instantiates a new head.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `changeOracleConnection()` Change oracle connection.
`void` `computeAMessage(Message m)` Compute A message.
`double` `getAction()` Gets the action.
`java.util.ArrayList<Context>` `getActiveContexts()` Gets the active contexts.
`double` `getAugmentationFactorError()` Gets the augmentation factor error.
`double` `getAugmentationInexactError()` Gets the augmentation inexact error.
`double` `getAveragePredictionCriticity()` Gets the average prediction criticity.
`int` `getAveragePredictionCriticityWeight()` Gets the average prediction criticity weight.
`Context` `getBestContext()` Gets the best context.
`java.util.ArrayList<Context>` `getContexts()` Gets the contexts.
`double` `getCriticity()` Gets the criticity.
`double` `getCriticity(Context context)` Gets the criticity.
`double` `getDiminutionFactorError()` Gets the diminution factor error.
`double` `getDiminutionInexactError()` Gets the diminution inexact error.
`double` `getErrorAllowed()` Gets the error allowed.
`java.lang.String` `getFunctionSelected()` Gets the function selected.
`double` `getInexactAllowed()` Gets the inexact allowed.
`Context` `getLastUsedContext()` Gets the last used context.
`double` `getMinErrorAllowed()` Gets the min error allowed.
`double` `getMinInexactAllowed()` Gets the min inexact allowed.
`int` `getnConflictBeforeAugmentation()` Gets the n conflict before augmentation.
`int` `getnConflictBeforeInexactAugmentation()` Gets the n conflict before inexact augmentation.
`Context` `getNewContext()` Gets the new context.
`boolean` `getNoBestContext()` Gets the no best context.
`int` `getnPropositionsReceived()` Gets the n propositions received.
`int` `getnSuccessBeforeDiminution()` Gets the n success before diminution.
`int` `getnSuccessBeforeInexactDiminution()` Gets the n success before inexact diminution.
`double` `getOldCriticity()` Gets the old criticity.
`double` `getOldOracleValue()` Gets the old oracle value.
`BlackBoxAgent` `getOracle()` Gets the oracle.
`double` `getOracleValue()` Gets the oracle value.
`double` `getPrediction()` Gets the prediction.
`java.util.ArrayList<? extends Agent>` `getTargets()` Gets the targets.
`boolean` `isContextFromPropositionWasSelected()` Checks if is context from proposition was selected.
`boolean` `isNewContextWasCreated()` Checks if is new context was created.
`boolean` `isNoCreation()` Checks if is no creation.
`void` `play()` The core method of the head agent.
`void` `setAction(double action)` Sets the action.
`void` `setAugmentationFactorError(double augmentationFactorError)` Sets the augmentation factor error.
`void` `setAugmentationInexactError(double augmentationInexactError)` Sets the augmentation inexact error.
`void` `setAveragePredictionCriticity(double averagePredictionCriticity)` Sets the average prediction criticity.
`void` `setAveragePredictionCriticityWeight(int averagePredictionCriticityWeight)` Sets the average prediction criticity weight.
`void` `setBestContext(Context bestContext)` Sets the best context.
`void` `setContextFromPropositionWasSelected(boolean contextFromPropositionWasSelected)` Sets the context from proposition was selected.
`void` `setContexts(java.util.ArrayList<Context> contexts)` Sets the contexts.
`void` `setCriticity(double criticity)` Sets the criticity.
`void` `setDataForErrorMargin(double errorAllowed, double augmentationFactorError, double diminutionFactorError, double minErrorAllowed, int nConflictBeforeAugmentation, int nSuccessBeforeDiminution)` Sets the data for error margin.
`void` `setDataForInexactMargin(double inexactAllowed, double augmentationInexactError, double diminutionInexactError, double minInexactAllowed, int nConflictBeforeInexactAugmentation, int nSuccessBeforeInexactDiminution)` Sets the data for inexact margin.
`void` `setDiminutionFactorError(double diminutionFactorError)` Sets the diminution factor error.
`void` `setDiminutionInexactError(double diminutionInexactError)` Sets the diminution inexact error.
`void` `setErrorAllowed(double errorAllowed)` Sets the error allowed.
`void` `setFunctionSelected(java.lang.String functionSelected)` Sets the function selected.
`void` `setInexactAllowed(double inexactAllowed)` Sets the inexact allowed.
`void` `setLastUsedContext(Context lastUsedContext)` Sets the last used context.
`void` `setMinErrorAllowed(double minErrorAllowed)` Sets the min error allowed.
`void` `setMinInexactAllowed(double minInexactAllowed)` Sets the min inexact allowed.
`void` `setnConflictBeforeAugmentation(int nConflictBeforeAugmentation)` Sets the n conflict before augmentation.
`void` `setnConflictBeforeInexactAugmentation(int nConflictBeforeInexactAugmentation)` Sets the n conflict before inexact augmentation.
`void` `setNewContext(Context newContext)` Sets the new context.
`void` `setNoCreation(boolean noCreation)` Sets the no creation.
`void` `setnPropositionsReceived(int nPropositionsReceived)` Sets the n propositions received.
`void` `setnSuccessBeforeDiminution(int nSuccessBeforeDiminution)` Sets the n success before diminution.
`void` `setnSuccessBeforeInexactDiminution(int nSuccessBeforeInexactDiminution)` Sets the n success before inexact diminution.
`void` `setOldCriticity(double oldCriticity)` Sets the old criticity.
`void` `setOldOracleValue(double oldOracleValue)` Sets the old oracle value.
`void` `setOracle(BlackBoxAgent oracle)` Sets the oracle.
`void` `setOracleValue(double oracleValue)` Sets the oracle value.
`void` `setPrediction(double prediction)` Sets the prediction.

### Methods inherited from class agents.SystemAgent

`getWorld, setWorld`

### Methods inherited from class agents.Agent

`die, getID, getMessages, getMessagesBin, getName, isDying, readMessage, sendExpressMessage, sendMessage, sendMessage, setDying, setID, setMessages, setMessagesBin, setName`

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### Head

    public Head(World world)

Instantiates a new head.

Parameters:
  `world` - the world

### Method Detail

#### setDataForErrorMargin

    public void setDataForErrorMargin(double errorAllowed,
                                      double augmentationFactorError,
                                      double diminutionFactorError,
                                      double minErrorAllowed,
                                      int nConflictBeforeAugmentation,
                                      int nSuccessBeforeDiminution)

Sets the data for error margin.

Parameters:
  `errorAllowed` - the error allowed
  `augmentationFactorError` - the augmentation factor error
  `diminutionFactorError` - the diminution factor error
  `minErrorAllowed` - the min error allowed
  `nConflictBeforeAugmentation` - the n conflict before augmentation
  `nSuccessBeforeDiminution` - the n success before diminution

#### setDataForInexactMargin

    public void setDataForInexactMargin(double inexactAllowed,
                                        double augmentationInexactError,
                                        double diminutionInexactError,
                                        double minInexactAllowed,
                                        int nConflictBeforeInexactAugmentation,
                                        int nSuccessBeforeInexactDiminution)

Sets the data for inexact margin.

Parameters:
  `inexactAllowed` - the inexact allowed
  `augmentationInexactError` - the augmentation inexact error
  `diminutionInexactError` - the diminution inexact error
  `minInexactAllowed` - the min inexact allowed
  `nConflictBeforeInexactAugmentation` - the n conflict before inexact augmentation
  `nSuccessBeforeInexactDiminution` - the n success before inexact diminution

#### computeAMessage

    public void computeAMessage(Message m)

Description copied from class: `Agent`
Compute A message.

Overrides:
  `computeAMessage` in class `AbstractHead`
Parameters:
  `m` - the m

#### play

    public void play()

The core method of the head agent. Manage the whole behavior, and call method from context agents when needed.

Overrides:
  `play` in class `SystemAgent`

#### getContexts

    public java.util.ArrayList<Context> getContexts()

Gets the contexts.

Returns:
  the contexts

#### setContexts

    public void setContexts(java.util.ArrayList<Context> contexts)

Sets the contexts.

Parameters:
  `contexts` - the new contexts

#### getBestContext

    public Context getBestContext()

Gets the best context.

Returns:
  the best context

#### setBestContext

    public void setBestContext(Context bestContext)

Sets the best context.

Parameters:
  `bestContext` - the new best context

#### getTargets

    public java.util.ArrayList<? extends Agent> getTargets()

Description copied from class: `SystemAgent`
Gets the targets.

Overrides:
  `getTargets` in class `AbstractHead`
Returns:
  the targets

#### getActiveContexts

    public java.util.ArrayList<Context> getActiveContexts()

Gets the active contexts.

Returns:
  the active contexts

#### getCriticity

    public double getCriticity()

Gets the criticity.

Returns:
  the criticity

#### getNoBestContext

    public boolean getNoBestContext()

Gets the no best context.

Returns:
  the no best context

#### getCriticity

    public double getCriticity(Context context)

Gets the criticity.

Parameters:
  `context` - the context
Returns:
  the criticity

#### setCriticity

    public void setCriticity(double criticity)

Sets the criticity.

Parameters:
  `criticity` - the new criticity

#### getAction

    public double getAction()

Gets the action.

Returns:
  the action

#### setAction

    public void setAction(double action)

Sets the action.

Parameters:
  `action` - the new action

#### getLastUsedContext

    public Context getLastUsedContext()

Gets the last used context.

Returns:
  the last used context

#### setLastUsedContext

    public void setLastUsedContext(Context lastUsedContext)

Sets the last used context.

Parameters:
  `lastUsedContext` - the new last used context

#### isNoCreation

    public boolean isNoCreation()

Checks if is no creation.

Returns:
  true, if is no creation

#### setNoCreation

    public void setNoCreation(boolean noCreation)

Sets the no creation.

Parameters:
  `noCreation` - the new no creation

#### getOracle

    public BlackBoxAgent getOracle()

Gets the oracle.

Returns:
  the oracle

#### setOracle

    public void setOracle(BlackBoxAgent oracle)

Sets the oracle.

Parameters:
  `oracle` - the new oracle

#### getOracleValue

    public double getOracleValue()

Gets the oracle value.

Returns:
  the oracle value

#### setOracleValue

    public void setOracleValue(double oracleValue)

Sets the oracle value.

Parameters:
  `oracleValue` - the new oracle value

#### getOldOracleValue

    public double getOldOracleValue()

Gets the old oracle value.

Returns:
  the old oracle value

#### setOldOracleValue

    public void setOldOracleValue(double oldOracleValue)

Sets the old oracle value.

Parameters:
  `oldOracleValue` - the new old oracle value

#### getOldCriticity

    public double getOldCriticity()

Gets the old criticity.

Returns:
  the old criticity

#### setOldCriticity

    public void setOldCriticity(double oldCriticity)

Sets the old criticity.

Parameters:
  `oldCriticity` - the new old criticity

#### getErrorAllowed

    public double getErrorAllowed()

Gets the error allowed.

Returns:
  the error allowed

#### setErrorAllowed

    public void setErrorAllowed(double errorAllowed)

Sets the error allowed.

Parameters:
  `errorAllowed` - the new error allowed

#### getAveragePredictionCriticity

    public double getAveragePredictionCriticity()

Gets the average prediction criticity.

Returns:
  the average prediction criticity

#### setAveragePredictionCriticity

    public void setAveragePredictionCriticity(double averagePredictionCriticity)

Sets the average prediction criticity.

Parameters:
  `averagePredictionCriticity` - the new average prediction criticity

#### getAveragePredictionCriticityWeight

    public int getAveragePredictionCriticityWeight()

Gets the average prediction criticity weight.

Returns:
  the average prediction criticity weight

#### setAveragePredictionCriticityWeight

    public void setAveragePredictionCriticityWeight(int averagePredictionCriticityWeight)

Sets the average prediction criticity weight.

Parameters:
  `averagePredictionCriticityWeight` - the new average prediction criticity weight

#### getNewContext

    public Context getNewContext()

Gets the new context.

Returns:
  the new context

#### setNewContext

    public void setNewContext(Context newContext)

Sets the new context.

Parameters:
  `newContext` - the new new context

#### changeOracleConnection

    public void changeOracleConnection()

Change oracle connection.

#### getFunctionSelected

    public java.lang.String getFunctionSelected()

Gets the function selected.

Returns:
  the function selected

#### setFunctionSelected

    public void setFunctionSelected(java.lang.String functionSelected)

Sets the function selected.

Parameters:
  `functionSelected` - the new function selected

#### getInexactAllowed

    public double getInexactAllowed()

Gets the inexact allowed.

Returns:
  the inexact allowed

#### setInexactAllowed

    public void setInexactAllowed(double inexactAllowed)

Sets the inexact allowed.

Parameters:
  `inexactAllowed` - the new inexact allowed

#### getAugmentationFactorError

    public double getAugmentationFactorError()

Gets the augmentation factor error.

Returns:
  the augmentation factor error

#### setAugmentationFactorError

    public void setAugmentationFactorError(double augmentationFactorError)

Sets the augmentation factor error.

Parameters:
  `augmentationFactorError` - the new augmentation factor error

#### getDiminutionFactorError

    public double getDiminutionFactorError()

Gets the diminution factor error.

Returns:
  the diminution factor error

#### setDiminutionFactorError

    public void setDiminutionFactorError(double diminutionFactorError)

Sets the diminution factor error.

Parameters:
  `diminutionFactorError` - the new diminution factor error

#### getnConflictBeforeAugmentation

    public int getnConflictBeforeAugmentation()

Gets the n conflict before augmentation.

Returns:
  the n conflict before augmentation

#### setnConflictBeforeAugmentation

    public void setnConflictBeforeAugmentation(int nConflictBeforeAugmentation)

Sets the n conflict before augmentation.

Parameters:
  `nConflictBeforeAugmentation` - the new n conflict before augmentation

#### getnSuccessBeforeDiminution

    public int getnSuccessBeforeDiminution()

Gets the n success before diminution.

Returns:
  the n success before diminution

#### setnSuccessBeforeDiminution

    public void setnSuccessBeforeDiminution(int nSuccessBeforeDiminution)

Sets the n success before diminution.

Parameters:
  `nSuccessBeforeDiminution` - the new n success before diminution

#### getMinErrorAllowed

    public double getMinErrorAllowed()

Gets the min error allowed.

Returns:
  the min error allowed

#### setMinErrorAllowed

    public void setMinErrorAllowed(double minErrorAllowed)

Sets the min error allowed.

Parameters:
  `minErrorAllowed` - the new min error allowed

#### getAugmentationInexactError

    public double getAugmentationInexactError()

Gets the augmentation inexact error.

Returns:
  the augmentation inexact error

#### setAugmentationInexactError

    public void setAugmentationInexactError(double augmentationInexactError)

Sets the augmentation inexact error.

Parameters:
  `augmentationInexactError` - the new augmentation inexact error

#### getDiminutionInexactError

    public double getDiminutionInexactError()

Gets the diminution inexact error.

Returns:
  the diminution inexact error

#### setDiminutionInexactError

    public void setDiminutionInexactError(double diminutionInexactError)

Sets the diminution inexact error.

Parameters:
  `diminutionInexactError` - the new diminution inexact error

#### getnConflictBeforeInexactAugmentation

    public int getnConflictBeforeInexactAugmentation()

Gets the n conflict before inexact augmentation.

Returns:
  the n conflict before inexact augmentation

#### setnConflictBeforeInexactAugmentation

    public void setnConflictBeforeInexactAugmentation(int nConflictBeforeInexactAugmentation)

Sets the n conflict before inexact augmentation.

Parameters:
  `nConflictBeforeInexactAugmentation` - the new n conflict before inexact augmentation

#### getnSuccessBeforeInexactDiminution

    public int getnSuccessBeforeInexactDiminution()

Gets the n success before inexact diminution.

Returns:
  the n success before inexact diminution

#### setnSuccessBeforeInexactDiminution

    public void setnSuccessBeforeInexactDiminution(int nSuccessBeforeInexactDiminution)

Sets the n success before inexact diminution.

Parameters:
  `nSuccessBeforeInexactDiminution` - the new n success before inexact diminution

#### getMinInexactAllowed

    public double getMinInexactAllowed()

Gets the min inexact allowed.

Returns:
  the min inexact allowed

#### setMinInexactAllowed

    public void setMinInexactAllowed(double minInexactAllowed)

Sets the min inexact allowed.

Parameters:
  `minInexactAllowed` - the new min inexact allowed

#### getnPropositionsReceived

    public int getnPropositionsReceived()

Gets the n propositions received.

Returns:
  the n propositions received

#### setnPropositionsReceived

    public void setnPropositionsReceived(int nPropositionsReceived)

Sets the n propositions received.

Parameters:
  `nPropositionsReceived` - the new n propositions received

#### isNewContextWasCreated

    public boolean isNewContextWasCreated()

Checks if is new context was created.

Returns:
  true, if is new context was created

#### isContextFromPropositionWasSelected

    public boolean isContextFromPropositionWasSelected()

Checks if is context from proposition was selected.

Returns:
  true, if is context from proposition was selected

#### setContextFromPropositionWasSelected

    public void setContextFromPropositionWasSelected(boolean contextFromPropositionWasSelected)

Sets the context from proposition was selected.

Parameters:
  `contextFromPropositionWasSelected` - the new context from proposition was selected

#### getPrediction

    public double getPrediction()

Gets the prediction.

Returns:
  the prediction

#### setPrediction

    public void setPrediction(double prediction)

Sets the prediction.

Parameters:
  `prediction` - the new prediction