|
FRODO Version 2.19.1
An open-source framework for Distributed Constraint Optimization (DCOP)
|
The ConfigurationManager takes care of setting up the experiments. More...

Public Member Functions | |
| ConfigurationManager (Controller control, boolean local, String workDir) | |
| The constructor of the Configuration manager. | |
| ConfigurationManager (Controller control, boolean local) | |
| The constructor of the Configuration manager. | |
| Collection< MessageType > | getMsgTypes () |
| void | notifyIn (Message msg) |
| The Configuration Manager is triggered by the reception of a CONFIGURATION message, containing a filename that points to the configuration file. | |
| void | setQueue (Queue queue) |
| int | parseConfigurationFile (String configFile) throws JDOMException, IOException |
| This function parses the "configuration" element in the experiment file. | |
| boolean | getDebug () |
| A getter function for testing purposes. | |
| String | getAgentDescription () |
| A getter function for testing purposes. | |
| int | getTimeOut () |
| A getter function for testing purposes. | |
| String | getLogClass () |
| A getter function for testing purposes. | |
| String | getResultFile () |
| A getter function for testing purposes. | |
| HashMap< String, AgentAddress > | getDaemonList () |
| A getter function for testing purposes. | |
| long | getNCCCs () |
| Public Member Functions inherited from frodo2.communication.IncomingMsgPolicyInterface< T > | |
| default void | notifyIn (Message msg, Object toAgent) |
| Notifies the listener of an incoming message. | |
Static Public Attributes | |
| static final MessageType | AGENT_CONFIGURATION_MESSAGE = MessageType.SYSTEM.newChild("ConfigurationManager", "Agent-Configuration") |
| The message send to the Daemon that contain the configuration of an agent. | |
| static final MessageType | REQUEST_DAEMONS_CONFIG_MSG = MessageType.SYSTEM.newChild("ConfigurationManager", "Request-Daemons-Config") |
| The message type used to ask the white pages for a list of available daemons. | |
| static final MessageType | START = MessageType.SYSTEM.newChild("ConfigurationManager", "Start") |
| Message used to tell the white pages that the algorithm can start. | |
| static final MessageType | CONNECT = MessageType.SYSTEM.newChild("ConfigurationManager", "Connect") |
| Message used to tell the white pages that the agent can connect to their neighbours. | |
| static final MessageType | KILL_ALL_AGENTS = MessageType.SYSTEM.newChild("ConfigurationManager", "Kill-All-Agents") |
| Message to signal to the white pages to kill the agents. | |
| static final String | END_TEXT = "All experiments are finished" |
| The text displayed when the experiment is over. | |
Protected Member Functions | |
| ConfigurationManager () | |
| Empty constructor. | |
| void | tellUser (String message) |
| This function is used to send a message to the user via the UI. | |
| void | runExperiment (String filename) |
| This file sets up a specific problem and tells the agents to run it. | |
| void | distributeAgents (DCOPProblemInterface<?, ?> problem) throws Exception |
| Distributes the agents among the daemons. | |
Protected Attributes | |
| Queue | queue |
| The queue on which it should call sendMessage(). | |
| ArrayList< MessageType > | msgTypes = new ArrayList <MessageType> () |
| The list of messages types this listener wants to be notified of. | |
| Element | problemList |
| After the configuration file has been loaded, this contains a list of problems that will be solved when the experiment starts. | |
| Document | agentDescriptionDoc |
| The JDOM Document describing the agent configuration. | |
| int | problem |
| the experiment that is currently run | |
| int | numberOfAgents |
| Number of agents in the problem that is currently run. | |
| int | numberOfAgentsFinished |
| The number of agents that reported to be finished. | |
| String | workDir |
| Folder containing the files mentioned in the configuration document. | |
Private Member Functions | |
| void | sendEmptyConfigs () |
| Sends empty configuration messages to all daemons, telling them to look up their own local config files. | |
| void | cleanProblem () |
| Reset all the fields used in monitoring the problem. | |
Private Attributes | |
| Document | configDoc |
| contains the parsed XML tree with the configuration information | |
| boolean | debug |
| when debug is true, debugging is enabled | |
| String | logClass |
| logClass contains the name of the class that the agents should use when logging their actions | |
| String | agentDescriptionFile |
| agentDescription contains the filename of the XML file that describes the default agent that should be used | |
| int | timeOut |
| timeOut contains the maximum time any agent should run the algorithm. | |
| String | resultFile |
| resultFile contains the file name of the file where the results of the experiments should be stored | |
| HashMap< String, AgentAddress > | daemonList |
| The list of daemons that are available. | |
| Controller | control |
| The main controller class. | |
| String | agentName |
| The name of the agent, used to find the agent description when the configuration file is to be found in a jar file. | |
| int | numberOfAgentsReported |
| The number of agents that reported to be white pages. | |
| int | numberOfAgentsConnected |
| The number of agents that are connected to their children. | |
| boolean | local |
| Used to determine whether experiments should be run local or not. | |
| long | finalNCCCcount = -1 |
| The nccc stamp of the AGENT_FINISHED message with the highest nccc stamp. | |
| boolean | measureMsgs = false |
| Whether to measure the number of messages and the total amount of information sent. | |
| TreeMap< MessageType, Integer > | msgNbrs |
| For each message type, the number of messages sent of that type. | |
| TreeMap< Object, Integer > | msgNbrsSentPerAgent = new TreeMap<Object, Integer> () |
| For each agent, the number of messages sent by that agent. | |
| TreeMap< Object, Integer > | msgNbrsReceivedPerAgent = new TreeMap<Object, Integer> () |
| For each agent, the number of messages received by that agent. | |
| TreeMap< MessageType, Long > | msgSizes |
| For each message type, the total amount of information sent in messages of that type, in bytes. | |
| TreeMap< Object, Long > | msgSizesSentPerAgent = new TreeMap<Object, Long> () |
| For each agent, the total amount of information sent by that agent, in bytes. | |
| TreeMap< Object, Long > | msgSizesReceivedPerAgent = new TreeMap<Object, Long> () |
| For each agent, the total amount of information received by that agent, in bytes. | |
| TreeMap< MessageType, Long > | maxMsgSizes |
| For each message type, the size (in bytes) of the largest message. | |
| Collection< StatsReporter > | statsReporters |
| The statistics listeners. | |
| long | startTime |
| The start time of the algorithm, in milliseconds. | |
The ConfigurationManager takes care of setting up the experiments.
|
protected |
Empty constructor.
Referenced by parseConfigurationFile().
| frodo2.controller.ConfigurationManager.ConfigurationManager | ( | Controller | control, |
| boolean | local, | ||
| String | workDir ) |
The constructor of the Configuration manager.
| control | a pointer to the control to stop the UI when something goes wrong |
| local | true if the experiments run on the same machine |
| workDir | folder containing the files mentioned in the configuration document. Must end with a slash. |
References frodo2.algorithms.AgentInterface< V extends Addable< V > >.AGENT_CONNECTED, frodo2.algorithms.AgentInterface< V extends Addable< V > >.AGENT_FINISHED, frodo2.controller.WhitePages.AGENT_REPORTED, frodo2.controller.WhitePages.ALL_AGENTS_KILLED, frodo2.controller.userIO.UserIO.CONFIGURATION_MSG, control, frodo2.controller.WhitePages.DEAMONS_CONFIG_MSG, local, msgTypes, frodo2.controller.userIO.UserIO.START_MSG, and workDir.
| frodo2.controller.ConfigurationManager.ConfigurationManager | ( | Controller | control, |
| boolean | local ) |
|
private |
Reset all the fields used in monitoring the problem.
References frodo2.communication.Queue.deleteStatsReporters(), finalNCCCcount, numberOfAgents, numberOfAgentsConnected, numberOfAgentsFinished, numberOfAgentsReported, and statsReporters.

|
protected |
Distributes the agents among the daemons.
| problem | the problem instance |
| Exception | if an error occurs |
Reimplemented in frodo2.daemon.LocalConfigManager.
References AGENT_CONFIGURATION_MESSAGE, daemonList, local, numberOfAgents, numberOfAgentsConnected, numberOfAgentsFinished, numberOfAgentsReported, problem, and queue.
Referenced by runExperiment().
| String frodo2.controller.ConfigurationManager.getAgentDescription | ( | ) |
| HashMap< String, AgentAddress > frodo2.controller.ConfigurationManager.getDaemonList | ( | ) |
| boolean frodo2.controller.ConfigurationManager.getDebug | ( | ) |
| String frodo2.controller.ConfigurationManager.getLogClass | ( | ) |
| Collection< MessageType > frodo2.controller.ConfigurationManager.getMsgTypes | ( | ) |
Implements frodo2.communication.MessageListener< T >.
References msgTypes.
| long frodo2.controller.ConfigurationManager.getNCCCs | ( | ) |
| String frodo2.controller.ConfigurationManager.getResultFile | ( | ) |
| int frodo2.controller.ConfigurationManager.getTimeOut | ( | ) |
| void frodo2.controller.ConfigurationManager.notifyIn | ( | Message | msg | ) |
The Configuration Manager is triggered by the reception of a CONFIGURATION message, containing a filename that points to the configuration file.
The configuration file is a XML file containing the following information
| msg | the message that has been received |
After the START_MSG has been received, adding a new daemon has no effect.
When the white pages return a set of daemons, the experiments can start
An agent has reported itself
An agent is connected to all its neighbours
An agent has finished
All agents are killed, we are ready for the next problem to be solved
Implements frodo2.communication.IncomingMsgPolicyInterface< T >.
Reimplemented in frodo2.daemon.LocalConfigManager.
References frodo2.controller.userIO.UserIO.CONFIGURATION_MSG, frodo2.communication.MessageType.equals(), and notifyIn().
Referenced by notifyIn().

