Samchon Framework for CPP  1.0.0
samchon::example::interaction::TSPMaster Class Reference

A master for parallel system solving TSP problem. More...

#include <TSPMaster.hpp>

Collaboration diagram for samchon::example::interaction::TSPMaster:

Public Member Functions

 TSPMaster ()
 Default Constructor. More...
 
- Public Member Functions inherited from samchon::example::interaction::Master
 Master (int port)
 Construct from a port number to listen. More...
 
virtual void start () override
 Start interaction. More...
 
- Public Member Functions inherited from samchon::protocol::master::ParallelClientArray
 ParallelClientArray ()
 Default Constructor. More...
 
- Public Member Functions inherited from samchon::protocol::master::ParallelSystemArray
 ParallelSystemArray ()
 Default Constructor. More...
 
void sendSegmentData (std::shared_ptr< Invoke >, size_t)
 Send a message with segmentation size. More...
 
virtual void sendPieceData (std::shared_ptr< Invoke >, size_t, size_t)
 Send a message with piece index and size. More...
 
- Public Member Functions inherited from samchon::protocol::ExternalSystemArray
 ExternalSystemArray ()
 Default Constructor. More...
 
auto hasRole (const std::string &) const -> bool
 Test whether has a role. More...
 
auto getRole (const std::string &) const -> std::shared_ptr< ExternalSystemRole >
 Get a role. More...
 
virtual void sendData (std::shared_ptr< Invoke >) override
 Sends an Invoke message to related ExternalSystem(s). More...
 
virtual void replyData (std::shared_ptr< Invoke >) override
 Handle replied Invoke message. More...
 
virtual auto TAG () const -> std::string override
 A tag name when represented by XML. More...
 
virtual auto CHILD_TAG () const -> std::string override
 A tag name of children. More...
 
- Public Member Functions inherited from samchon::protocol::EntityGroup< _Container, _ETy, T >
 EntityGroup ()
 Default Constructor. More...
 
auto has (const std::string &key) const -> bool
 Indicates whether a container has an object having the specified identifier. More...
 
auto get (const std::string &key) -> value_type &
 Access the element by specified identifier(key). More...
 
auto get (const std::string &key) const -> const value_type &
 Access the const element by specified identifier(key). More...
 
- Public Member Functions inherited from samchon::protocol::Entity
 Entity ()
 Default Constructor. More...
 
virtual auto key () const -> std::string
 Get a key that can identify the Entity uniquely. More...
 
- Public Member Functions inherited from samchon::protocol::IEntityGroup
 IEntityGroup ()
 Default Constructor. More...
 
- Public Member Functions inherited from samchon::protocol::IProtocol
 IProtocol ()
 Default Constructor. More...
 
- Public Member Functions inherited from samchon::protocol::ExternalClientArray
 ExternalClientArray ()
 Default Constructor. More...
 
virtual void construct (std::shared_ptr< library::XML >) override
 Construct data of the Entity from an XML object. More...
 
virtual auto toXML () const -> std::shared_ptr< library::XML > override
 Get an XML object represents the EntityGroup. More...
 

Static Public Member Functions

static void main ()
 Main function. More...
 

Protected Member Functions

virtual void optimize (shared_ptr< XML > xml) override
 Optimize something. More...
 
virtual void replyOptimization (shared_ptr< XML > xml) override
 Handle (replied) optimized value from a slave system. More...
 
- Protected Member Functions inherited from samchon::example::interaction::Master
virtual void addClient (Socket *socket) override
 Handling connection of a physical client. More...
 
- Protected Member Functions inherited from samchon::protocol::master::ParallelSystemArray
virtual void notifyEnd (PRMasterHistory *)
 Notify end of a master history. More...
 
- Protected Member Functions inherited from samchon::protocol::EntityGroup< _Container, _ETy, T >
virtual auto createChild (std::shared_ptr< library::XML >) -> entity_type *=0
 Factory method of a child Entity. More...
 
- Protected Member Functions inherited from samchon::protocol::ExternalClientArray
virtual auto PORT () const -> int
 Port number of the server. More...
 
virtual auto MY_IP () const -> std::string
 (optional) Server's IP More...
 

Additional Inherited Members

- Protected Attributes inherited from samchon::example::interaction::Master
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...
 
- Protected Attributes inherited from samchon::protocol::ExternalClientArray
std::string myIP
 A custom ip address of my system to bind. More...
 
int port
 A port number for accepting external clients. More...
 

Detailed Description

A master for parallel system solving TSP problem.

[Inherited]

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
Jeongho Nam http://samchon.org

Definition at line 30 of file TSPMaster.hpp.

Constructor & Destructor Documentation

samchon::example::interaction::TSPMaster::TSPMaster ( )
inline

Default Constructor.

Definition at line 46 of file TSPMaster.hpp.

Member Function Documentation

virtual void samchon::example::interaction::TSPMaster::optimize ( shared_ptr< XML xml)
inlineoverrideprotectedvirtual

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 from samchon::example::interaction::Master.

Definition at line 57 of file TSPMaster.hpp.

virtual void samchon::example::interaction::TSPMaster::replyOptimization ( shared_ptr< XML xml)
inlineoverrideprotectedvirtual

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.

Implements samchon::example::interaction::Master.

Definition at line 74 of file TSPMaster.hpp.

static void samchon::example::interaction::TSPMaster::main ( )
inlinestatic

Main function.

Definition at line 112 of file TSPMaster.hpp.

References samchon::example::interaction::Master::start().

Here is the call graph for this function:


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