So, some math.
Let's compare two simple consumption plans for food with jarlsberg breakfast.
Plan 1: one big food, size F+G, quality A
Plan 2: one smaller food, size F, quality B; and something to fill the remaining size G with average quality C
(also assume that everything is free, to simplify things - does EatDrink assign meat cost to jarlsberg food?)
(and that F>=1, G>=1, so that we are not eating "empty" foods)
Plan 1 yields (A+3)*(F+G) adventures
Plan 2 yields (B+3)*F+C*G adventures
Now what does each of the two heuristics do when picking the first food, and when does it fail.
A) assuming value just increases by 3
gives plan 1 value A+3
gives plan 2 value B+3
Is wrong (picks the wrong plan) when
a1) picks plan 1 when it should pick plan 2: A+3>B+3 and (A+3)*(F+G)<=(B+3)*F+C*G
which is:
Code:
B+3 < A+3 <= ((B+3)*F+C*G)/(F+G) // assumes F+G>0, which it probably is, with F and G being sizes of foods
*(F+G): (B+3)*(F+G) < (B+3)*F+C*G
(B+3)*G < C*G
B+3 < C // when G>0, which it is
which together gives A>B and B<C-3
.. but that means it could be even better to reorder plan 2 into ...
plan 3: size G with average quality C (and the bonus breakfast +3 for at least the first full), then size F with quality B
(actual yield >= G*C+F*B+3 >= , heuristic value >=C+3>B+6)
So to be wrong, this heuristic must also pick plan 1 over plan 3 (which means A>C). Worst case for me:
Code:
B<A, B<C-3; C<A, (A+3)*(F+G)<=G*C+F*B+3
// use C<A, then B<C-3; expanding 0=3-3 and -3=3-6 along the way
(C+3)*(F+G) <= G*C+F*B+3 = G*(C+3)-3*G+F*B+3 <= G*(C+3) - 3*G +F*(C-3)+3 = G*(C+3) - 3*G + F*(C+3) - 6*F +3
// (C+3)*(F+G) cancels out
0 <= -3*G - 6*F + 3
G+2*F <= 1
But G and F are both at least 1, so G+2*G>=3>1.
That looks a lot like "can't happen". Which, in turn, looks a lot like "I must have made an error somewhere". I will look for it later.
On the other hand, it's not *that* surprising - I started with the bigger food being higher quality, and concluded that plan 2 should start with low quality food and end with higher quality food, contradicting the way EatDrink works.
or a2) picks plan 2 when it should pick plan 1: A+3<=B+3 and (A+3)*(F+G)>(B+3)*F+C*G
Code:
(B+3)*(F+G)>=(A+3)*(F+G)>(B+3)*F+C*G
(B+3)*G>=C*G
B+3>C
So A+3<=B+3<C - the big food is not better than the leading small food, and there is nothing left to fill the remaining space that would approach the leading small food in quality (by more than 3 whole points of quality).
Cursory glance at jarlsberg food tells me that this is never the case. Bigger foods have higher quality.
B) valuing everything at (adventures+3*fullness)*VOA
(I will factor out the VOA, because I assumed zero costs, because jarlsberg)
gives plan 1 value (A+3)*(F+G)
gives plan 2 value (B+3)*F
(is actually obviously correct in practice, because this is jarlsberg food and therefore A>B and A>C)
Is wrong when:
b1) picks plan 1 when it should pick plan 2: (A+3)*(F+G)>(B+3)*F, (A+3)*(F+G)<=(B+3)*F+C*G
Code:
(B+3)*F<(A+3)*(F+G)<=(B+3)*F+C*G
0<C*G
That doesn't really say much.
OK, let's also assume B=C+1=A+4, then plan 2 should definitely be picked. To make this heuristic pick plan 1 instead, we have
Code:
(A+3)*(F+G)>(A+7)*F
(A+3)*G>4*F
A>4*F/G-3
And with an even split (F=G), this is A>1, so ... it will always be wrong under those "simple" conditions.
In fact, even with F=5, G=3, this would be A>20/3-3=3.66 (and would mean that the big food is size at least 8, which probably makes
or b2) picks plan 2 when it should pick plan 1: (B+3)*F>(A+3)*(F+G), (B+3)*F+C*G<=(A+3)*(F+G)
This should be impossible. Increasing a value shouldn't decrease it.
Code:
(B+3)*F+C*G<=(B+3)*F
C*G<=0 // contradicts basic truths about food - namely that both size and quality are positive numbers
OK.
----
Summary:
neither method is wrong in jarlsberg.