negmas.outcomes Module

Defines basic concepts related to outcomes

Outcomes in this package are always assumed to be multi-issue outcomes where single-issue outcomes can be implemented as the special case with a single issue.

  • Both Continuous and discrete issues are supported. All issue will have names. If none is given, a random name will be used. It is HIGHLY recommended to always name your issues.

  • Outcomes are dictionaries with issue names as keys and issue values as values.

Examples

Different ways to create issues:

>>> issues = [Issue((0.5, 2.0), 'price'), Issue(['2018.10.'+ str(_) for _ in range(1, 4)], 'date')
...           , Issue(20, 'count')]
>>> for _ in issues: print(_)
price: (0.5, 2.0)
date: ['2018.10.1', '2018.10.2', '2018.10.3']
count: (0, 19)

Outcome example compatible with the given set of issues:

>>> a = {'price': 1.2, 'date': '2018.10.04', 'count': 4}

Functions

outcome_is_valid(outcome, issues)

Test validity of an outcome given a set of issues.

outcome_is_complete(outcome, issues)

Tests that the outcome is valid and complete.

outcome_range_is_valid(outcome_range[, issues])

Tests whether the outcome range is valid for the set of issues.

outcome_range_is_complete(outcome_range[, …])

Tests whether the outcome range is valid and complete for the set of issues

outcome_in_range(outcome, outcome_range, *)

Tests that the outcome is contained within the given range of outcomes.

enumerate_outcomes(issues[, …])

Enumerates all outcomes of this set of issues if possible

sample_outcomes(issues[, n_outcomes, …])

Discretizes the issue space and returns either a predefined number of outcomes or uniform samples

outcome_as_dict(outcome[, issue_names])

Converts the outcome to a dict no matter what was its type

outcome_as_tuple(outcome)

Converts the outcome to a tuple no matter what was its type

outcome_as(outcome, astype[, issue_names])

Converts the outcome to tuple, dict or any OutcomeType.

is_outcome(x)

Checks if x is acceptable as an outcome type

num_outcomes(issues)

Returns the total number of outcomes in a set of issues.

outcome_for(outcome, ami)

Converts the outcome the type specified by the mechanism

Classes

OutcomeType()

A helper class allowing for definition of types that behave as outcomes (either in the form of dict or tuple).

ResponseType(value)

Possible answers to offers during negotiation.

Issue(values, int, Tuple[float, float], …)

Encodes an Issue.

Issues(**kwargs)

Encodes a set of Issues.

Class Inheritance Diagram

Inheritance diagram of negmas.outcomes.OutcomeType, negmas.outcomes.ResponseType, negmas.outcomes.Issue, negmas.outcomes.Issues