|
Pakman
|
In order to implement an ABC algorithm in Pakman, you need to formulate the algorithm in an iterative manner in a Controller class. This means that the same iterate() function is called over and over, and at every iteration you have a set of actions that you can take. You can push new tasks to the Master, receive finished tasks, flush the Master's tasks queues, or terminate the Master, as well as any combination of these actions (although you can only terminate the Master once, as the program will then terminate).
The Master can be accessed by the inherited member variable AbstractController::m_p_master. For example, terminating the Master is done by calling m_p_master->terminate(). See the documentation of AbstractMaster for a full list of public member functions that you can use in a Controller class.
The classes ABCRejectionController, ABCSMCController, and SweepController provide examples of how to implement the ABC rejection, the ABC SMC, and the parameter sweep algorithms iteratively.
In order to integrate a new Controller class called ExampleController into Pakman, you need to follow these steps:
example Controller type to the controller_t enum type, defined in common.h.else if statement to AbstractController::getController() in AbstractControllerStatic.cc to translate the appropriate command-line argument into the right controller_t value.src/controller/ExampleController.h that inherits from AbstractController.src/controller/ExampleController.cc.help(), addLongOptions(), and makeController() in src/controller/ExampleControllerStatic.cc.switch statements in AbstractController::help(), AbstractController::addLongOptions(), and AbstractController::makeController() in AbstractControllerStatic.cc.ExampleController.cc and ExampleControllerStatic.cc to src/controller/CMakeLists.txt.