FRODO Version 2.19.1
An open-source framework for Distributed Constraint Optimization (DCOP)
Loading...
Searching...
No Matches
frodo2.controller.Controller Class Reference

The controller class, a container for the listeners that do the actual work. More...

Inheritance diagram for frodo2.controller.Controller:

Public Member Functions

 Controller (boolean local, boolean ui, String workDir)
 Constructor for the controller.
 Controller (DistributedSolver<?, ?, ?> solver)
 Constructor to use a solver in distributed mode.
 Controller (boolean local, boolean ui)
 Constructor for the controller.
 Controller (boolean local, boolean ui, String testDir, int size)
void addAgent (String agentId, AgentInterface<?> agent)
 Function to add agents to the repository.
void addOutputPipe (String fromID, String toID, QueueOutputPipeInterface pipe)
 Add agent toID's input pipe as an output pipe to agent fromID's queue.
Collection< String > getAgents ()
void exit (boolean quit)
 This function must be called to stop the controller.
void setFinished ()
 This functions sets a boolean value to true when finished.
void endQueue ()
 This function is there mainly for test purposes and can be removed in the end.
void clearAgents ()
 Delete all the agents from the repository.

Static Public Member Functions

static void main (String[] args)

Public Attributes

boolean isSuspended = false
 is true when the experiment is suspended and false otherwise
boolean isStopped = true
 Is true when the experiment has stopped and false when it is running.
boolean isFinished = false
 Is true when the experiments are finished.
Object isFinishedSync
 Used to synchronized access to isFinished.

Static Public Attributes

static final String CONTROLLER = "frodo2.controller.Controller"
 The destination ID of messages that are meant for the Controller.
static PipeFactory PipeFactoryInstance = new TCPPipeFactory()
 The instance of the PipeFactory Visitor.
static final int PORT = 3000
 The port the controller is listening to.
static Integer daemonNb = null
 counts the number of instantiated daemon in order to launch the controller when everybody is ready.

Protected Attributes

Queue controlQueue
 The queue that is used to send and receive messages.

Private Member Functions

void init (String workDir, DistributedSolver<?, ?, ?> solver)
 Initializes the controller.
void initLocal (boolean ui, String workDir)
 Initializes the controller for running the experiments itself.
void run ()
 Start the controller.

Private Attributes

UserIO userIO
 userIO takes care of all the user input and output
ConfigurationManager confManager
 the configuration manager sets up the experiments
WhitePages wp
 The global white pages.
LocalWhitePages lwp
 The local white pages, used when the experiments are run locally.
Constructor constructor
 The agent constructor, used when the experiments are run locally.
HashMap< String, AgentInterface<?> > agents
 Agent repository, used when experiments are run locally.
QueueInputPipeInterface input
 The input pipe for external messages.

Detailed Description

The controller class, a container for the listeners that do the actual work.

Author
Brammert Ottens
Thomas Leaute

Constructor & Destructor Documentation

◆ Controller() [1/4]

frodo2.controller.Controller.Controller ( boolean local,
boolean ui,
String workDir )

Constructor for the controller.

Experiments can either be run on the same machine the controller is running on, or on (a) separate machine(s).

Parameters
localtrue if the experiments are run locally
uitrue if the user interface should be used
workDirfolder containing the files mentioned in the configuration document. Must end with a slash.

References init(), and initLocal().

Referenced by init(), and main().

Here is the call graph for this function:

◆ Controller() [2/4]

frodo2.controller.Controller.Controller ( DistributedSolver<?, ?, ?> solver)

Constructor to use a solver in distributed mode.

Parameters
solverthe distributed solver

References init().

Here is the call graph for this function:

◆ Controller() [3/4]

frodo2.controller.Controller.Controller ( boolean local,
boolean ui )

Constructor for the controller.

Experiments can either be run on the same machine the controller is running on, or on (a) separate machine(s).

Parameters
localtrue if the experiments are run locally
uitrue if the user interface should be used

◆ Controller() [4/4]

frodo2.controller.Controller.Controller ( boolean local,
boolean ui,
String testDir,
int size )
Parameters
localtrue if the experiments are run locally
uitrue if the user interface should be used
testDirthe working directory
sizethe number of daemon to be instantiated

References daemonNb.

Member Function Documentation

◆ addAgent()

void frodo2.controller.Controller.addAgent ( String agentId,
AgentInterface<?> agent )

Function to add agents to the repository.

Only to be used when the experiments are run locally

Parameters
agentIdthe agent's ID
agentthe agent itself

