How do I automate taking actions with simulations?

By learning the rules or action-taking behaviours you would follow as code, and then using simulations to stress test this code.

The fuller answer to this question requires a few new concepts, the first of which is a ‘policy’: the logic which takes in the state of the world at any moment and returns the action to take.

Automating a decision then means learning a policy. In the literature this is the language of sequential decision-making and reinforcement learning.

To find a good policy, we need to first find out what ‘good’ even means. Defining this through ‘rewards’ is common practice.

It’s important to note that not every decision should be automated. How often actions are taken, what regulation demands, and what is ethically at stake all determine how far a policy should act on its own, and whether or not there should be humans in-the-loop anyway.

References and further reading

Powell, Warren B. 2022. Reinforcement Learning and Stochastic Optimization: A Unified Framework for Sequential Decisions. Wiley. https://doi.org/10.1002/9781119815068.
Sutton, Richard S., and Andrew G. Barto. 2018. Reinforcement Learning: An Introduction. 2nd ed. MIT Press.