Theraze's code posted above has several changes compared to the version I am maintaining. Reconciling them is on my "ToDo" list.
1. When you set the value of adventure is the logic:
I am willing to spend "x" on getting one more adventure. Build a diet that gives me the most adventures in a day, spending upto "x" per adventure.
Or is it:
I can make "x" meat per adventure. Build a diet that makes me the most meat in a day.
Should provide ~157.5 adventures, at a cost of 17k, at a profit of 35k-77k.3x spooky lo mein [1466 meat]
1x Crimbo pie [399 meat]
4x rockin' wagon [1372.8 meat]
1x dusty bottle of {fantastic wine} [330 meat*]
1x can of Swiller [238 meat]
1x rockin' wagon [1372.8 meat]
15x twinkly wad [321 meat]
These are the same thing. If an adventure is worth X to you (being able to make X meat, having Y chance at a hobo nickel drop, whatever), then any amount less than X is worth spending on another adventure.
It's also saying (in #2) that an item priced at x+100 and generating y+2 adventures is better than an item priced x+900 and generating y+3 adventures.If valuePerAdventure is 500 then you, the player are saying that an item priced at x and yielding y adventures is the same to you as another item priced at x+500 and yielding y+1 adventures. That means EatDrink would choose between them based upon fullness and acquisition costs.
If you are the right kind of math geek you should be aware that EatDrink really is not optimizing your diet in the a strict sense.
Curiously, when I changed vOA from 500 to 1000 my diet changed dramatically and furthermore it varied with mall prices.I still maintain that EatDrink aims for #2, or it would have told me to eat much more expensively (with my valueOfAdventure=1000, it would always tell me to huff prismatic wads over twinkly wads, for example).
But I can prove that approximation is suboptimal. That should be clear if you just note that the approximation only considers one item at a time rather than solving the simultaneous system. Do I have to dig out an Operations Research textbook? ;-)It's using an approximation scheme, but the problem is still of the form "maximize { objective_function(x) where constraints(x) }"
Curiously I also find the problem formulation less useful when adventures are deemed convertible to meat. Maximizing the number of adventures generated subject to fullness and a meat budget is the formulation I am using in my EatDrink alternative. Since I am not going to embed a generalized linear program solver in KoLmafia or write one in Ash or extend Ash so that it can access an online solver I will use a "pick the best available item until a constraint is hit" algorithm and favor ease of implementation over mathematical optimality.BTW, neighter of these two approaches is what I would like for, say, limited content, where I want #3:
find diet D that maximizes { adventures(D) } where cost(D) <= given amount A
Yes, it will do that. It will still not pick consumables that cost 1000 meat per adventure generated, which is what it would have to if it was doing #1.Curiously, when I changed vOA from 500 to 1000 my diet changed dramatically and furthermore it varied with mall prices.
But I can prove that approximation is suboptimal. That should be clear if you just note that the approximation only considers one item at a time rather than solving the simultaneous system. Do I have to dig out an Operations Research textbook? ;-)
Curiously I also find the problem formulation less useful when adventures are deemed convertible to meat. Maximizing the number of adventures generated subject to fullness and a meat budget is the formulation I am using in my EatDrink alternative. Since I am not going to embed a generalized linear program solver in KoLmafia or write one in Ash or extend Ash so that it can access an online solver I will use a "pick the best available item until a constraint is hit" algorithm and favor ease of implementation over mathematical optimality.
I still have no idea how "optimal/suboptimal solution" is relevant to the point I had (that "I am willing to spend up to X on a single adventure, get me the most adventures at that cost" is *not* the same as "the value of generating 1 adventure is X for me, get me the biggest daily profit").