Skip to main content
edited body
Source Link
Tim C
  • 9.8k
  • 3
  • 35
  • 54

Evolutionary Algorithms and Monte Carlo Simulations

I created an algorithm which, given linear weights to each pair of state (Loneliness, Breakdown, Rescue) to option (Sing, Patch, Overwork). Weights ranged from -1 to 1 and the algorithm would choose to take a given option if the weights for that option (multiplied by the current state) summed to a positive value.

For example:

public bool ShouldOverwork(GameState state)
{
    return
        (state.Breakdown * this.OverworkBreakdownContribution +
        state.Loneliness * this.OverworkLonelinessContribution +
        state.Rescue * this.OverworkRescueContribution) > 0.0;
}

I then ran this as an evolutionary algorithm, starting from random weights, where fitness was determined by the average number of surviving robots out of a batch of 1000 games (dice results were re-used across different strategies, for fairness).

If we let them sing

If we allow the robots to sing happy birthday as much as they want, then after a few generations, I see that Overwork has all negative weights (never overwork), Patch has all positive weights (self-care is important), and Sing also has all positive weights (always sing). These robots survive about 80%82% of the time.

If singing is slightly discouraged

If we discourage them from singing slightly, (I used a fitness score of 10 + 1/(1+times sang) for survivors and 0 for non-survivors), the weight for singing becomes more mixed. Observing a few runs, it seems like the weight for Singing typically stabilizes where it will sing if Loneliness is more than 130% of Rescue (the contribution from Breakdown is negligible). Patch and Overwork are still "always" and "never," respectively.

These robots still survive about 82% of the time, so not much is lost by singing less as long as they can sing when they need to.

If singing is strongly discouraged

We can increase the prohibition against singing by tweaking the fitness formula again - let's take away the score for surviving and make 100% of the points conditioned on not singing. (That is: a value of 1/(1+times sang) for survivors and 0 for non-survivors)

In this environment, Singing takes on a negative score (these robots will never sing), while Patch and Overwork take on mixed weights. The best-performing robots patching themselves up whenever Breakdown exceeds Loneliness by about 20% or more, and vice-versa for Overwork. The contribution from Rescue for Patching is negligible, but for reasons I don't fully understand, Rescue has a non-negligible negative weight for Overwork (about 1/3 the weight of Breakdown).

These robots only survive about 65% of the time, though.

Conclusions

  • You don't have to sing. You'll win about 2/3 of the time even if you don't.
  • If you want to sing as little as possible without reducing your chances of winning, sing whenever Loneliness is higher than Rescue by more than one point.
  • Overworking is bad. Self-care is important. Unless you're not allowed to sing at all.

Evolutionary Algorithms and Monte Carlo Simulations

I created an algorithm which, given linear weights to each pair of state (Loneliness, Breakdown, Rescue) to option (Sing, Patch, Overwork). Weights ranged from -1 to 1 and the algorithm would choose to take a given option if the weights for that option (multiplied by the current state) summed to a positive value.

For example:

public bool ShouldOverwork(GameState state)
{
    return
        (state.Breakdown * this.OverworkBreakdownContribution +
        state.Loneliness * this.OverworkLonelinessContribution +
        state.Rescue * this.OverworkRescueContribution) > 0.0;
}

I then ran this as an evolutionary algorithm, starting from random weights, where fitness was determined by the average number of surviving robots out of a batch of 1000 games (dice results were re-used across different strategies, for fairness).

If we let them sing

If we allow the robots to sing happy birthday as much as they want, then after a few generations, I see that Overwork has all negative weights (never overwork), Patch has all positive weights (self-care is important), and Sing also has all positive weights (always sing). These robots survive about 80% of the time.

If singing is slightly discouraged

If we discourage them from singing slightly, (I used a fitness score of 10 + 1/(1+times sang) for survivors and 0 for non-survivors), the weight for singing becomes more mixed. Observing a few runs, it seems like the weight for Singing typically stabilizes where it will sing if Loneliness is more than 130% of Rescue (the contribution from Breakdown is negligible). Patch and Overwork are still "always" and "never," respectively.

These robots still survive about 82% of the time, so not much is lost by singing less as long as they can sing when they need to.

If singing is strongly discouraged

We can increase the prohibition against singing by tweaking the fitness formula again - let's take away the score for surviving and make 100% of the points conditioned on not singing. (That is: a value of 1/(1+times sang) for survivors and 0 for non-survivors)

In this environment, Singing takes on a negative score (these robots will never sing), while Patch and Overwork take on mixed weights. The best-performing robots patching themselves up whenever Breakdown exceeds Loneliness by about 20% or more, and vice-versa for Overwork. The contribution from Rescue for Patching is negligible, but for reasons I don't fully understand, Rescue has a non-negligible negative weight for Overwork (about 1/3 the weight of Breakdown).

These robots only survive about 65% of the time, though.

Conclusions

  • You don't have to sing. You'll win about 2/3 of the time even if you don't.
  • If you want to sing as little as possible without reducing your chances of winning, sing whenever Loneliness is higher than Rescue by more than one point.
  • Overworking is bad. Self-care is important. Unless you're not allowed to sing at all.

