Class bi_tab

Nested Relationships

Nested Types

Inheritance Relationships

Base Types

Class Documentation

class bi_tab : public cosm::ta::metrics::bi_tab_metrics, public rer::client<bi_tab>

Represents Bi Task Allocation Block (TAB) which consists of a root task and two subtasks the root task decomposes into. The subtasks may or may not be capable of being further decomposed, and therefore the roots of additional TABs.

Public Functions

bi_tab(const bi_tab &other) = delete
bi_tab(const struct elements *elts, const config::task_partition_config *partitioning, const config::src_sigmoid_sel_config *subtask_sel)
~bi_tab(void) override
inline const polled_task *active_task(void) const

Return the activity task in the TAB (that is, the task that is currently being executed). If the active task in the executive is not in this TAB, then nullptr is returned.

inline const polled_task *child1(void) const

Return the left child of the root (we use a left-to-right numbering scheme).

inline const polled_task *child2(void) const

Return the right child of the root (we use a left-to-right numbering scheme).

bool contains_task(const polled_task *task) const

Returns TRUE iff the argument is one of the 3 tasks in the TAB.

Parameters:

task – The task to check.

inline virtual bool employed_partitioning(void) const override

This function should return TRUE, if a robot has chosen to employ task partitioning when allocating itself its next task.

Returns:

Valid only when task_changed() returns TRUE.

inline void last_subtask(const polled_task *t)

Return the most recently executed subtask task1 or task2; updated on task abort or finish in task_abort_update() and task_finish_update respectively.

inline const polled_task *last_task(void) const

Return the most recently executed task; updated on task abort or finish in task_abort_update() and task_finish_update respectively.

bi_tab &operator=(const bi_tab&) = delete
virtual double partition_prob(void) const override

Return the current value of the partition probability within the TAB. Does not recompute.

void partition_prob_update(rmath::rng *rng)

Update the partition probability based after a task has been finished or aborted. Happens as part of task_abort_update() and task_finish_update(), so should never need to be called directly, except in corner cases during initialization.

inline const polled_task *root(void) const

Return the TAB root (always a partitionable task), also known as task0 within the TAB.

inline virtual bool root_active(void) const override

This function should return if the root is currently the active task.

Returns:

Valid at any time.

inline virtual bool subtask1_active(void) const override

This function should return if subtask1 is currently the active task.

Returns:

Valid at any time.

inline virtual bool subtask2_active(void) const override

This function should return if subtask2 is currently the active task.

Returns:

Valid at any time.

virtual double subtask_selection_prob(void) const override

Return the current value of the subtask selection probability within the TAB. Does not recompute.

void task_abort_update(polled_task *aborted, rmath::rng *rng)

Updates the TAB after task abort.

The active task is set to NULL, and the last task and last subtask fields are updated as applicable. Partitioning probability for the TAB is updated as well.

Parameters:
  • aborted – The task that was just aborted (which MUST be contained in the current TAB, or an assertion will be triggered).

  • rng – The RNG to use during updating, per configuration.

polled_task *task_allocate(rmath::rng *rng)

Performs the next task allocation.

  1. Determines if partitioning should be employed at the root of TAB. If not, the active task is set to the root of the TAB and returned.

  2. If partitioning is employed, one of the two subtasks in the TAB is selected, the active task is updated accordingly, and the selected subtask is returned.

Parameters:

rng – The RNG to use during task allocation

inline virtual bool task_changed(void) const override

As a result of the most recent allocation, did our active task change?

virtual bool task_depth_changed(void) const override

As a result of the most recent allocation, did the depth of our task within the TAB change? i.e. it was the root before and now it is one of the subtasks or vice versa.

void task_finish_update(polled_task *finished, rmath::rng *rng)

Updates the TAB after task finsh.

The active task is set to NULL, and the last task and last subtask fields are updated as applicable. Partitioning probability for the TAB is updated as well.

Parameters:
  • finished – The task that was just finished (which MUST be contained in the current TAB, or an assertion will be triggered).

  • rng – The RNG to use during updating, per configuration.

bool task_is_child(const polled_task *task) const

Returns TRUE iff the argument is one of the child tasks in the TAB.

Parameters:

task – The task to check.

bool task_is_root(const polled_task *task) const

Returns TRUE iff the argument is the root task in the TAB.

Parameters:

task – The task to check.

Public Static Attributes

static const std::string kPartitionSrcExec = "exec"
static const std::string kPartitionSrcInterface = "interface"
static const std::string kSubtaskSelSrcExec = "exec"
static const std::string kSubtaskSelSrcInterface = "interface"
struct elements

Public Members

polled_task *child1
polled_task *child2
const bi_tdgraph *graph
polled_task *root