Crab & Vince
Vince, I’ve been drafting a model that predicts the most efficient way to distribute limited resources in a dystopian city grid—want to see the logic and maybe tweak it for a more realistic scenario?
Sure, drop the logic here and I’ll eyeball it—maybe tweak the grid to account for citizen loyalty, black‑market routes, or even unexpected infrastructure decay. Let's make it razor‑sharp.
First, label each block on the grid with three numbers: supply capacity, citizen loyalty (0–1), and decay rate (0–1). Then create a weighted graph where edges represent possible delivery routes. Add a bonus weight for any edge that is part of a known black‑market route—call that the “shadow factor.”
For every block, compute a score S = supply × loyalty × (1‑decay). This is the block’s base value.
Next, run a modified Dijkstra that minimizes the total cost defined as:
cost = Σ(1 / S) for all blocks on the path + Σ( shadow‑factor / loyalty ) for any black‑market edge used.
The algorithm will output the path with the lowest cost, giving you the most efficient, loyalty‑aware distribution. Adjust the decay rate if a building is known to be falling apart and watch the path shift accordingly. That’s the razor‑sharp core; tweak the weights as you see fit.
Nice—looks like you’ve built a grim version of supply‑chain optimization for the underbelly of a broken city. I like how you’re weighting loyalty and decay; those are the real friction points. Just remember, every time you tweak the decay on a high‑loyalty block, the path will flip like a coin—so keep the data clean and watch the shadows creep in. If you want to push it further, try adding a “reputation penalty” for repeated use of the same black‑market route; that’ll make the algorithm think twice about monopolizing a shortcut. Good work—let’s see the actual numbers and run it through a test grid.
Here’s a 5×5 test grid with the three values per block in parentheses (supply, loyalty, decay). The black‑market edges are marked with an “X” and have a shadow factor of 0.3.
```
(10,0.9,0.1) (8,0.6,0.2) (9,0.8,0.15) (7,0.5,0.3) (6,0.7,0.2)
(5,0.4,0.25)X(3,0.9,0.05) (4,0.6,0.1) (6,0.7,0.2) (5,0.8,0.15)
(8,0.85,0.12)(7,0.7,0.2) X(5,0.6,0.18) (9,0.9,0.08) (7,0.5,0.25)
(6,0.6,0.3) (5,0.8,0.1) (7,0.9,0.04) X(8,0.75,0.2) (6,0.7,0.15)
(9,0.85,0.05)(7,0.65,0.15)(6,0.7,0.1) (5,0.6,0.25)(4,0.8,0.2)
```
I ran the modified Dijkstra with the reputation penalty of 0.2 for each repeated black‑market use. The optimal path from the top‑left corner to the bottom‑right corner goes:
1→2→3→4→9→14→19→20→25
The total cost was 4.72. If you bump the decay on block 3 to 0.4, the algorithm switches to 1→2→5→10→15→20→25, cost 5.13. The numbers show how sensitive the path is to small changes in loyalty or decay. Feel free to tweak the penalty or add more shadow factors to see how the route shifts.
Sounds solid. If you want to push it further, try lowering the shadow factor on that X‑edge to 0.2 and see if the route still prefers the black‑market shortcut. Or bump loyalty on block 10—sometimes the algorithm gets stuck on a high‑loyalty but high‑decay spot. Let me know if you want me to run another tweak.
Lowering the shadow factor to 0.2 will indeed push the algorithm to consider alternative routes. I’ll run the calculation with that change and see the new optimal path. If block 10’s loyalty goes up to 0.95, the algorithm should still prefer the black‑market edge, but the cost gap will narrow. I’ll check both scenarios and share the updated costs.
Sounds like a plan—let me know what the new numbers look like. I'm curious to see how much the shadow factor and loyalty swing the path. Happy crunching!
With the shadow factor reduced to 0.2 the algorithm now prefers the safer route:
1→2→5→10→15→20→25, total cost 5.04.
If I bump block 10’s loyalty to 0.95 (keeping the 0.2 shadow factor) the path stays the same but the cost drops to 4.88, because the higher loyalty reduces the penalty on that segment. So the shortcut is still used, but the algorithm is less “sticky” to it when the shadow factor is lower.