Evolutionary Algorithms and Monte Carlo Simulations

I created an algorithm which, given linear weights to each pair of state (Loneliness, Breakdown, Rescue) to option (Sing, Patch, Overwork). Weights ranged from -1 to 1 and the algorithm would choose to take a given option if the weights for that option (multiplied by the current state) summed to a positive value.

For example:

public bool ShouldOverwork(GameState state)
{
    return
        (state.Breakdown * this.OverworkBreakdownContribution +
        state.Loneliness * this.OverworkLonelinessContribution +
        state.Rescue * this.OverworkRescueContribution) > 0.0;
}

I then ran this as an evolutionary algorithm, starting from random weights, where fitness was determined by the average number of surviving robots out of a batch of 1000 games (dice results were re-used across different strategies, for fairness).

If we let them sing

If we allow the robots to sing happy birthday as much as they want, then after a few generations, I see that Overwork has all negative weights (never overwork), Patch has all positive weights (self-care is important), and Sing also has all positive weights (always sing). These robots survive about 82% of the time.

If singing is slightly discouraged

If we discourage them from singing slightly, (I used a fitness score of 10 + 1/(1+times sang) for survivors and 0 for non-survivors), the weight for singing becomes more mixed. Observing a few runs, it seems like the weight for Singing typically stabilizes where it will sing if Loneliness is more than 130% of Rescue (the contribution from Breakdown is negligible). Patch and Overwork are still "always" and "never," respectively.

These robots still survive about 82% of the time, so not much is lost by singing less as long as they can sing when they need to.

If singing is strongly discouraged

We can increase the prohibition against singing by tweaking the fitness formula again - let's take away the score for surviving and make 100% of the points conditioned on not singing. (That is: a value of 1/(1+times sang) for survivors and 0 for non-survivors)

In this environment, Singing takes on a negative score (these robots will never sing), while Patch and Overwork take on mixed weights. The best-performing robots patching themselves up whenever Breakdown exceeds Loneliness by about 20% or more, and vice-versa for Overwork. The contribution from Rescue for Patching is negligible, but for reasons I don't fully understand, Rescue has a non-negligible negative weight for Overwork (about 1/3 the weight of Breakdown).

These robots only survive about 65% of the time, though.

Conclusions

  • You don't have to sing. You'll win about 2/3 of the time even if you don't.
  • If you want to sing as little as possible without reducing your chances of winning, sing whenever Loneliness is higher than Rescue by more than one point.
  • Overworking is bad. Self-care is important. Unless you're not allowed to sing at all.
Source Link
Tim C
  • 9.8k
  • 3
  • 35
  • 54

Evolutionary Algorithms and Monte Carlo Simulations

I created an algorithm which, given linear weights to each pair of state (Loneliness, Breakdown, Rescue) to option (Sing, Patch, Overwork). Weights ranged from -1 to 1 and the algorithm would choose to take a given option if the weights for that option (multiplied by the current state) summed to a positive value.

For example:

public bool ShouldOverwork(GameState state)
{
    return
        (state.Breakdown * this.OverworkBreakdownContribution +
        state.Loneliness * this.OverworkLonelinessContribution +
        state.Rescue * this.OverworkRescueContribution) > 0.0;
}

I then ran this as an evolutionary algorithm, starting from random weights, where fitness was determined by the average number of surviving robots out of a batch of 1000 games (dice results were re-used across different strategies, for fairness).

If we let them sing

If we allow the robots to sing happy birthday as much as they want, then after a few generations, I see that Overwork has all negative weights (never overwork), Patch has all positive weights (self-care is important), and Sing also has all positive weights (always sing). These robots survive about 80% of the time.

If singing is slightly discouraged

If we discourage them from singing slightly, (I used a fitness score of 10 + 1/(1+times sang) for survivors and 0 for non-survivors), the weight for singing becomes more mixed. Observing a few runs, it seems like the weight for Singing typically stabilizes where it will sing if Loneliness is more than 130% of Rescue (the contribution from Breakdown is negligible). Patch and Overwork are still "always" and "never," respectively.

These robots still survive about 82% of the time, so not much is lost by singing less as long as they can sing when they need to.

If singing is strongly discouraged

We can increase the prohibition against singing by tweaking the fitness formula again - let's take away the score for surviving and make 100% of the points conditioned on not singing. (That is: a value of 1/(1+times sang) for survivors and 0 for non-survivors)

In this environment, Singing takes on a negative score (these robots will never sing), while Patch and Overwork take on mixed weights. The best-performing robots patching themselves up whenever Breakdown exceeds Loneliness by about 20% or more, and vice-versa for Overwork. The contribution from Rescue for Patching is negligible, but for reasons I don't fully understand, Rescue has a non-negligible negative weight for Overwork (about 1/3 the weight of Breakdown).

These robots only survive about 65% of the time, though.

Conclusions

  • You don't have to sing. You'll win about 2/3 of the time even if you don't.
  • If you want to sing as little as possible without reducing your chances of winning, sing whenever Loneliness is higher than Rescue by more than one point.
  • Overworking is bad. Self-care is important. Unless you're not allowed to sing at all.