Skip to content

v0.17.0

Latest

Choose a tag to compare

@yasserfarouk yasserfarouk released this 07 Nov 18:36
· 6 commits to main since this release

New:

  • [outcomes] ListIssue and RecordIssue. One issue holds a
    variable-length list of elements, ordered or unordered, with min_count,
    max_count and unique_by. The issue supports sampling, mutate,
    to_discrete and serialization.
  • [outcomes] IntIssue and RealIssue (factories over the infinite
    issues), and the new StrIssue.
  • [preferences] RecordAdditiveFun, ListAggregationFun,
    ListAggregationMultiFun and lift_element_ufun score lists. Extremes
    are found greedily and exactly; an unbounded sum raises
    UnboundedListUtilityError.
  • [preferences] SearchInverseUtilityFunction. Inverters and Pareto
    samplers search list, string and infinite-integer issues instead of
    enumerating them, so the time-based negotiators work on them.
  • [helpers] Per-component seeding. Every Pareto sampler,
    SamplingInverseUtilityFunction and NiceTitForTatNegotiator
    (sampler_seed) take a seed; with seeded(s): does the same for any
    block of code. Both run on a private RandomStream and leave the global
    generators untouched. The default (None) changes nothing.
  • [preferences, outcomes] seed= on every random ufun generator (all
    .random() classmethods, UtilityFunction.generate_random,
    generate_bilateral and generate_random_bilateral, the functions in
    preferences.generators, IPUtilityFunction.sample, distributions'
    sample) and on outcome-space sampling (sample, random_outcome,
    enumerate_or_sample). The same seed gives the same result; the default
    (None) draws from the global generators as before. Built on the new
    seedable decorator.
  • [helpers] Ids of named objects, mechanisms, contracts, breaches and
    negotiation requests are reproducible once a global seed is set
    (negmas.helpers.rand.uuid4), from a stream that never shifts other draws.

Changes:

  • [outcomes] DiscreteOutcomeSpace and DiscreteCartesianOutcomeSpace
    are renamed EnumerableOutcomeSpace and
    EnumerableCartesianOutcomeSpace: they hold finite, listable spaces,
    while is_discrete() now allows infinite ones. The old names still work
    but warn (NegmasDeprecationWarning). Saving writes the new name, so
    files saved by this version need it to load; files with the old name
    still load, with a warning. Projects should require negmas>=0.17
    before switching to the new names or saving files with them.
  • [outcomes] is_discrete() now means countable (possibly infinite),
    is_finite() means finitely many values, and the new is_enumerable()
    means all values can be listed; issues and outcome spaces implement all
    three. Code that enumerates checks is_enumerable(). A
    CountableInfiniteIssue (and a StrIssue) is discrete but neither
    finite nor enumerable: it is sampled, never enumerated.
  • [outcomes] Infinite issues sample from a configurable typical range:
    before, sampling was uniform over ±sys.maxsize, or returned
    inf/nan for reals. Copying an infinite issue keeps its type.
  • [preferences] Normalizing a value function that is unbounded over its issue
    raises a clear ValueError.
  • [gb] WARNegotiator raises a clear error on infinite outcome spaces.
  • [mechanisms] Mechanism.add still returns None when it refuses a
    negotiator, but now also emits NegmasNegotiatorRefusedWarning naming the
    reason.

Fixes:

  • [deps] Lock patched versions of certifi, pillow, nbconvert, virtualenv,
    setuptools, tornado and filelock (security advisories).
  • [preferences] LinearAdditiveUtilityFunction.normalize_for(to=...) and
    normalize(to=...) returned [0, 1] whatever to was. Normalizing over a
    non-Cartesian outcome space crashed; it now uses the generic path.
  • [mechanisms] Seeded runs did not repeat: every mechanism step drew a random
    number once per wall-clock second even with pend_per_second=0, so what
    every later draw saw depended on timing. The draw is now made only when
    pend_per_second is positive.
  • [situated] An accepted negotiation request stored the uuid module itself
    as its id instead of the request's id.
  • [preferences] ExpDiscountedUFun.random and LinDiscountedUFun.random
    crashed when given a list of issues (the documented input). They take
    issues or an outcome space now, whatever the base ufun type expects.
  • [preferences] WeightedUtilityFunction.random and
    ComplexNonlinearUtilityFunction.random stored the reserved-value range
    itself as the reserved value instead of sampling from it, and passed
    normalized to their components as the reserved value.
  • [preferences] LambdaFun/LambdaMultiFun.minmax clipped the maximum to
    max_value instead of widening it.
  • [preferences] Pareto samplers: pareto_outcomes() dropped every outcome
    with negative utility (its default min_util was 0); it now keeps the
    whole front. IPSParetoSampler clamped negative partial utilities to 0 and
    returned dominated outcomes.
  • [outcomes] Scenarios whose domain holds a ListIssue or RecordIssue
    failed to load (No module named 'negmas.negmas'): short type names
    resolve as negmas.<Name>, and the new classes were not exported there.
    SingletonIssue, SingletonOutcomeSpace, UFunConstraint and
    UtilityFunctionAdapter had the same problem.
  • [typing] Annotations in genius/negotiator.py, situated/world.py and
    scripts/negotiate_core.py named Agent, Action and Any without
    importing them, so type checkers and typing.get_type_hints could not
    resolve them.
  • [docs] The NiceTitForTatNegotiator docstring no longer emits an
    "Unexpected indentation" warning in the docs build, and its grouped
    parameter descriptions now match the code.