> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bijection.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Inventory allocation and review

> Compare allocation strategies on fixed inputs and land a reviewed strategy change.

[Northstar](https://github.com/bijectionhq/bijection/tree/main/examples/northstar)
models a warehouse with 10 headlamps and four orders requesting 16 units.
Orders are filled whole. The pure strategy in `bijection/allocation.ts` and
the score in `bijection/scoring.ts` show how the rule changes the result on
the same inventory and business date.

| Strategy | Orders reserved | Orders due today filled |
| - | - | - |
| Oldest first | A, B | 1 |
| Earliest deadline | B, C, D | 2 |
| Most due today | B, C, D | 2 |

## Compare strategies in branches

Each strategy runs in its own [branch](https://docs.bijection.com/branches) over the same version,
so every run sees the same inputs. The client calls
`client.in(branch).mutate(api<typeof App>().warehouse.allocateWith, …)` in each
branch; `allocateWith` refuses at head. `scenarios.compare` and
`scenarios.score` read every branch's reservations with `.in(branch)` and
apply the same invariant to each: an order has at most one reservation, and
reservations never exceed stock.

## Propose, approve and land a strategy change

The allocation strategy is a field of the stock fact. `scenarios.propose`
opens a branch for one position, and the client runs
`scenarios.setStrategy` in it. `scenarios.askApproval` checks the branch
changes exactly that strategy, records the `evaluated` verdict on the
branch's reviewed version, and [asks the Approvals app](https://docs.bijection.com/operations/review.md)
for a planner's decision with a seven-day deadline. When it is approved,
the continuation `scenarios.decided` lands exactly that version, and the
landing refuses `Conflict` if the branch moved past it. Run
`warehouse.allocate` at head to apply the landed strategy to current stock.

The [invoice adjustments example](https://github.com/bijectionhq/bijection/tree/main/examples/invoice-adjustments)
stages and inspects a smaller reviewable change.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.