def test_winners_2020(): agents = get_agents(2020, track="std", winners_only=True) assert len(agents) == 2 agents = get_agents(2020, track="collusion", winners_only=True) assert len(agents) == 2 agents = get_agents(2020, track="all", winners_only=True) assert len(agents) == 4
def test_winners_2019(): agents = get_agents(2019, track="std", winners_only=True) assert len(agents) == 3 agents = get_agents(2019, track="collusion", winners_only=True) assert len(agents) == 3 agents = get_agents(2019, track="all", winners_only=True) assert len(agents) == 4 agents = get_agents(2019, track="sabotage", winners_only=True) assert len(agents) == 0
def test_can_run_sabotage_tournament(): competitors = get_agents(2019, track="sabotage", qualified_only=True) anac2019_sabotage( competitors, n_configs=1, n_steps=6, n_runs_per_world=1, max_worlds_per_config=10, min_factories_per_level=2, )
def test_get_agents_per_year(version): from pprint import pprint agents = get_agents(version, as_class=False) pprint(agents) if version == 2019: assert agents == ( "scml_agents.scml2019.fj2.FJ2FactoryManager", "scml_agents.scml2019.rapt_fm.RaptFactoryManager", "scml_agents.scml2019.iffm.InsuranceFraudFactoryManager", "scml_agents.scml2019.saha.SAHAFactoryManager", "scml_agents.scml2019.cheap_buyer.cheapbuyer.CheapBuyerFactoryManager", "scml_agents.scml2019.nvm.nmv_agent.NVMFactoryManager", "scml_agents.scml2019.monopoly.Monopoly", "scml_agents.scml2019.psfm.PenaltySabotageFactoryManager", ) elif version == 2020: assert agents == ( "scml_agents.scml2020.team_may.MMM", "scml_agents.scml2020.team_22.SavingAgent", "scml_agents.scml2020.team_25.Agent30", "scml_agents.scml2020.team_15.SteadyMgr", "scml_agents.scml2020.bargent.BARGentCovid19", "scml_agents.scml2020.agent0x111.ASMASH", "scml_agents.scml2020.a_sengupta.Merchant", "scml_agents.scml2020.past_frauds.MhiranoAgent", "scml_agents.scml2020.monty_hall.MontyHall", "scml_agents.scml2020.team_19.Ashgent", "scml_agents.scml2020.team_17.Pagent", "scml_agents.scml2020.team_10.UnicornAgent", "scml_agents.scml2020.threadfield.GreedyFactoryManager2", "scml_agents.scml2020.team_29.BIUDODY", "scml_agents.scml2020.team_20.CrescentAgent", "scml_agents.scml2020.team_27.AgentProjectGC", "scml_agents.scml2020.team_18.MercuAgent", "scml_agents.scml2020.biu_th.THBiuAgent", "scml_agents.scml2020.team_32.BeerAgent", )
def test_finalists_2020(): agents = get_agents(2020, track="std", finalists_only=True) assert len(agents) == 12 agents = get_agents(2020, track="collusion", finalists_only=True) assert len(agents) == 6
from scml.scml2019 import ( InputOutput, Job, FactoryStatusUpdate, GreedyScheduler, ProductionFailure, ) from negmas.helpers import unique_name from negmas.situated import Contract import hypothesis.strategies as st from scml_agents.scml2019 import * from scml_agents import get_agents from scml.scml2019.utils import anac2019_std, anac2019_sabotage, anac2019_collusion @mark.parametrize("fm", get_agents(2019, track="all")) def test_can_run_std(fm): horizon = None signing_delay = 0 n_factory_levels = 1 n_factories_per_level = 2 n_steps = 10 world = SCML2019World.chain_world( n_intermediate_levels=n_factory_levels - 1, log_file_name="", n_steps=n_steps, manager_types=(GreedyFactoryManager, fm), n_factories_per_level=n_factories_per_level, default_signing_delay=signing_delay, consumer_kwargs={ "consumption_horizon": horizon,
from pytest import mark from typing import List, Dict import numpy as np import pkg_resources import pytest from hypothesis import given, settings from negmas.helpers import unique_name from negmas.situated import Contract import hypothesis.strategies as st from scml.scml2020 import SCML2020World from scml_agents.scml2020 import * from scml_agents import get_agents @mark.parametrize("fm", get_agents(2020, as_class=True)) def test_can_run(fm): n_steps = 5 world = SCML2020World(**SCML2020World.generate( agent_types=["scml.scml2020.DecentralizingAgent", fm], n_steps=n_steps, )) world.run() assert sum(world.stats["n_contracts_concluded"]) >= 0 if __name__ == "__main__": pytest.main(args=[__file__])