Jomini creates military simulations by using mathematical combat models. Designed to be helpful for game developers, students, history enthusiasts and -to some extent- scientists. You can mail me at [email protected] if you want to contribute.
To download: https://pypi.org/project/Jomini
Documentation will be available in the next update.
This package uses the combat models developed by Frederick William Lanchester, a.k.a one of the founding fathers of Operations Research.
from jomini.Lanchester import Battle, LinearLaw # Re-creating the Battle of Cerignola (AD 1503) # In the actual battle, Spanish(red) lost 500 men while the French(blue) lost 4000 men # Parameters rho, beta, engagement_width and time are manually fine_tuned b = Battle(red=6_300, blue=9_000, rho=0.0800, beta=0.0100) L = LinearLaw(b, engagement_width=100) print(L.get_casualty_rates()) # Returns casualty rates print(L.get_casualties(time=7)) print(L.get_remaining(time=7)) print(L.simulate_battle(time=7))
from jomini.Lanchester import Battle, LinearLaw, SquareLaw, LogarithmicLaw, GeneralLaw # Simulating a fictitious battle with each of the laws b = Battle(red=20_000, blue=30_000, rho=0.0150, beta=0.0120) Linear = LinearLaw(b, engagement_width=500) Square = SquareLaw(b) Log = LogarithmicLaw(b) Generalized = GeneralLaw(b, engagement_width=500, p=0.450, q=0.600) # If time is not specified, the battle goes on until one side is annihilated. print(Linear.simulate_battle() + "\n") print(Square.simulate_battle() + "\n") print(Log.simulate_battle() + "\n") print(Generalized.simulate_battle())