<commit_before>package rabbit_fox

import "kinds"

model smooth callable (variable, delay, initial) {
        smooth stock = {
                biflow: (variable - smooth)/delay
                intial: initial
        }
}

model Population `Individuals` {
        initial_population

        birth_rate `1/time`
        average_lifespan `time`

	flow migrations = 0
        flow births     = population * birth_rate
        flow deaths     = population / avg_lifespan

        stock population = {
		biflow:  migrations
                inflow:  births
		outflow: deaths
                initial: initial_population
        }

        avg_population = smooth(population, delay, initial)
}

model RabbitPopulation `Rabbits` specializes Population {
        carrying_capacity
        consumption_of_rabbits

        initial_population = 500 `Rabbits`
        birth_rate         = 2 `Rabbits/sec`
        avg_lifespan       = 2 `years`
        crowding           = population/carrying_capacity

        table effect_on_deaths `dmnl` = [(0, 0.75), (3, 2.5), (6, 6), (8, 11), (10, 20)]

        flow deaths = max(population/avg_lifespan * effect_on_deaths[crowding],
                consumption_of_rabbits)
}

model FoxPopulation `Foxes` specializes Population {
        consumption_of_rabbits `Rabbits`

        initial_population = 30 `Foxes`
        birth_rate         = .25 `Foxes/year`
        avg_lifespan       = 4 `years`
        food_requirements  = 25 `Rabbits/year`
        food_availability  = consumption_of_rabbits/population/food_requirements

        table mortality_lookup = [(0, 20), (.3, 5), (.5, 2), (1, 1), (2, .5)]

        flow deaths = population/avg_lifespan*mortality_lookup[food_availability]
}

RabbitFox model {
        sim.integration = "euler"

        time = {
                start:     0  `years`
                end:       50 `years`
                dt:        .5 `months`
                save_step: 1  `year`
        }

        crowding_effect = [(0, 0), (1, 1), (2, 2), (6, 2)][rabbits.crowding]

        fox_consumption_of_rabbits = foxes * foxes.food_requirements *
                crowding_effect

        rabbits = RabbitPopulation{
                carrying_capacity:      500 `Rabbits`
                consumption_of_rabbits: fox_consumption_of_rabbits
        }
        foxes = FoxPopulation{
                consumption_of_rabbits: fox_consumption_of_rabbits
        }

	grass_growth_rate  = .1 `1/year`
	grass_growth flow  = grass * grass_growth_rate
	grass_removal flow = 20

	grass stock = {
		initial: 100000 `m²`
		inflow:  grass_growth
		outflow: grass_removal
	}
}<commit_msg>models: fix syntax errors in rabbit<commit_after>import "kinds"

Smooth model {
        variable
        delay
        initial
        smooth stock = {
                biflow: (variable - smooth)/delay
                intial: initial
        }
}

Population model `Individuals` {
        initial_population

        birth_rate `1/time`
        average_lifespan `time`

        flow migrations = 0
        flow births     = population * birth_rate
        flow deaths     = population / avg_lifespan

        stock population = {
                biflow:  migrations
                inflow:  births
                outflow: deaths
                initial: initial_population
        }

        avg_population = smooth(population, delay, initial)
}

RabbitPopulation model `Rabbits` specializes Population {
        carrying_capacity
        consumption_of_rabbits

        initial_population = 500 `Rabbits`
        birth_rate         = 2 `Rabbits/sec`
        avg_lifespan       = 2 `years`
        crowding           = population/carrying_capacity

        table effect_on_deaths `dmnl` = [(0, 0.75), (3, 2.5), (6, 6), (8, 11), (10, 20)]

        flow deaths = max(population/avg_lifespan * effect_on_deaths[crowding],
                consumption_of_rabbits)
}

FoxPopulation model `Foxes` specializes Population {
        consumption_of_rabbits `Rabbits`

        initial_population = 30 `Foxes`
        birth_rate         = .25 `Foxes/year`
        avg_lifespan       = 4 `years`
        food_requirements  = 25 `Rabbits/year`
        food_availability  = consumption_of_rabbits/population/food_requirements

        table mortality_lookup = [(0, 20), (.3, 5), (.5, 2), (1, 1), (2, .5)]

        flow deaths = population/avg_lifespan*mortality_lookup[food_availability]
}

main model {
        //sim.integration = "euler"
        timespec = {
                start:     0  `years`
                end:       50 `years`
                dt:        .5 `months`
                save_step: 1  `year`
        }

        crowding_effect = [(0, 0), (1, 1), (2, 2), (6, 2)][rabbits.crowding]

        fox_consumption_of_rabbits = foxes * foxes.food_requirements *
                crowding_effect

        rabbits = RabbitPopulation{
                carrying_capacity:      500 `Rabbits`
                consumption_of_rabbits: fox_consumption_of_rabbits
        }
        foxes = FoxPopulation{
                consumption_of_rabbits: fox_consumption_of_rabbits
        }

        grass_growth_rate  = .1 `1/year`
        grass_growth flow  = grass * grass_growth_rate
        grass_removal flow = 20

        grass stock = {
                initial: 100000 `m²`
                inflow:  grass_growth
                outflow: grass_removal
        }
}
{'fraction_non_alphanumeric': 0.08334887190005594, 'fraction_numerical': 0.024986015289949655, 'mean_word_length': 1.8730583824317086, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4693508', 'n_tokens_mistral': 1820, 'n_tokens_neox': 1587, 'n_words': 366}