load_genius_domain_from_folder

negmas.inout.load_genius_domain_from_folder(folder_name: str, agent_factories: Optional[Union[Callable[], negmas.negotiators.Negotiator], List[Callable[], negmas.negotiators.Negotiator]]]] = None, force_single_issue=False, force_numeric=False, cache_and_discretize_outcomes=False, max_n_outcomes: int = 1000000, n_discretization: Optional[int] = None, keep_issue_names=True, keep_value_names=True, normalize_utilities=False, normalize_max_only=False, n_steps=None, time_limit=60, max_n_agents=None, dynamic_entry=True, safe_parsing=False, ignore_reserved=False, ignore_discount=False, **kwargs)Tuple[Optional[negmas.sao.SAOProtocol], List[dict], Union[Dict[str, negmas.outcomes.Issue], List[negmas.outcomes.Issue]]][source]

Loads a genius domain from a folder. See load_genius_domain for more details.

Parameters
  • folder_name

  • agent_factories

  • force_single_issue

  • cache_and_discretize_outcomes

  • max_n_outcomes

  • n_discretization

  • keep_issue_names

  • keep_value_names

  • normalize_utilities

  • normalize_max_only

  • n_steps

  • time_limit

  • max_n_agents

  • dynamic_entry

  • safe_parsing

  • ignore_reserved

  • ignore_discount

  • kwargs – other arguments to pass to SAOMechanism constructor verbatim

Returns

A mechanism for the given issues - agent_info (List[Dict]): All Negotiator utility functions from the given file - issues Union[Issue, Dict[str, Issue], List[Issue]]] : The issues

Return type

  • mechanism (SAOMechanism)

Examples

>>> import pkg_resources
>>> from negmas import *
>>> folder_name = pkg_resources.resource_filename('negmas', resource_name='tests/data/10issues')
>>> mechanism, negotiators, issues = load_genius_domain_from_folder(folder_name
...                             , force_single_issue=False, keep_issue_names=False
...                             , keep_value_names=False, normalize_utilities=False)
>>> print(len(issues))
10
>>> print(len(negotiators))
2
>>> print([type(a['ufun']) for a in negotiators])
[<class 'negmas.utilities.nonlinear.HyperRectangleUtilityFunction'>, <class 'negmas.utilities.nonlinear.HyperRectangleUtilityFunction'>]
>>> print(negotiators[0]['ufun'].outcome_ranges[0])
{1: (7.0, 9.0), 3: (2.0, 7.0), 5: (0.0, 8.0), 8: (0.0, 7.0)}
>>> print(negotiators[0]['ufun'].mappings[0])
97.0
>>> u = negotiators[0]['ufun']
>>> print(u(tuple([0.0] * len(issues))))
0.0
>>> print(u(tuple([0.5] * len(issues))))
186.0

Try loading and running a domain with predetermined agents: >>> mechanism, agents, issues = load_genius_domain_from_folder( … pkg_resources.resource_filename(‘negmas’, resource_name=’tests/data/Laptop’) … , agent_factories=AspirationNegotiator … , force_single_issue=True, keep_issue_names=False … , keep_value_names=False) >>> state = mechanism.run() >>> state.agreement is not None True

>>> mechanism, negotiators, issues = load_genius_domain_from_folder(
...                             pkg_resources.resource_filename('negmas', resource_name='tests/data/Laptop'))
>>> len(issues), len(negotiators)
(3, 2)
>>> [type(a['ufun']) for a in negotiators]
[<class 'negmas.utilities.linear.LinearUtilityAggregationFunction'>, <class 'negmas.utilities.linear.LinearUtilityAggregationFunction'>]
>>> mechanism, negotiators, issues = load_genius_domain_from_folder(
...                             pkg_resources.resource_filename('negmas', resource_name='tests/data/Laptop')
...                             , force_single_issue=True, keep_issue_names=False
...                             , keep_value_names=False)
>>> len(issues), len(negotiators)
(1, 2)
>>> [type(a['ufun']) for a in negotiators]
[<class 'negmas.utilities.nonlinear.MappingUtilityFunction'>, <class 'negmas.utilities.nonlinear.MappingUtilityFunction'>]