| + {[1, 2, 3, 4].map((r) => ( + | + R{r} + | + ))} +
|---|---|
| + {name} + | + {[0, 1, 2, 3].map((roomIdx) => { + const isAssigned = assignment[agentIdx] === roomIdx; + return ( ++ + handleValuationChange(agentIdx, roomIdx, e.target.value) + } + className={`w-12 h-8 text-xs text-center ${ + isAssigned ? "ring-2 ring-primary bg-primary/10" : "" + }`} + min={0} + max={99} + /> + | + ); + })} +
+ vij = Agent i's value for Room j +
+| + {[1, 2, 3, 4].map((r) => ( + | + R{r} + | + ))} +
|---|---|
| + {name} + | + {[0, 1, 2, 3].map((roomIdx) => { + const util = utilities[agentIdx][roomIdx]; + const isAssigned = assignment[agentIdx] === roomIdx; + const isEnvied = envyInfo.some( + (e) => e.from === agentIdx && assignment[e.to] === roomIdx + ); + return ( +
+
+ {util}
+
+ |
+ );
+ })}
+
+ uij = vij − rj +
++ Each agent must be assigned to exactly one room. +
+ ) : isEnvyFree ? ( ++ No agent prefers another agent's room at the current prices. This is an envy-free allocation! +
+ ) : ( ++ Problem: n agents share n rooms and must divide a total rent R. +
++ Goal: Find an assignment σ and rents r₁,...,rₙ (summing to R) such that + no agent envies another—i.e., each agent's utility for their own room is at least as high + as for any other room. +
++ Utility: uij = vij − rj (value minus rent). +
++ Envy-Free: Agent i is envy-free if ui,σ(i) ≥ uij for all j. +
++ Explore fair division by assigning rooms and setting rents. Can you find an + allocation where no one envies another? +
+