Samchon Framework for CPP  1.0.0
samchon::example::interaction::Master Class Referenceabstract

A master of parallel system solving something. More...

#include <Master.hpp>

Public Member Functions

 Master (int port)
 Construct from a port number to listen. More...
 

Protected Member Functions

virtual void optimize (shared_ptr< XML > xml)
 Optimize something. More...
 
virtual void replyOptimization (shared_ptr< XML > xml)=0
 Handle (replied) optimized value from a slave system. More...
 

Protected Attributes

unique_ptr< ChiefDriverchiefDriver
 A boundary object interacting with a Cheif. More...
 
mutex mtx
 A mutex for optimization. More...
 
size_t optimized
 Number of slaves who'd completed an optimization. More...
 

Detailed Description

A master of parallel system solving something.

Master is an abstract and example class, for providing guidance of realizing parallel processing system for users, within framework of master. The Master class represents a master of parallel processing system in the master side.

A master system (represented by Master and MasterDriver) is associated with a chief system (represented by Cheif and CheifDriver) and slave systems (Slave and SlaveDriver). The master system gets optimization order from chief system and shifts and distributes orders to its slave systems. When slave systems report optimization result, the master system aggregates those results and reports the aggregated results to chief system.

example_interaction.png
example_interaction_network_diagram.png
[Inherited]
See also
master
Author
Jeongho Nam http://samchon.org

Definition at line 49 of file Master.hpp.

Constructor & Destructor Documentation

samchon::example::interaction::Master::Master ( int  port)
inline

Construct from a port number to listen.

Parameters
portPort number to listen.

Definition at line 83 of file Master.hpp.

Member Function Documentation

virtual void samchon::example::interaction::Master::optimize ( shared_ptr< XML xml)
inlineprotectedvirtual

Optimize something.

Master gets an XML object representing parametric value and basic data used for optimzation are came from Cheif. Master constructs some object to optimize and distributes the optimization order to master's slave systems by segmentation.

Parameters
xmlXML object representing parametric value and basic data used for optimization.

Reimplemented in samchon::example::interaction::PackerMaster, and samchon::example::interaction::TSPMaster.

Definition at line 147 of file Master.hpp.

virtual void samchon::example::interaction::Master::replyOptimization ( shared_ptr< XML xml)
protectedpure virtual

Handle (replied) optimized value from a slave system.

When gets optimization result from Slave systems, Master aggregates them and derives the best solution between those results and reports the best solution to the Cheif system.

Parameters
xmlXML object representing the optimized value.

Implemented in samchon::example::interaction::PackerMaster, and samchon::example::interaction::TSPMaster.

Member Data Documentation

unique_ptr<ChiefDriver> samchon::example::interaction::Master::chiefDriver
protected

A boundary object interacting with a Cheif.

Definition at line 59 of file Master.hpp.

mutex samchon::example::interaction::Master::mtx
protected

A mutex for optimization.

The mutex exists for ensuring concurrency of aggregation of optimization reported from slave systems.

Definition at line 67 of file Master.hpp.

size_t samchon::example::interaction::Master::optimized
protected

Number of slaves who'd completed an optimization.

Definition at line 72 of file Master.hpp.


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