| int frodo2.controller.ConfigurationManager.parseConfigurationFile | ( | String | configFile | ) | throws JDOMException, IOException |
This function parses the "configuration" element in the experiment file.
| configFile | A string containing the filename of the experimental file |
| JDOMException | if an error occurred when parsing the configuration file |
| IOException | if an error occurred when accessing the configuration file |
References agentDescriptionFile, agentName, configDoc, ConfigurationManager(), debug, logClass, problemList, resultFile, tellUser(), timeOut, and workDir.

|
protected |
This file sets up a specific problem and tells the agents to run it.
| filename | the name of the XCSP problem file (without the path) |
References distributeAgents(), frodo2.algorithms.StatsReporter.getStatsFromQueue(), measureMsgs, frodo2.algorithms.XCSPparser< V extends Addable< V >, U extends Addable< U > >.parse(), problem, statsReporters, and workDir.
Referenced by frodo2.daemon.LocalConfigManager.notifyIn().

|
private |
Sends empty configuration messages to all daemons, telling them to look up their own local config files.
References AGENT_CONFIGURATION_MESSAGE, numberOfAgents, numberOfAgentsConnected, numberOfAgentsFinished, numberOfAgentsReported, and frodo2.communication.Queue.sendMessage().

| void frodo2.controller.ConfigurationManager.setQueue | ( | Queue | queue | ) |
Implements frodo2.communication.MessageListener< T >.
References queue.
|
protected |
This function is used to send a message to the user via the UI.
| message | the message to be send to the user |
References queue, and frodo2.controller.userIO.UserIO.USER_NOTIFICATION_MSG.
Referenced by frodo2.daemon.LocalConfigManager.notifyIn(), and parseConfigurationFile().
|
static |
The message send to the Daemon that contain the configuration of an agent.
Referenced by frodo2.daemon.Constructor.Constructor(), frodo2.daemon.Constructor.Constructor(), distributeAgents(), frodo2.daemon.LocalConfigManager.distributeAgents(), frodo2.daemon.LocalConfigManager.LocalConfigManager(), frodo2.controller.TestConfigurationManager.SimpleDaemonListener.notifyIn(), frodo2.daemon.Constructor.notifyIn(), frodo2.daemon.LocalConfigManager.notifyIn(), sendEmptyConfigs(), frodo2.controller.TestConfigurationManager.SimpleDaemonListener.SimpleDaemonListener(), and frodo2.daemon.userIO.UserIO.UserIO().
|
protected |
The JDOM Document describing the agent configuration.
Referenced by frodo2.daemon.LocalConfigManager.distributeAgents().
|
private |
agentDescription contains the filename of the XML file that describes the default agent that should be used
Referenced by getAgentDescription(), and parseConfigurationFile().
|
private |
The name of the agent, used to find the agent description when the configuration file is to be found in a jar file.
Referenced by parseConfigurationFile().
|
private |
contains the parsed XML tree with the configuration information
Referenced by parseConfigurationFile().
|
static |
Message used to tell the white pages that the agent can connect to their neighbours.
Referenced by frodo2.daemon.LocalWhitePages.LocalWhitePages(), and frodo2.controller.WhitePages.WhitePages().
|
private |
The main controller class.
Referenced by ConfigurationManager(), and ConfigurationManager().
|
private |
The list of daemons that are available.
Referenced by distributeAgents(), and getDaemonList().
|
private |
when debug is true, debugging is enabled
Referenced by getDebug(), and parseConfigurationFile().
|
static |
The text displayed when the experiment is over.
Referenced by frodo2.controller.userIO.DistributedSolver< V extends Addable< V >, U extends Addable< U >, S extends Solution< V, U >.tellUser().
|
private |
The nccc stamp of the AGENT_FINISHED message with the highest nccc stamp.
Referenced by cleanProblem().
|
static |
Message to signal to the white pages to kill the agents.
Referenced by frodo2.daemon.LocalWhitePages.LocalWhitePages(), frodo2.controller.TestWhitePages.testKillAllAgents(), and frodo2.controller.WhitePages.WhitePages().
|
private |
Used to determine whether experiments should be run local or not.
Referenced by ConfigurationManager(), ConfigurationManager(), and distributeAgents().
|
private |
logClass contains the name of the class that the agents should use when logging their actions
Referenced by getLogClass(), and parseConfigurationFile().
|
private |
For each message type, the size (in bytes) of the largest message.
|
private |
Whether to measure the number of messages and the total amount of information sent.
Referenced by runExperiment().
|
private |
For each message type, the number of messages sent of that type.
|
private |
For each agent, the number of messages received by that agent.
|
private |
For each agent, the number of messages sent by that agent.
|
private |
For each message type, the total amount of information sent in messages of that type, in bytes.
|
private |
For each agent, the total amount of information received by that agent, in bytes.
|
private |
For each agent, the total amount of information sent by that agent, in bytes.
|
protected |
The list of messages types this listener wants to be notified of.
Referenced by ConfigurationManager(), and getMsgTypes().
|
protected |
Number of agents in the problem that is currently run.
Referenced by cleanProblem(), distributeAgents(), and sendEmptyConfigs().
|
private |
The number of agents that are connected to their children.
Referenced by cleanProblem(), distributeAgents(), and sendEmptyConfigs().
|
protected |
The number of agents that reported to be finished.
Referenced by cleanProblem(), distributeAgents(), and sendEmptyConfigs().
|
private |
The number of agents that reported to be white pages.
Referenced by cleanProblem(), distributeAgents(), and sendEmptyConfigs().
|
protected |
the experiment that is currently run
Referenced by distributeAgents(), frodo2.daemon.LocalConfigManager.distributeAgents(), frodo2.daemon.LocalConfigManager.notifyIn(), and runExperiment().
|
protected |
After the configuration file has been loaded, this contains a list of problems that will be solved when the experiment starts.
Referenced by frodo2.daemon.LocalConfigManager.notifyIn(), and parseConfigurationFile().
|
protected |
The queue on which it should call sendMessage().
Referenced by distributeAgents(), frodo2.daemon.LocalConfigManager.notifyIn(), setQueue(), and tellUser().
|
static |
The message type used to ask the white pages for a list of available daemons.
Referenced by frodo2.controller.WhitePages.notifyIn(), and frodo2.controller.WhitePages.WhitePages().
|
private |
resultFile contains the file name of the file where the results of the experiments should be stored
Referenced by getResultFile(), and parseConfigurationFile().
|
static |
Message used to tell the white pages that the algorithm can start.
Referenced by frodo2.daemon.LocalWhitePages.LocalWhitePages(), and frodo2.controller.WhitePages.WhitePages().
|
private |
The start time of the algorithm, in milliseconds.
|
private |
The statistics listeners.
Referenced by cleanProblem(), and runExperiment().
|
private |
timeOut contains the maximum time any agent should run the algorithm.
If timeOut = -1, not timeOut is specified
Referenced by getTimeOut(), and parseConfigurationFile().
|
protected |
Folder containing the files mentioned in the configuration document.
Must end with a slash.
Referenced by ConfigurationManager(), frodo2.daemon.LocalConfigManager.LocalConfigManager(), parseConfigurationFile(), and runExperiment().