def test_alternating_offers_mechanism_with_one_agent_run(): n_outcomes, n_steps = 10, 10 accepted = [(2, ), (3, ), (4, ), (5, )] neg = SAOMechanism(outcomes=n_outcomes, n_steps=n_steps) opponent = LimitedOutcomesNegotiator( acceptable_outcomes=accepted, acceptance_probabilities=[1.0] * len(accepted), ) neg.add(opponent) neg.add(opponent) assert neg.pareto_frontier(sort_by_welfare=True)[0] == [(1.0, )] neg.run()
def test_same_utility_leads_to_agreement(): n_outcomes, n_steps = 10, 10 accepted = [(2, ), (3, ), (4, ), (5, )] neg = SAOMechanism(outcomes=n_outcomes, n_steps=n_steps) opponent = LimitedOutcomesNegotiator( acceptable_outcomes=accepted, acceptance_probabilities=[1.0] * len(accepted), ) acceptor = LimitedOutcomesAcceptor( acceptable_outcomes=accepted, acceptance_probabilities=[1.0] * len(accepted), ) neg.add(opponent) neg.add(acceptor) assert neg.pareto_frontier(sort_by_welfare=True)[0] == [(1.0, 1.0)] state = neg.run() assert state.agreement is not None assert state.step < 4