示例#1
0
    def test_set_parameters_only_changes_one_class(self, parameters_savanna,
                                                   default_parameters_savanna):
        jungle = Jungle()
        savanna = Savanna()

        savanna.set_parameters(**parameters_savanna)
        jungle.set_parameters(f_max=800)
        assert savanna.f_max == parameters_savanna['f_max']
        assert savanna.alpha == parameters_savanna['alpha']
        assert jungle.f_max == 800
        savanna.set_parameters(**default_parameters_savanna)
示例#2
0
            'age': 5,
            'weight': 20
        } for _ in range(150)]
    }]
    ini_carns = [{
        'loc': (10, 10),
        'pop': [{
            'species': 'Carnivore',
            'age': 5,
            'weight': 20
        } for _ in range(40)]
    }]

    animals.Herbivore.set_parameters({'zeta': 3.2, 'xi': 1.8})
    animals.Carnivore.set_parameters({
        'a_half': 70,
        'phi_age': 0.5,
        'omega': 0.3,
        'F': 65,
        'DeltaPhiMax': 9.
    })
    Jungle.set_parameters({'f_max': 700})

    sim = BioSim(island_map=geogr, ini_pop=ini_herbs, seed=123456)
    sim.simulate(num_steps=100, vis_steps=1, img_steps=2000)

    sim.add_population(population=ini_carns)
    sim.simulate(num_steps=100, vis_steps=1, img_steps=2000)

    input('Press ENTER')