Repository navigation
v0.16.0
Install with pip install negmas==0.16.0.
Changes
-
[situated]
World._step_negotiationsno longer loops forever on a negotiation
that ends before it starts. A mechanism left with fewer than two negotiators and
nodynamic_entrygives up without ever starting, and the world decided whether
to keep stepping it withnot state.ended-- butendedimpliesstarted
by design, so it read False forever and the mechanism was stepped indefinitely. A
finitenegotiation_speedmasked this by capping the passes per world step;
withnegotiation_speed=Nonethe loop never terminated and only the world's
wall-clocktime_limitbroke it out. The same predicate was wrong in two more
places (the running-negotiation filters in_step_negotiations' bookkeeping).endedkeeps its meaning exactly -- it still impliesstarted, so downstream
code reading it as "ran, then concluded" is unaffected. The stepping decision now
uses a new property,MechanismState.ended_or_never_started, which isended
widened to the two ways a negotiation stops without starting: it was abandoned for
lack of negotiators (the newended_without_startingflag) or a step/time limit
was already exceeded at the first step (timedout). Use it, notended, to
decide whether a mechanism still needs stepping;Mechanismexposes it too. -
[deps] Require
setuptools>=83.0.0. Versions below that are affected by
CVE-2026-59890, in which a Unicode normalization collision (NFC/NFD) on macOS
APFS/HFS+ lets a file bypass itsMANIFEST.inexclusion and be included in
an sdist.setuptoolsis a declared runtime dependency, so the bound is
raised here rather than left to the environment. -
[helpers] Parallel runs no longer share one random stream. Every worker
process re-imports negmas and re-appliesNEGMAS_RAND_SEEDfor itself, so
a seeded tournament had all of its workers starting from the same stream:
two tasks drawing the same sequence returned the same result, and repetitions
of one configuration collapsed onto a single outcome instead of sampling the
variation they exist to measure. Each dispatched task is now seeded from its
own index (negmas.helpers.rand.task_seed, derived with numpy's
SeedSequence), so tasks are independent, a run reproduces whatever the
scheduling order or worker count, and a serial run reproduces a parallel one.
Unseeded runs are dispatched exactly as before -- the task is not wrapped at
all when no seed is in effect. Libraries that dispatch their own parallel
work rather than going throughnegmas.helpers.parallelcan get the same
behaviour from the publictask_seed(index)andapply_seed(seed). -
[helpers] Every random number generator NegMAS uses can now be seeded from a
single switch, so a whole run can be reproduced. SetNEGMAS_RAND_SEED(or
therand_seedconfig key) to an integer before a run and both the global
randomandnumpy.randomgenerators are seeded with it as
negmasis imported; leaving it unset keeps the previous behaviour of
drawing fresh entropy every run, andNEGMAS_RAND_SEED=randomasks for that
explicitly. The same can be done in-process with
negmas.helpers.rand.seed_all(42), and libraries built on NegMAS can attach
their own generators to the switch withregister_seeder()-- a seeder
registered after a seed is already in effect is called immediately with it, so
import order does not matter. Seeding is best-effort: a generator that cannot
be seeded warns rather than raising, and the unset default does not add
anything toimport negmas. -
[cli] New
negmas seedcommand printing every environment setting that
makes a run reproducible --NEGMAS_RAND_SEEDplus the seeding knobs of
the common libraries used alongside NegMAS, includingPYTHONHASHSEED,
which cannot be set from inside a running process. Apply them to a shell
witheval "$(negmas seed 44)", or use--no-exportto get bare
NAME=VALUElines for a.envfile. -
[inv_ufun] The presorting inverters' nearest-utility search is vectorized.
_nearest_aroundopened by overwriting the search radius its caller passed,
so every call walked the entire utility array in a Python loop.worst_in
andbest_incall it on each concession step, which made it the single
largest cost of a negotiation on a large domain: 13ms a call, and 2.204s of
the 3.450s a 100-step Boulware-vs-Boulware negotiation took on the ANAC-2026
Travel domain (188,160 outcomes) -- 64% of the runtime, paid by every
negotiator that concedes toward a utility target. The scan still considers
every entry, because the array is not sorted end to end and so cannot be
bisected; what changes is that the per-entry work is numpy's rather than the
interpreter's. Results are unchanged, ties included, andnis now
documented as accepted and ignored rather than silently discarded. -
[preferences] Scenarios can optionally carry their ufuns' inverses on disk,
so repeated negotiations over the same scenario skip re-inverting. Save with
dumpas(..., save_inverse=True)and load with
Scenario.load(..., load_cached_inverse=True); both halves are opt-in and
default to off. Saving withoutsave_inversedeletes any cache in the
folder, whileupdate()preserves it. A cache is only reused when the
outcome space, reserved value and inverter configuration all match and
re-evaluating the ufun reproduces the stored utilities; anything else rebuilds.
Modifying a ufun disables its cache (callmark_modified()for in-place
mutation). Non-stationary and constrained ufuns are never cached. Arrays are
stored as.npzread withallow_pickle=False. Inverters consult the
cache in their owninit(), so every negotiator benefits.
Remarks:invert()now keys its cache on the inverter kwargs as well as the type,
so a call with a different configuration no longer silently returns an
inverter built with another one.- Genius XML does not preserve issue types, so a cache saved alongside XML is
usually rejected on reload and rebuilt.
-
[outcomes] Integer range issues now support an optional
step(defaulting
to1) giving the stride between consecutive values, so an issue taking
the even values between 0 and 10 (inclusive) can be created with either
make_issue((0, 10), step=2)ormake_issue((0, 10, 2)). A three-valued
tuple is read as(min, max, step)-- but only when the third value is not
larger thanmax - min(otherwise aValueErroris raised, as before).
When the range is not a whole multiple of the step, the maximum is clamped
down to the last attainable value ((0, 10, 3)yields0, 3, 6, 9with
max_value == 9), which keepsall,cardinality,value_at,
containsand all sampling/generation methods consistent and makes the
representation idempotent.Issue.stepis available on every issue type
(1unless a stride was requested),Issue.__eq__now takes it into
account, andIssue.intersectpreserves it when the two grids align.
Remarks:- A step is only supported for integer ranges; passing one for a continuous
or infinite range (or a list of values) raisesValueError. - Genius XML cannot express a stride, so a stepped issue is written as an
enumerated discrete issue (values are preserved; as for any discrete
issue they are read back as strings). YAML/Scenarioround-trips
preserve the issue exactly. - Behavior is unchanged in every respect when no step is given.
- A step is only supported for integer ranges; passing one for a continuous
-
[tournaments] Added
negmas.tournaments.analysis, a new post-tournament
game-theoretic and statistical analysis package (AI-assisted; see the
README's "AI Assistance Disclosure"):- Loaders (
load_records/records_from_simple_results/records_from_path/
records_from_situated) convert a tournament result -- in memory
(SimpleTournamentResultsfromcartesian_tournament, or a situated
TournamentResults), on disk, or an already-normalized DataFrame --
into one common long-format record table. The situated adapter only
decomposes worlds whose number of competitor agent types (excluding
non_competitors, per the tournament'sn_competitors_per_world) is
exactly 2; other worlds are skipped with a warning since a pairwise
payoff matrix is not well defined for them. payoff.build_payoff_table/iterated_eliminationbuild the empirical
pairwise payoff matrix (with a same-strategy self-play diagonal
precondition) that every method below consumes.equilibria: pure symmetric Nash equilibria and the "EGTA based
evaluation" method, deviation regret, Nash-averaging/NE-regret ranking,
and optional mixed-strategy Nash equilibria vianashpy(new
negmas[egta]extra).ranking: Sequential Elimination Ranking and Tournament Evaluation --
both from de Jonge's "Introduction to Automated Negotiation", chapter 6.dynamics: symmetric and asymmetric (two-population) replicator
dynamics.significance: pairwise statistical-significance testing (paired and
unpaired t-test, rank-sum, Kolmogorov-Smirnov) with Bonferroni/Holm/
Benjamini-Hochberg corrections, and per-strategy normality diagnostics
(skewness/kurtosis, Shapiro-Wilk, D'Agostino K²).plotting/significance: optional matplotlib/networkx plots for
every method above (payoff heatmap, deviation graph, replicator-dynamics
trajectories, ranking bar charts, significance heatmap/marks).report.analyze_tournament: one-call orchestration running every
method above and optionally saving results (and plots) to disk; usable
fully post-hoc on any in-memory or on-disk tournament result, or
automatically viacartesian_tournament(..., run_analysis=True, analysis_plots=True), which saves everything under<path>/analysis.
- Loaders (
-
[tournaments] Added two opt-in features to
cartesian_tournament
(and pass-through support incontinue_cartesian_tournament):- A thread-pool executor (
executor="thread", default remains
executor="process") alongside the existing process-pool path, for
I/O-bound negotiators (e.g. those making LLM API calls), avoiding
per-task (de)serialization and process-spawn overhead. Thread mode
provides no per-negotiation timeout enforcement: Python threads
cannot be force-killed, soexternal_timeoutis not enforced and a
hung negotiation will not be terminated -- negotiators run this way
must implement their own client-side I/O timeout.process_isolation= Truecombined withexecutor="thread"raisesValueError.
Backed by a newrun_threaded_tasks/resolve_workersin
negmas.helpers.parallel. - Error-aware resume:
retry_failed_on_resume/retry_timedout_on_resume
(both defaultFalse) letpath_exists="continue"re-run
previously-failed or previously-timed-out negotiations instead of
permanently treating any existing result file as done. Neither flag
(norexecutor) is persisted into the saved tournament config, to
avoid perturbing the stable per-negotiationrun_idused for resume
file-naming across all existing tournament directories.
- A thread-pool executor (
-
[preferences] Fixed
LinearAdditiveUtilityFunction.normalize/
normalize_forignoring constraints: the analytic per-issue
canonicalization assumed each issue's value-function range is independent,
so it normalized against the unconstrained outcome range even when
constraints removed the extreme outcomes (e.g. a constraint0 < x < 2
left the constrained min mapping to0.4instead of0). When the
ufun has constraints,normalize_fornow falls back to the generic
minmax-based scaling inherited fromBaseUtilityFunction, which
respects constraints viaextreme_outcomes/minmax. -
[inout]
Scenario.calc_extra_statsnow reports Kalai, Kalai-Smorodinsky,
and max-welfare solution concepts alongside Nash — both the global
(kalai_utils/kalai_outcome,ks_utils/ks_outcome,
max_welfare_utils/max_welfare_outcome) and the bilateral
(bilateral_kalai_*/bilateral_ks_*/bilateral_max_welfare_*)
variants, mirroring the existing Nash reporting and honoring the
convex_hullswitch. Also fixed a pre-existing copy-paste bug where the
stats-present branch assignednash_outcomestonash_utils. -
[preferences] Added a
convex_hull: boolevaluation-model switch to
every user-facing optimality/distance/plotting entry point so a
computation runs entirely under theP∞(multiple-negotiations /
convex-hull) model or entirely under the ordinary single-negotiation
Pmodel — never a mix. The switch is oncalc_scenario_stats,
ScenarioStats(carried on the stats object so
calc_outcome_distances/calc_outcome_optimalityhonor it without a
separate parameter),Scenario.calc_stats/calc_extra_stats/
plot/save_plots, theMechanismsolution methods
(pareto_frontier,nash_points,kalai_points,
modified_kalai_points,max_welfare_points,
max_relative_welfare_points) andto_completed_run, and the
plotters (plot_2dutils/plot_offline_run/plot_mechanism_run).
Completed the convex-hull bargaining family: new
max_relative_welfare_points_convex_hulland asubtract_reserved_value
parameter onkalai_point_convex_hull/ks_point_convex_hullfor the
modified variants. UnderP∞, the Nash/Kalai/KS solutions are mixtures
(a utility point realized by a lottery over hull vertices, not any single
outcome), soScenarioStatsstores the utility point with empty
*_outcomes; the Pareto distance uses the continuous convex-hull
frontier (dist_to_convex_hull_frontier, 2-negotiator; discrete
fallback otherwise). Covered by tests intests/core/test_preferences.py
and the smoke scriptcoding_agents/test_convex_hull_switch.py. -
[preferences] Fixed
pareto_frontier_convex_hull(theP∞
multiple-negotiations Pareto frontier of Mohammad 2023,
https://ieeexplore.ieee.org/document/10405386) raising
scipy.spatial.QhullErroron (near-)collinear or otherwise
lower-dimensional input (e.g. any two-issue zero-sum scenario, where every
point lies on one line) — previously documented as an accepted limitation,
now handled by projecting degenerate point sets onto their affine span
before computing the hull. This uncovered two deeper, pre-existing
correctness bugs in the same function that made it effectively unusable
even on non-degenerate input: an internalreduce()fold silently
changed the type of its accumulator partway through (points became
indices), raisingValueErroron almost any input with 3 or more
points; and the returned indices were an identity permutation of the
input rather than the actual frontier, since the "filtered" result of the
onion-peeling loop was never connected back to the indices being
returned. The function is rewritten to correctly implement its documented
semantics — mixture (lottery) domination verified via linear programming,
not just point-wise comparison — and gains test coverage in
tests/core/test_preferences.py. -
[negotiators] Exposed the hardcoded constants used by every negotiator as
constructor hyperparameters, so hyperparameter search can tune them without
hand-building components. Covers first-party components
(HybridOfferingPolicy,FastMiCROOfferingPolicy,
NiceTitForTatOfferingPolicy,KindConcessionRecommender, the
PolyAspiration/ExpAspirationcurve exponents, ...), first-party
negotiators (Hybrid,MiCRO,FastMiCRO, both tit-for-tats,
CAB/CAN/CAR,WAB/WAR/WAN,
LimitedOutcomesNegotiator,SimpleNegotiator), and 211 of the 217
constants in the transcompiled Genius/ANAC ports
(gb.components.genius), which now also accept
offering_params/acceptance_params/model_params. Also fixed two
latent bugs found while wiring this up:HybridOfferingPolicy's four
Bezier parameters were silently overwritten on every
on_preferences_changed(NaNis now the documented "auto" sentinel,
so user-supplied values survive), and several CAB/WAR/Nice negotiators
discarded a caller-suppliedofferingcomponent via
kwargs["offering"] = X()instead ofsetdefault. -
[preferences] New value functions:
TrapezoidalFun,GaussianFun,
AggregatingFun(weighted sum of value funs, with optional 0-1
normalization),BiasedFun(adds a bias to value funs like
IdentityFun/LinearFunthat don't have one), and
MultiModalTrapezoidalFun/MultiModalGaussianFun(tuple-parameterized
mixtures built onAggregatingFun).docs/value_functions.rstis now a
full gallery with a generated figure for every single- and multi-issue value
fun type. -
[situated] Fixed
Worldbreaking negotiations mid-flight when
negotiation_speedwas finite._step_negotiationsbudgeted the
per-simulation-step negotiation allowance by counting passes over the
mechanisms instead of negotiation rounds. A pass is not a round: sync
controllers answer withWAITuntil they have collected offers from all
their parallel negotiations (a WAIT does not advancestate.step), and
mechanisms stepped one offer at a time (atomic_steps) take two passes per
round. So evennegotiation_speed > neg_n_stepscould exhaust the budget
before a negotiation finished; the unfinished negotiation was then killed and
broke spuriously with(REJECT, None). The budget is now counted in rounds
actually advanced during the step (halved foratomic_stepsmechanisms), so
negotiation_speed >= neg_n_stepsalways runs every negotiation to
completion within the step, matchingnegotiation_speed=None. -
[situated] Added world-level and per-agent annotations on the
World/Agent
side, mirroring the mechanism-side annotations exposed through the NMI.
World(annotation=...)stores a common metadata dict accessible to every agent
throughawi.annotation(and recorded inworld.params["annotation"]), the
direct analogue ofMechanism(annotation=...)->nmi.annotation.
World.join(agent, annotation=...)accepts a per-agent annotation that is merged
with the world annotation (per-agent keys override world keys for that agent only),
mirroringMechanism.add(negotiator, annotation=...).Agent(private_info=...)
adds a fully-private channel exposed viaagent.annotation/agent.private_info
that is never shared with the world or other agents, mirroring
Negotiator(private_info=...). Note the same naming split as on the negotiator
side:awi.annotationis the shared/per-agent-merged dict, while
agent.annotationis the fully-private one. -
[gb] Fixed
MAPNegotiatorsilently dropping its
private_info["opponent_ufun"]registration. The firstUFunModelamong
the negotiator'smodelsis registered under theopponent_ufundiscovery
key (backing theNegotiator.opponent_ufunproperty), but it was written to a
local dict beforesuper().__init__re-initialised_private_infofrom
theprivate_infokwarg, wiping the registration whenever no explicit
private_infowas passed. The dict is now routed through kwargs so the base
class and the registration share the same object. -
[models] Recovered additional opponent models from Baarslag et al. (2016),
Learning about the opponent in automated bilateral negotiation (JAAMAS
30:849-898), filling gaps in the survey's Table-2 taxonomy. New preference
profile (UFunModel) estimators innegmas.gb.components.models(mirrored
innegmas.sao.components.models):ConcessionRatioUFunModel(Niemann &
Lang) andValueDifferenceUFunModel(Carbonneau & Vahidov) and
KDEWeightUFunModel(Coehoorn & Jennings) for issue-weight learning
(§5.3.1);LuceProfileClassifierModel(Lin et al.) for Bayesian
profile classification (§5.3.2); andCandidateEliminationModelfor the
ordinal acceptable-offer heuristic (§5.3.4). -
[models] New framework-agnostic opponent-attribute models in
negmas.models:
ReservationValueModelfamily (ConcessionExtrapolatingReservationModel,
BayesianReservationValueModelafter Zeng & Sycara) for reservation-value
estimation (§5.1.1); and offering-strategy forecasters
PolynomialOfferingModel(Papaioannou et al.),DerivativeOfferingModel
(Brzostowski et al.) andMarkovChainOfferingModel(Narayanan & Jennings)
added tonegmas.models.strategy(§5.4). -
[registry] Registered the new preference-profile models under the existing
modelcomponent type and added three new component types —
reservation-model,deadline-modelandoffering-model— covering the
non-ufun opponent-attribute models. -
[genius] Refactored the transcompiled Genius BOA components from single modules
(genius/models.py,genius/acceptance.py,genius/offering.py) into
packages with one concern per file. All public names are re-exported as
before; no import changes needed. -
[inv_ufun] Refactored
inv_ufun.pyinto a package (inv_ufun/) with one
class per file. All public names are re-exported from
negmas.preferences.inv_ufunas before; no import changes needed. -
[inv_ufun] New
BIDSInverseUtilityFunction: implements the BIDS
(Bidding using Diversified Search) algorithm from Koça et al. (2024).
Builds a dynamic-programming table ininit()(O(|I|·|V|·10^p)) that
allowsone_in()queries inO(1)andsome()inO(n_samples).
Scales to outcome spaces with 10^200+ outcomes. Only works with
LinearAdditiveUtilityFunction/LinearUtilityFunction; raises
TypeErrorfor other ufun types. -
[inv_ufun] New
AdaptiveInverseUtilityFunction: automatically selects
the best concrete inverter based on ufun type and outcome-space size.
Delegates toPresortingInverseUtilityFunctionfor spaces with
≤max_presorting_outcomesoutcomes (default 10^6, exact), and to
BIDSInverseUtilityFunctionfor larger additive spaces (approximate but
scalable). Recommended entry-point for code that should work across a wide
range of domain sizes. -
[inv_ufun] Renamed
PresortingInverseUtilityFunction(waypoint-based,
legacy) →PresortingLegacyInverseUtilityFunctionand the previously
un-waypointed siblingPresortingInverseUtilityFunction2→
PresortingInverseUtilityFunction(new default). Empirical benchmarks show
the waypoint coarse-search is ~2× slower than a direct numpysearchsorted
at every tested scale (100 – 10^6 outcomes), so the simpler variant is now
canonical.PresortingLegacyInverseUtilityFunctionis kept for backward
compatibility. -
[pareto_sampler] New
pareto_samplersub-package introducing the
ParetoSamplerprotocol for trade-off queries (finding Pareto-optimal
outcomes given an estimate of the opponent's utility function) and
IPSParetoSampler, an implementation of the IPS (Iterative Pareto Search)
algorithm from Koça et al. (2024). The opponent utility function is accessed
viaNegotiator.opponent_ufun(Nonewhen no estimate is available). -
[gb] New
NiceTitForTatNegotiator(with its components
NiceTitForTatOfferingPolicy, theACCombiacceptance condition, and the
opponent modelsFrequencyLinearUFunModel/FrequencyUFunModel/
PeekingOpponentModel): a negmas port of Baarslag, Hindriks & Jonker's
Nice Tit for Tat agent that reproduces the Genius reference behaviour —
reciprocal concession measured in the agent's own utility, a Nash-aiming
target with a discount/time concession bonus, an opponent-attractive ("nice")
bid selected via aParetoSampler, and the referencemakeAppropriate
guard.targetselects the bargaining solution to aim for
(nash/kalai/kalai_smorodinsky/max_welfare/max_relative_welfare).
Re-exported fromnegmas.sao.negotiators. -
[gb] Fix
GPerfectModel(the GeniusPerfectModeloracle) was a
non-functional placeholder — itsupdate()was a stub, the opponent ufun
was never stored andeval/eval_normalizedalways returned0.5.
It is now a working oracle: it accepts the opponent's true ufun via
ufun=and delegateseval/eval_normalizedto it, sharing the
single code path ofPeekingOpponentModel(de-duplicated). Any Genius
opponent model — e.g.GScalableBayesianModel(the port of Nice Tit for
Tat's ownBayesianOpponentModelScalable) — can also be passed to
NiceTitForTatNegotiatorviaopponent_model_type=. -
[pareto_sampler] API change:
ParetoSamplerimplementations now take
configuration only in their constructors; the operands (own and opponent
ufuns) are supplied toinit(ufun=..., opponent_ufun=...)— where the
expensive frontier build happens. A single instance can therefore be
re-init-ed with new operands instead of recreated, and
BaseUtilityFunction.make_pareto_samplernow reuses one cached instance,
re-initialising it when the opponent estimate changes. New
BruteForceParetoSampler(exact, works with any ufun) uses the vectorised
pareto_frontier_numpy(~200× faster than the O(n²)pareto_frontier_bf). -
[pareto_sampler] New
AdaptiveParetoSampler(exported also as
DefaultParetoSampler) and it is now the default used by
BaseUtilityFunction.make_pareto_sampler(and by the Nice Tit for Tat
offering policy). It dispatches on the outcome-space size — determined in
initfrom the supplied ufun — using the exactBruteForceParetoSampler
for small spaces (cardinality <= max_bruteforce_outcomes, default 10_000)
and a scalable backend (MOBANOSParetoSamplerby default, or
IPSParetoSamplerfor very large additive domains) otherwise, falling back
to brute force when the large backend cannot handle the ufuns. -
[inv_ufun] New
closest(target, normalized=False)query on the
InverseUFunprotocol and all inverters: returns the single outcome whose
utility is closest to a target (argmin_ω |u(ω) - target|— the
utility-lookup query of Koça et al. 2024, distinct from the range-based
one_in). Exact for the enumerating/sorted inverters (BruteForce,
Presorting, PresortingLegacy) and BIDS; approximate (by design) for the
sampling / MCTS / attribute-planning inverters. -
[models] New opponent-attribute model types filling the two families from
Baarslag et al. (2016) Table 2 that were missing fromnegmas.models: a
deadline family (DeadlineModel/ConcessionExtrapolatingDeadlineModel,
§5.2) and an offering-strategy family (OpponentOfferingModel/
TimeSeriesOfferingModel, §5.4). All four attribute families are now
exported fromnegmas.models. -
[gb/registry] The new
NiceTitForTatNegotiatorand its components
(NiceTitForTatOfferingPolicy,ACCombi,PeekingOpponentModel) are
registered in the built-in registry, and a set of previously-unregistered
built-in negotiators/policies were added too (time-based following /
offer-oriented negotiators, the comparator/ranker/sorter elicitation
negotiators, and theCAB/WAR/MiCRO/FastMiCRO/Hybrid/TFT
offering andTFT/MiCRO/AcceptFinalOffer/ACLastFractionReceived
acceptance policies). -
[common] Renamed the two ambiguous
NegotiatorInfoclasses so the name is
unambiguous:negmas.common.NegotiatorInfo(thename/id/type
descriptor returned byMechanism.participants) →NegotiatorDescriptor,
andnegmas.negotiators.common.NegotiatorInfo(the
(negotiator, context)pairing used byController) →NegotiatorEntry
(now a typedNamedTuple).NegotiatorInfoat the top level now
unambiguously refers to the registry'sNegotiatorInfo. -
[preferences]
pareto_frontier:n_discretizationnow applies only to
continuous issues (fully-finite outcome spaces are always enumerated exactly),
and outcomes whose utility is non-finite for any ufun are skipped so
opponent-model stand-ins can be passed safely. Documented the relative speed
of the individualpareto_frontier_*extractors — and flagged the actually
brokenpareto_frontier_numpy_faster(raisesIndexError) and the
effectively-hangingpareto_frontier_of— in the module and method
docstrings. (A later pass correctedpareto_frontier_convex_hull's
docstring, which had wrongly been flagged as broken too: it deliberately
computes the multiple-negotiations Pareto frontierP∞of Mohammad
(2023, "Evaluating Automated Negotiations",
https://ieeexplore.ieee.org/document/10405386) — the convex-hull
restriction is by design, not a bug, though it still raisesQhullErroron
(near-)collinear inputs.) -
[inv_ufun] Added comprehensive performance benchmark
(coding_agents/benchmark_all_inverters.py) comparing all inverters across
outcome spaces from 25 to 10^200. Results are documented in the
negmas.preferences.inv_ufunmodule docstring. -
[inv_ufun] Documented a strict-vs-clamping taxonomy across all inverters in
their class docstrings, and reclassifiedSamplingInverseUtilityFunction
from strict to clamping (itsworst_in/best_innow fall back to a
boundary outcome when the requested utility range is too narrow to sample,
rather than returningNone). Strict inverters (BruteForce,
PresortingInverseUtilityFunctionBruteForce) returnNonefor
out-of-range queries; all others clamp to the nearest in-range outcome.
Bug Fixes:
-
[sao]
sao.components.models.ufunduplicated theUFunModel,
ZeroSumModel,FrequencyUFunModelandFrequencyLinearUFunModel
implementations fromnegmas.gb.components.models.ufuninstead of
re-exporting them like its sibling modules (weights.py,
classifier.py,heuristic.py) already did, leaving the
Frequency*duplicates asNotImplementedErrorstubs. It now
re-exports thegbimplementations, sonegmas.FrequencyUFunModel/
negmas.FrequencyLinearUFunModel(both resolved throughsao) are
fully functional. -
[gb]
NiceTitForTatOfferingPolicyread the opponent model via
getattr(self.negotiator, "opponent_model", None)— a property only
NiceTitForTatNegotiatoritself defines — instead of the standard
Negotiator.opponent_ufunproperty that everyUFunModelcomponent
populates automatically. Simplified to direct attribute access (no
getattrneeded;opponent_ufunis always defined and was already
guaranteed non-Noneat that point). -
[preferences]
BIDSInverseUtilityFunction,MCTSInverseUtilityFunction
andAttributePlanningInverseUtilityFunctionall built their per-issue
value lists vialist(issue.all), which raisesValueErrorfor any
continuous issue (it is uncountable) — crashinginit()for any additive
ufun with a real-valued issue, including through
AdaptiveInverseUtilityFunctionwhenever a continuous outcome space's
infinite cardinality routed it to BIDS. Added a shared_issue_values()
helper that discretizes any non-discrete issue intocontinuous_levels
grid points viaIssue.to_discrete(). -
[preferences] A
BaseFunnested inside anotherBaseFun's field (e.g.
inAggregatingFun/BiasedFun) was silently corrupted on save whenever
the outer value fun was itself held byLinearAdditiveUtilityFunction/
GLAUtilityFunction/GPAUtilityFunction/
NonLinearAggregationUtilityFunction/PAUtilityFunction, since the
generic serializer bypassed the nested fun's ownto_dict(). Those five
ufun classes now serialize each value fun via its ownto_dict(). (A
follow-up commit also corrected a couple ofTrapezoidalFundocstring
doctest values left stale by its boundary-condition handling.) -
[helpers]
Distribution.Real.probused the (always-false) chained
comparisonself == val < EPSILONinstead of comparingvalto the
point mass's location, so it never reported a nonzero probability except by
accident. Fixed toabs(val - self._loc) < EPSILON. Also added missing
__radd__/__rsub__/__rmul__/__and__/__rand__operators
and canonicalized distribution-family-name handling (UNIFORM/NORMAL
constants and acanonical_distribution_type()helper accepting aliases
like"norm"/"gaussian"/"unif") so naming is consistent across
negmas.helpers.prob. -
[preferences]
BaseUtilityFunction.__call__no longer raises
AttributeErrorfor ufun-like objects (e.g.@defineopponent models)
that skipBaseUtilityFunction.__init__and therefore lack
_invalid_value/_constraints; such objects can now be used anywhere a
ufun is accepted (pareto_frontier, the bargaining-solution calculators, a
ParetoSampler). -
[inv_ufun]
SamplingInverseUtilityFunctionwas non-instantiable
(TypeError: Can't instantiate abstract classdue to missing implementations
ofbest,max,min,within_fractions,within_indices,
worst). Added all required methods, delegating to the wrapped ufun's own
minmax()/extreme_outcomes(). -
[inv_ufun]
SamplingInverseUtilityFunction.best_inhad a sign inversion
(comparedutil < best_utilinstead of>), causing it to return the
worst outcome in a range rather than the best. -
[inv_ufun]
PresortingInverseUtilityFunction.one_incalled
_indx_of_worst_intwice instead of pairing it with_indx_of_best_in,
so it always returned the same non-random outcome rather than sampling
uniformly across the qualifying range. -
[inv_ufun]
PresortingInverseUtilityFunction.one_inearly-returnedNone
before the documentedfallback_to_higher/fallback_to_bestlogic could
trigger, silently discarding valid fallback outcomes. -
[inv_ufun]
index_below_or_equal/_nearest_aroundcould return outcomes
outside the requested utility range, causingbest_in/worst_into return
out-of-range results. Replaced with textbook-correct bisection helpers in
_common.py. -
[inv_ufun]
PresortingInverseUtilityFunctionBruteForce.reset()referenced
self._orddered_outcomes(typo) instead ofself._ordered_outcomes,
silently failing to clear state betweeninit()calls. -
[inv_ufun]
PresortingInverseUtilityFunctionBruteForce.some()fallback used
a normalization-unaware comparison, producing incorrect results when the ufun
range exceeded [0, 1]. -
[gb]
UtilBasedNegotiatornow recovers from aNoneproposal (when the
inverter finds no outcome in the requested aspiration range — e.g. a strict
inverter queried out of range, or a clamping inverter whose fallbacks are
exhausted) by falling back to the best outcome. Previously it returned
None, which the SAO mechanism treats as a refusal to propose, setting
state.broken = Trueand ending the negotiation with no agreement. -
[inv_ufun] All clamping inverters (
BIDS,MCTS,
AttributePlanning, andSamplingInverseUtilityFunction\ 's
worst_in/best_in) now apply the same fallback pattern asone_in
(expand the utility range upward, then return the nearest boundary outcome)
so they never returnNoneon a non-empty outcome space. Previously a
too-narrow aspiration range (e.g. boulware asking for
[0.99999997, 1.0]) could make them returnNoneand break the
negotiation. -
[sao] Exposed the full trace API on
SAONMI:full_trace,
full_trace_with_utils,full_trace_with_utils_df, and
negotiator_full_tracenow delegate to the underlying mechanism so the
NMI mirrorsSAOMechanism\ 's complete trace API. -
[preferences]
HyperRectangleUtilityFunctionnormalization
(normalize/normalize_for/minmax) now maps the affine range to
[0, 1]with exact extrema computed via a max-weight clique over the
rectangle-overlap graph (Helly's theorem for axis-aligned boxes) — no
enumeration of the (up to 10^50) outcome space. Also serializesbiasand
fixes anoucome_ranges→outcome_rangestypo infrom_dict. -
[inout]
Scenario.remove_dummy_issues()drops single-value placeholder
issues (e.g. the lenient Genius reader'sDUMMY_ISSUE), folding their
constant contribution into the ufun bias so utilities are preserved.
Genius loading of all-numeric ufuns now keeps the per-issue value functions
instead of folding slope/bias into the weights (which produced negative
weights that broke the canonical form on reload). Also removed an
unhashable@lru_cachefromConstFun.minmax. -
[outcomes] New
negmas.outcomes.discretizersframework: aDiscretizer
protocol plus grid-based and utility-aware balanced discretizers
(variance/quantile and outcome-count-in-bins, over one or many ufuns, with
optionalfull_gridcoordinate-descent /differential_evolution
optimization). NewSubsetCartesianOutcomeSpaceenumerates/validates an
explicit outcome subset while keeping.issues.
OutcomeSpace.to_discretegains amethod=argument accepting a
Discretizer name/class/instance. -
[preferences] Reconciled normalization around a single funnel:
normalize/normalize_forare thin wrappers over one
normalize_all_forshared by every ufun type;
AffineUtilityFunctionmaps the reserved value through the full affine
map; normalizing an affine ufun to[0, 1]returns the Method-3 canonical
LinearAdditiveform (weights sum to 1) that round-trips to Genius XML;
and constant/zero-weight affine ufuns now normalize to a
ConstUtilityFunctioninstead of raising. -
[outcomes] Made
outcome_spacetruthiness safe:
DiscreteCartesianOutcomeSpace.__len__overflowsPy_ssize_ton large
spaces (a product of issue cardinalities), so anyif outcome_spacetest
raisedOverflowError— replaced with explicitis Nonechecks across
the codebase and added__bool__(cardinality > 0) as
defense-in-depth. Also restored generator/iterator support in
os_or_none\ 'soutcomesbranch. -
[registry] Registered the Python-native Genius BOA negotiators
(GBoulware,GConceder,GLinear,GHardliner,
GHardHeaded,GAgentK,GAgentSmith,GNozomi,GFSEGA,
GCUHKAgent,GAgentLG,GAgentX,GRandom) unconditionally,
since they run natively without the Java Genius bridge.
Release 0.15.8
Changes
-
[cartesian]
cartesian_tournamentgained two parameters that give callers
control over process isolation and how unserializable tasks are handled
(both threaded through the saved config so continued tournaments keep the
setting):process_isolation:None(auto, the previous behavior),True
(always isolate each task in its own process), orFalse(run in-process,
skipping the per-task serialization/spawn cost; warns if a finite timeout is
set since it cannot be hard-enforced in-process).allow_inline_fallback: whenFalse, a task whose payload cannot be
cloudpickled is failed viaon_errorwithUnserializableTaskError
(recorded as a failed run with the reserved value for every negotiator)
instead of silently running unprotected in-process and losing the
external_timeouthard-kill guarantee.
run_isolated_tasksnow always surfaces an in-process fallback, printing the
offending negotiator class names and the exact serialization error to stderr
and viawarnings(defeating Python's once-per-site dedup) rather than
swallowing the exception.
Bug Fixes:
- [fix]
SAOMechanism.full_tracenow records the negotiator(s) that
accepted an offer in theresponsesdict instead of the proposer. An
off-by-one inget_acceptancesstarted counting acceptances at the
proposer's own index, so an accepted offer (e.g. an immediate agreement) was
mislabeled with the proposer's id rather than the acceptor's. The range now
starts one past the proposer, wrapping correctly for >2 negotiators. The
offerer's implicit acceptance is excluded whenoffering_is_acceptingis
True; when it isFalsethe offerer's explicit acceptance is recorded.