closedhumanPR #43Transport

The_Dealmakers: multi-attribute bargaining, Pareto frontier, agents learning to trade off price vs quantity

The default alternating_offers plugin bargains over price only — it reads one number from Terms and ignores everything else.

Author

cloud-post-code avatar

@cloud-post-code

github profile →
Status
Closed without merging
Opened on
Jun 27
Branch
hackathon/The_Dealmakers

Description

The pitch.

## What this PR does

The default `alternating_offers` plugin bargains over **price only** — it reads one number from `Terms` and ignores everything else. This PR adds a second plugin, `pareto`, where agents bargain simultaneously over **price, quantity, and quality** and converge toward Pareto-optimal agreements: deals where neither side could be made better off without making the other worse.

---

## Spec deliverables (§07 — Multi-attribute negotiation with Pareto-frontier search)

| Criterion | Where |
|-----------|-------|
| Plugin registered as `("negotiation", "pareto")` | `plugins.py` +1 line |
| Bargains over ≥ 2 attributes from `Terms` | price + quantity + quality |
| Each agent has a private utility function | `ParetoParams` per agent, never shared |
| Utility weights passed via constructor only | `ParetoNegotiator(agent_id, params)` |
| `respond()` evaluates full `Terms` | checks p, n, q feasibility + utility |
| Converges toward Pareto-optimal agreement | strictly fewer dominated agreements than baseline |
| Adversarial validator FAILs `alternating_offers` | 10/10 sessions quantity-dominated |
| Adversarial validator PASSes `pareto` | fewer violations than baseline in every run |
| Scenario with 10 buyer-seller pairs | `scenarios/multi_attribute_market.yaml` |
| Deterministic params from seeded RNG | `hash(agent_id) ^ seed` in `_agent_rng` |
| Does not break `alternating_offers` | extended, not replaced; all existing tests pass |
| Breakdown sessions labeled and excluded | pairs 7 (price-gap) and 8 (quality-gate) emit `close:breakdown:` |

---

## Attribute model

```
price.amount           → p   (int 0–100)   distributive axis — buyer wants low, seller wants high
conditions["quantity"] → n   (int)          integrative axis  — buyer has convex sweet-spot, seller linear
conditions["quality"]  → q   (float 0–1)   static per session; gates feasibility only
```

The integrative quantity axis is what makes Pareto search meaningful: the joint-optimal `n` differs from both opening positions, so both parties can be made strictly better off by moving it — something `alternating_offers` never does.

---

## Six strategies (spec equations 10–12)

| Strategy | Concession rule |
|----------|----------------|
| `ttt_directional` | Mirror a bounded fraction of the opponent's per-issue movement on each axis |
| `zeuthen_concede` | Concede when own Zeuthen risk ratio ≤ opponent's; decrement `tau` by `tau_step` |
| `rubinstein_discount` | Accept when `u_i(x_j) ≥ delta^t · V_i`; discount continuation value each round |
| `logrolling_tradeoff` | Stay on own iso-utility contour; maximise estimated opponent utility |
| `nash_bargaining` | Asymmetric Nash product `(u_i − d_i)^β · û_j^(1−β)` over own feasible grid |
| `ks_bargaining` | Kalai-Smorodinsky: minimise `|λ_i − λ_j|` where `λ = (u − d) / (m − d)` |

Strategies are assigned deterministically: buyer for pair `i` gets `STRATEGY_IDS[(i*2) % 6]`, seller gets `STRATEGY_IDS[(i*2+1) % 6]`. Buyer and seller always get different strategies.

---

## Files changed

### New files
| File | What it does |
|------|-------------|
| `negotiation/pareto.py` (1378 lines) | Plugin: `ParetoParams`, utility model, 6 strategies, `ParetoNegotiator` |
| `scenarios_builtin/multi_attribute_market.py` (448 lines) | Scenario factory: 10 client-consultant pairs; joint zone opening; clamped counters; breakdown pairs 7 & 8 |
| `scenarios/multi_attribute_market.yaml` | Runs with `negotiation: pareto`, seed=7, 10 rounds, 10 pairs |
| `scenarios/multi_attribute_market_altoffers.yaml` | Same scenario with `alternating_offers` — adversarial control |
| `tests/test_pareto_negotiation.py` (339 lines) | 8 integration tests |
| `tests/test_pareto_properties.py` (256 lines) | Hypothesis property tests: determinism, monotonic concession, individual rationality |
| `tests/test_pareto_strategies.py` (633 lines) | All 6 strategies in self-play + all 36 cross-strategy pairs; behavioral assertions per strategy |
| `scenarios

…

Try it

Open PR on GitHubView diff

Checkout locally

git fetch origin pull/43/head:pr-43
git checkout pr-43