References agents, and userIO.

◆ addOutputPipe()

void frodo2.controller.Controller.addOutputPipe ( String fromID,
String toID,
QueueOutputPipeInterface pipe )

Add agent toID's input pipe as an output pipe to agent fromID's queue.

Parameters
fromIDthe ID of the sender agent
toIDthe ID of the recipient agent
pipethe pipe

References agents.

◆ clearAgents()

void frodo2.controller.Controller.clearAgents ( )

Delete all the agents from the repository.

References agents.

◆ endQueue()

void frodo2.controller.Controller.endQueue ( )

This function is there mainly for test purposes and can be removed in the end.

References controlQueue.

◆ exit()

void frodo2.controller.Controller.exit ( boolean quit)

This function must be called to stop the controller.

Parameters
quitwhether the JVM should be terminated

References controlQueue.

◆ getAgents()

Collection< String > frodo2.controller.Controller.getAgents ( )
Returns
the set of agents known to the controller

References agents.

◆ init()

void frodo2.controller.Controller.init ( String workDir,
DistributedSolver<?, ?, ?> solver )
private

Initializes the controller.

Parameters
workDirfolder containing the files mentioned in the configuration document. Must end with a slash.
solverthe distributed solver, if any

References confManager, Controller(), controlQueue, isFinishedSync, PORT, userIO, and wp.

Referenced by Controller(), and Controller().

Here is the call graph for this function:

◆ initLocal()

void frodo2.controller.Controller.initLocal ( boolean ui,
String workDir )
private

Initializes the controller for running the experiments itself.

Parameters
uicurrently unused parameter
workDirfolder containing the files mentioned in the configuration document. Must end with a slash.
Bug
ui is not used.

References agents, confManager, constructor, controlQueue, input, isFinishedSync, lwp, and userIO.

Referenced by Controller().

◆ main()

void frodo2.controller.Controller.main ( String[] args)
static
Parameters
argsif -local then the experiments are run on the local machine (default is distributed) if -license is passed as an argument, displays the license and returns

References Controller().

Here is the call graph for this function:

◆ run()

void frodo2.controller.Controller.run ( )
private

Start the controller.

References userIO.

◆ setFinished()

void frodo2.controller.Controller.setFinished ( )

This functions sets a boolean value to true when finished.

References isFinished, and isFinishedSync.

Member Data Documentation

◆ agents

HashMap< String, AgentInterface<?> > frodo2.controller.Controller.agents
private

Agent repository, used when experiments are run locally.

Referenced by addAgent(), addOutputPipe(), clearAgents(), getAgents(), and initLocal().

◆ confManager

ConfigurationManager frodo2.controller.Controller.confManager
private

the configuration manager sets up the experiments

Referenced by init(), and initLocal().

◆ constructor

Constructor frodo2.controller.Controller.constructor
private

The agent constructor, used when the experiments are run locally.

Referenced by initLocal().

◆ CONTROLLER

◆ controlQueue

Queue frodo2.controller.Controller.controlQueue
protected

◆ daemonNb

Integer frodo2.controller.Controller.daemonNb = null
static

counts the number of instantiated daemon in order to launch the controller when everybody is ready.

Referenced by Controller().

◆ input

QueueInputPipeInterface frodo2.controller.Controller.input
private

The input pipe for external messages.

Referenced by initLocal().

◆ isFinished

boolean frodo2.controller.Controller.isFinished = false

Is true when the experiments are finished.

Referenced by setFinished().

◆ isFinishedSync

Object frodo2.controller.Controller.isFinishedSync

Used to synchronized access to isFinished.

Referenced by init(), initLocal(), and setFinished().

◆ isStopped

boolean frodo2.controller.Controller.isStopped = true

Is true when the experiment has stopped and false when it is running.

◆ isSuspended

boolean frodo2.controller.Controller.isSuspended = false

is true when the experiment is suspended and false otherwise

◆ lwp

LocalWhitePages frodo2.controller.Controller.lwp
private

The local white pages, used when the experiments are run locally.

Referenced by initLocal().

◆ PipeFactoryInstance

◆ PORT

final int frodo2.controller.Controller.PORT = 3000
static

◆ userIO

UserIO frodo2.controller.Controller.userIO
private

userIO takes care of all the user input and output

Referenced by addAgent(), init(), initLocal(), and run().

◆ wp

WhitePages frodo2.controller.Controller.wp
private

The global white pages.

Referenced by init().


The documentation for this class was generated from the following file: