rl_equation_solver.utilities.reward.RewardMixin

class RewardMixin[source]

Bases: object

Reward function collection

Methods

diff_loss_reward(state_old, state_new)

Reward is decrease in complexity

exp_loss_reward(state_old, state_new)

Reward is decrease in complexity

expression_complexity(state)

Get the graph / expression complexity for a given state.

inv_loss_reward(state_old, state_new)

Reward is decrease in complexity

sub_loss_reward(state_old, state_new)

Reward is decrease in complexity

abstract expression_complexity(state)[source]

Get the graph / expression complexity for a given state. This is equal to number_of_nodes + number_of_edges

diff_loss_reward(state_old, state_new)[source]

Reward is decrease in complexity

Parameters:
  • state_old (str) – String representation of last state

  • state_new (str) – String representation of new state

Returns:

reward (int) – Difference between loss for state_new and state_old

sub_loss_reward(state_old, state_new)[source]

Reward is decrease in complexity

Parameters:
  • state_old (str) – String representation of last state

  • state_new (str) – String representation of new state

Returns:

reward (int) – Difference between loss for state_new and state_old

exp_loss_reward(state_old, state_new)[source]

Reward is decrease in complexity

Parameters:
  • state_old (str) – String representation of last state

  • state_new (str) – String representation of new state

Returns:

reward (int) – Difference between loss for state_new and state_old

inv_loss_reward(state_old, state_new)[source]

Reward is decrease in complexity

Parameters:
  • state_old (str) – String representation of last state

  • state_new (str) – String representation of new state

Returns:

reward (int) – Difference between loss for state_new and state_old