Scenario
- class negmas.inout.Scenario(outcome_space, ufuns, mechanism_type=<class 'negmas.sao.mechanism.SAOMechanism'>, mechanism_params=NOTHING)[source]
Bases:
object
A class representing a negotiation domain
Attributes Summary
Methods Summary
calc_extra_stats
([max_cardinality])Calculates and returns several stats corresponding to the domain
- rtype:
discretize
([levels])Discretize all issues
dumpas
(folder[, type, compact])Dumps the scenario in the given file format.
from_genius_files
(domain, ufuns[, ...])from_genius_folder
(path[, ignore_discount, ...])from_geniusweb_files
(domain, ufuns[, ...])from_geniusweb_folder
(path[, ...])from_yaml_files
(domain, ufuns[, ...])from_yaml_folder
(path[, ignore_discount, ...])is_loadable
(path)is_normalized
([to, positive, eps])Checks that all ufuns are normalized in the given range
load
(folder[, safe_parsing])Loads the scenario from a folder with supported formats: XML, YML
make_session
([negotiators, n_steps, ...])Generates a ready to run mechanism session for this domain.
normalize
([to])Normalizes a utility function to the given range
plot
(**kwargs)Removes discounting from all ufuns
Removes reserved values from all ufuns replaacing it with
r
scale_max
([to])Normalizes a utility function to the given range
scale_min
([to])Normalizes a utility function to the given range
Converts the current scenario into a serializable dict.
to_genius_files
(domain_path, ufun_paths)Save domain and ufun files to the
path
as XML.to_genius_folder
(path)Save domain and ufun files to the
path
as XML.to_json
(folder)Saves the scenario as json :type folder:
Path
|str
:param folder: The destination pathForces all issues in the domain to become numeric
to_single_issue
([numeric, stringify, randomize])Forces the domain to have a single issue with all possible outcomes
to_yaml
(folder)Saves the scenario as yaml :type folder:
Path
|str
:param folder: The destination pathAttributes Documentation
- issue_names
- issues
- n_issues
- n_negotiators
-
outcome_space:
CartesianOutcomeSpace
-
ufuns:
tuple
[UtilityFunction
,...
]
Methods Documentation
- calc_extra_stats(max_cardinality=10000000000)[source]
Calculates and returns several stats corresponding to the domain
- dumpas(folder, type='yml', compact=False)[source]
Dumps the scenario in the given file format.
- Return type:
- static from_genius_files(domain, ufuns, ignore_discount=False, ignore_reserved=False, safe_parsing=True)[source]
- static from_genius_folder(path, ignore_discount=False, ignore_reserved=False, safe_parsing=True)[source]
- static from_geniusweb_files(domain, ufuns, ignore_discount=False, ignore_reserved=False, use_reserved_outcome=False, safe_parsing=True)[source]
- static from_geniusweb_folder(path, ignore_discount=False, ignore_reserved=False, use_reserved_outcome=False, safe_parsing=True)[source]
- classmethod from_yaml_files(domain, ufuns, ignore_discount=False, ignore_reserved=False, safe_parsing=True)[source]
- classmethod from_yaml_folder(path, ignore_discount=False, ignore_reserved=False, safe_parsing=True)[source]
- is_normalized(to=(None, 1.0), positive=True, eps=1e-06)[source]
Checks that all ufuns are normalized in the given range
- Return type:
- classmethod load(folder, safe_parsing=False)[source]
Loads the scenario from a folder with supported formats: XML, YML
- make_session(negotiators=None, n_steps=None, time_limit=None, roles=None, raise_on_failure_to_enter=True, **kwargs)[source]
Generates a ready to run mechanism session for this domain.
- normalize(to=(0.0, 1.0))[source]
Normalizes a utility function to the given range
- Parameters:
rng – range to normalize to. Default is [0, 1]
- Return type:
- scale_max(to=1.0)[source]
Normalizes a utility function to the given range
- Parameters:
ufun – The utility function to normalize
outcomes – A collection of outcomes to normalize for
rng – range to normalize to. Default is [0, 1]
levels – Number of levels to use for discretizing continuous issues (if any)
max_cardinality – Maximum allowed number of outcomes resulting after all discretization is done
- Return type:
- scale_min(to=1.0)[source]
Normalizes a utility function to the given range
- Parameters:
ufun – The utility function to normalize
outcomes – A collection of outcomes to normalize for
rng – range to normalize to. Default is [0, 1]
levels – Number of levels to use for discretizing continuous issues (if any)
max_cardinality – Maximum allowed number of outcomes resulting after all discretization is done
- Return type:
- serialize()[source]
Converts the current scenario into a serializable dict.
- Remarks:
- Rturns a dictionary with the following keys:
domain: The agenda/outcome-space
ufuns: A list of utility functions
- to_json(folder)[source]
Saves the scenario as json :type folder:
Path
|str
:param folder: The destination path- Return type:
- to_numeric()[source]
Forces all issues in the domain to become numeric
- Return type:
- Remarks:
maps the agenda and ufuns to work correctly together
- to_single_issue(numeric=False, stringify=True, randomize=False)[source]
Forces the domain to have a single issue with all possible outcomes
- Parameters:
numeric – If given, the output issue will be a
ContiguousIssue
otherwise it will be aDiscreteCategoricalIssue
stringify – If given, the output issue will have string values. Checked only if
Numeric and Mathematical Modules
isFalse
randomize – Randomize outcome order when creating the single issue
- Return type:
- Remarks:
maps the agenda and ufuns to work correctly together
Only works if the outcome space is finite