outcome_is_valid

negmas.outcomes.outcome_is_valid(outcome: Union[negmas.outcomes.OutcomeType, Tuple[Union[int, float, str, list]], Dict[Union[int, str], Union[int, float, str, list]]], issues: Collection[negmas.outcomes.Issue])bool[source]

Test validity of an outcome given a set of issues.

Examples

>>> 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)
>>> print([outcome_is_valid({'price':3.0}, issues), outcome_is_valid({'date': '2018.10.4'}, issues)            , outcome_is_valid({'count': 21}, issues)])
[False, False, False]
>>> valid_incomplete = {'price': 1.9}
>>> print(outcome_is_valid(valid_incomplete, issues))
True
>>> print(outcome_is_complete(valid_incomplete, issues))
False
>>> valid_incomplete.update({'date': '2018.10.2', 'count': 5})
>>> print(outcome_is_complete(valid_incomplete, issues))
True
Parameters
  • outcome – outcome tested which can contain values for a partial set of issue values

  • issues – issues

Returns

If return_problem is True then a second return value contains a string with

reason of failure

Return type

Union[bool, Tuple[bool, str]]