issues_from_xml_str
- negmas.outcomes.issues_from_xml_str(xml_str, safe_parsing=True, n_discretization=None)[source]
Exports a list/dict of issues from a GENIUS XML file.
- Parameters:
xml_str (str) – The string containing GENIUS style XML domain issue definitions
safe_parsing (bool) – Turn on extra checks
n_discretization (Optional[int]) – If not None, real valued issues are discretized with the given
values (number of)
max_cardinality (int) – Maximum number of outcomes allowed (effective only if force_single_issue is True)
- Return type:
- Returns:
tuple[Issue, …] The issues (note that issue names will be stored in the name attribute of each issue if keep_issue_names)
list[dict] A list of agent information dicts each contains ‘agent’, ‘class’, ‘utility_file_name’
Examples
>>> import pkg_resources >>> domain_file_name = pkg_resources.resource_filename( ... "negmas", resource_name="tests/data/Laptop/Laptop-C-domain.xml" ... ) >>> with open(domain_file_name, "r") as ff: ... issues, _ = issues_from_xml_str(ff.read()) >>> print([_.cardinality for _ in issues]) [3, 3, 3]
>>> domain_file_name = pkg_resources.resource_filename( ... "negmas", resource_name="tests/data/fuzzyagent/single_issue_domain.xml" ... ) >>> with open(domain_file_name, "r") as ff: ... issues, _ = issues_from_xml_str(ff.read()) >>> len(issues) 1 >>> type(issues) <class 'tuple'> >>> str(issues[0]).split(": ")[-1] '(10.0, 40.0)' >>> print([_.cardinality for _ in issues]) [inf]