Skip to content

sam::Researcher

This class describes a researcher. More...

#include <Researcher.h>

Public Functions

Name
Researcher() =default
void preProcessData()
Applies the pro-processing methods on the Experiment.
bool isHacker()
Determines whether the Researcher is a hacker.
bool isCommittingToTheHack(HackingStrategy * hs)
Determines whether the Researcher will commit to the given hack.
void research()
Perform the Research.
std::optional< SubmissionPool > hackTheResearch()
Applies the HackingWorkflow on the Experiment.
void randomizeHackingStrategies()
Randomizes the internal state of the Researcher.
void submitTheResearch(const std::optional< std::vector< Submission >> & subs)
Evaluating the candidates and submitting them to the Journal.
void computeStuff() const
A helper function for re-computing all statistics at once.
void reset()
Resets the internal state of the Researcher.
ResearcherBuilder create(std::string name)

Public Attributes

Name
std::vector< std::unique_ptr< HackingStrategy > > pre_processing_methods
std::unique_ptr< Experiment > experiment
Researcher's Experiment.
std::shared_ptr< Journal > journal
Researcher's Journal of choice!
std::unique_ptr< ResearchStrategy > research_strategy
Researcher's Research Strategy.
HackingWorkflow original_workflow
Original set of hacking strategies and their Selection→Decision sequences.
HackingWorkflow hacking_workflow

Friends

Name
class ResearcherBuilder

Detailed Description

class sam::Researcher;

This class describes a researcher.

Researcher is the main player of the game. It has access to almost everything and it works with several other components to conduct and evaluate the research, and prepare it to be submitted to the Journal.

Public Functions Documentation

function Researcher

Researcher() =default

This doesn't do anything! But it should! At the moment, I'm relying on the ResearcherBuilder to construct the Researcher but this has to change

function preProcessData

void preProcessData()

Applies the pro-processing methods on the Experiment.

Note: This has a very similar implementation to the [hackTheResearch()](/doxygen/Classes/classsam_1_1_researcher/#function-hacktheresearch) but it doesn't perform any of the secondary checks, and it does not incorporates any of the selection → decision sequences.

Iterating over the registered pre_processing_methods, this applies all of the them to the current experiment. Keep in mind that the pre-processing is done before any of the decision/hacking stages, and right after data generation.

function isHacker

bool isHacker()

Determines whether the Researcher is a hacker.

Note: Note that the #probability_of_being_a_hacker is called through it's call operator(). This guarantees that its value is being randomized only if it contains a distribution.

This technically invokes the #probability_of_being_a_hacker, and returns the outcome. The value then will be cast-ed to a boolean to determine whether the Researcher is going to start the hacking procedure or not, ie., calling or skipping the hackTheResearch().

function isCommittingToTheHack

bool isCommittingToTheHack(
    HackingStrategy * hs
)

Determines whether the Researcher will commit to the given hack.

Similar to the isHacker() method, this returns a boolean indicating whether or not the Researcher will commit to the given hacking method. The probability of commitment to a hacking strategy is being calculated from the value of #probability_of_committing_a_hack.

function research

void research()

Perform the Research.

This is the main routine of the Researcher. It is responsible for a few things:

  • Randomizing the Experiment, if necessary
  • Initializing the Experiment
  • Performing the research by:
    • Generating the data
    • Pre-processing the Data, if necessary
    • Calculating the statistics
    • Deciding whether to hack or not
      • Perform the hack, if necessary
    • Deciding whether to replicate the research
      • Perform the replication, if necessary
    • Evaluate the list of final submissions
    • Submit the final submissions to the Journal, or discard the Experiment
    • Clean up everything, and start a get ready for a new run The internal of the method is based on sequential application of selection → decision sequences on the experiment. Throughout the process, the researcher keeps the list of candidate submissions, #candidate_submissions, up-to-date. This starts by the initial selection, and following though with the hacking, and stashing selection. At the end of each replication, if any, researcher collects the last submission candidate and head to perform a new experiment. After performing all the replications (or skipping some), researcher perform a final selection → decision on the list of #replicated_submissions and select her final submission to be submitted to the Journal.

function hackTheResearch

std::optional< SubmissionPool > hackTheResearch()

Applies the HackingWorkflow on the Experiment.

Return: Returns true if any of the decision steps passes, it returns false indicating that none of the selection → decisions were successful.

This uses HackingWorkflow to sequentially apply sets of hacking → selection → decision on the available Experiment. Before applying each hacking strategy, researcher asks isCommittingToTheHack() to decide on whether or not it is going to commit to a hack, if not, the rest of the set will be ignored, and researcher continues with the next set, if available.

function randomizeHackingStrategies

void randomizeHackingStrategies()

Randomizes the internal state of the Researcher.

Note: It worth mentioning that, this method doesn't randomize the internal parameters of individual hacking strategies. Hacking strategies parameters can be randomized only if their parameters are set to be a Parameter.

Based on the provided settings, this re-selects, re-arranges, and shuffles the list of hacking strategies, and their corresponding parameters.

function submitTheResearch

void submitTheResearch(
    const std::optional< std::vector< Submission >> & subs
)

Evaluating the candidates and submitting them to the Journal.

This checks whether there is any submissions at all, if so, it checks whether submission_decision_policies have any hits, if so, it gives a green light to Researcher to submit the list of submissions; otherwise, it discards the list.

function computeStuff

inline void computeStuff() const

A helper function for re-computing all statistics at once.

function reset

inline void reset()

Resets the internal state of the Researcher.

function create

static ResearcherBuilder create(
    std::string name
)

Parameters:

  • name The researcher name

Return: An instance of ResearcherBuilder.

Starts the Researcher build process. Use this to build a new instance of the Researcher.

Public Attributes Documentation

variable pre_processing_methods

std::vector< std::unique_ptr< HackingStrategy > > pre_processing_methods;

List of hacking strategies that are going to be applied on the experiment during the pre-processing stage

variable experiment

std::unique_ptr< Experiment > experiment;

Researcher's Experiment.

variable journal

std::shared_ptr< Journal > journal;

Researcher's Journal of choice!

variable research_strategy

std::unique_ptr< ResearchStrategy > research_strategy;

Researcher's Research Strategy.

variable original_workflow

HackingWorkflow original_workflow;

Original set of hacking strategies and their Selection→Decision sequences.

variable hacking_workflow

HackingWorkflow hacking_workflow;

Researcher's hacking workflow. This is a subset of the original_workflow, as it is being filtered and rearranged by various factors during the initialization.

Friends

friend ResearcherBuilder

friend class ResearcherBuilder(
    ResearcherBuilder 
);

Updated on 29 June 2021 at 16:13:46 CEST


Last update: 2021-09-18