Bug - Confirmed Maximizer didn't equip a weapon

Unusual things which are true for you: you don't have a familiar, and you don't have either a weapon or offhand equipped.

If you equip a familiar, can you still reproduce? If you equip a weapon, does it still recommend nothing, or does it recommend an offhand in that case?

Can you `modtrace item` and `modtrace exp` in the CLI to get a clue as to why it thinks equipping a weapon would lower your score?

I also assume you are https://api.aventuristo.net/av-snapshot?u=Natnit: you are in standard, and you have almost every existing skill.
 
Yup, that's me!

Using maximizer string = "5item,10exp,+200bonus June cleaver,-tie,2 dump"

Case 1 - Default (no familiar, unarmed)​

> modtrace item

typesourceItem DropItem Drop PenaltySporadic Item DropCombat Item Damage Percent
ItemCincho de Mayo+15.00= +15.00
Itemcombat lover's locket+25.00= +40.00
SkillPowers of Observatiogn+10.00= +50.00
SkillNatural Born Scrabbler+5.00= +55.00
Skill20/20 Vision+10.00= +65.00
SkillFruit Recognition+5.00= +70.00
SkillMad Looting Skillz+20.00= +90.00
SkillThief Among the Honorable+5.00= +95.00
SkillDeft Hands+25.00= +25.00

> modtrace exp


typesourceExperienceMuscle ExperienceMysticality ExperienceMoxie ExperienceFamiliar ExperienceMuscle Experience PercentMysticality Experience PercentMoxie Experience Percent
SignOpossum+10.00= +10.00
SkillCrimbo Training: Passenger Greeter+1.00= +1.00
ClassEXP/2+20.97= +20.97
ClassEXP/4+9.08= +9.08+9.08= +9.08

Maximizer suggests: no change, stay unequipped

Maximizer logs:
Code:
Maximizer: 5item,10exp,+200bonus June cleaver,-tie,2 dump
Maximizing...
Outfits    [Eldritch Equipage, Bounty-Hunting Rig, BRICKOfig Outfit, Crimbo Duds,    Furry Suit, Bow Tux]
SLOT HAT
[helmet turtle (1,284), ravioli hat    (1,284), disco mask (1,284), coconut shell (1,284), seal-skull helmet    (1,284), mariachi hat (1,284), Hollandaise helmet (1,284), Apriling band    helmet (1,284)]
[Apriling band helmet]
SLOT WEAPON
[toy accordion    (894), (none) (894)]
[(none)]
SLOT OFFHAND
[hobo code binder    (894), magical ice cubes (894), stuffed spooky gravy fairy (894), stuffed    astral badger (894), stuffed MagiMechTech MicroMechaMech (894), stuffed    snowy owl (894), august scepter (894), Roman Candelabra (894), (none)    (894), unbreakable umbrella (broken) (1,019)]
[unbreakable umbrella    (broken)]
SLOT CONTAINER
[bat wings (1,284)]
[bat wings]
SLOT    SHIRT
[Jurassic Parka (kachungasaur mode) (1,293)]
[Jurassic Parka    (kachungasaur mode)]
SLOT PANTS
[old sweatpants (1,284), tearaway    pants (1,284), designer sweatpants (1,284)]
[designer sweatpants]
SLOT    ACCESSORY1
[spring shoes (1,209), cursed monkey's paw (1,209), Everfull    Dart Holster (1,209), Cincho de Mayo (1,284), astral mask (1,309), combat    lover's locket (1,334)]
[combat lover's locket, astral mask, Cincho de    Mayo, spring shoes]
SLOT ACCESSORY2
[seal-clubbing club (894),    turtle totem (894), pasta spoon (894), saucepan (894), little paper    umbrella (894), candy cane sword cane (894), (none) (894), June cleaver    (1,094)]
[June cleaver]
SLOT ACCESSORY3
[disco ball (894), (none)    (894)]
[(none)]
SLOT STICKER3
[seal-clubbing club (894), turtle    totem (894), pasta spoon (894), saucepan (894), disco ball (894), little    paper umbrella (894), candy cane sword cane (894), (none) (894), June    cleaver (1,094)]
[June cleaver, (none), candy cane sword cane, little    paper umbrella, disco ball, saucepan, pasta spoon, turtle totem,    seal-clubbing club]
168 combinations checked, best score 1,393.20

Case 2 - With familiar (cookbookbat) (but unarmed)​

> familiar cookbookbat

> modtrace item

typesourceItem DropItem Drop PenaltySporadic Item DropCombat Item Damage Percent
ItemCincho de Mayo+15.00= +15.00
Itemcombat lover's locket+25.00= +40.00
SkillPowers of Observatiogn+10.00= +50.00
SkillNatural Born Scrabbler+5.00= +55.00
Skill20/20 Vision+10.00= +65.00
SkillFruit Recognition+5.00= +70.00
SkillMad Looting Skillz+20.00= +90.00
SkillThief Among the Honorable+5.00= +95.00
SkillDeft Hands+25.00= +25.00

> modtrace exp


typesourceExperienceMuscle ExperienceMysticality ExperienceMoxie ExperienceFamiliar ExperienceMuscle Experience PercentMysticality Experience PercentMoxie Experience Percent
SignOpossum+10.00= +10.00
SkillCrimbo Training: Passenger Greeter+1.00= +1.00
ClassEXP/2+20.97= +20.97
ClassEXP/4+9.08= +9.08+9.08= +9.08

Maximizer suggests: no change, stay unequipped

Maximizer logs:
Code:
Maximizer: 5item,10exp,+200bonus June cleaver,-tie,2 dump
Maximizing...
Outfits    [Eldritch Equipage, Bounty-Hunting Rig, BRICKOfig Outfit, Crimbo Duds,    Furry Suit, Bow Tux]
SLOT HAT
[helmet turtle (1,284), ravioli hat    (1,284), disco mask (1,284), coconut shell (1,284), seal-skull helmet    (1,284), mariachi hat (1,284), Hollandaise helmet (1,284), Apriling band    helmet (1,284)]
[Apriling band helmet]
SLOT WEAPON
[toy accordion    (894), (none) (894)]
[(none)]
SLOT OFFHAND
[hobo code binder    (894), magical ice cubes (894), stuffed spooky gravy fairy (894), stuffed    astral badger (894), stuffed MagiMechTech MicroMechaMech (894), stuffed    snowy owl (894), august scepter (894), Roman Candelabra (894), (none)    (894), unbreakable umbrella (broken) (1,019)]
[unbreakable umbrella    (broken)]
SLOT CONTAINER
[bat wings (1,284)]
[bat wings]
SLOT    SHIRT
[Jurassic Parka (kachungasaur mode) (1,293)]
[Jurassic Parka    (kachungasaur mode)]
SLOT PANTS
[old sweatpants (1,284), tearaway    pants (1,284), designer sweatpants (1,284)]
[designer sweatpants]
SLOT    ACCESSORY1
[spring shoes (1,209), cursed monkey's paw (1,209), Everfull    Dart Holster (1,209), Cincho de Mayo (1,284), astral mask (1,309), combat    lover's locket (1,334)]
[combat lover's locket, astral mask, Cincho de    Mayo, spring shoes]
SLOT ACCESSORY2
[seal-clubbing club (894),    turtle totem (894), pasta spoon (894), saucepan (894), little paper    umbrella (894), candy cane sword cane (894), (none) (894), June cleaver    (1,094)]
[June cleaver]
SLOT ACCESSORY3
[disco ball (894), (none)    (894)]
[(none)]
SLOT FAMILIAR
[(none) (1,284), tiny stillsuit    (1,284)]
[tiny stillsuit]
SLOT STICKER3
[seal-clubbing club    (894), turtle totem (894), pasta spoon (894), saucepan (894), disco ball    (894), little paper umbrella (894), candy cane sword cane (894), (none)    (894), June cleaver (1,094)]
[June cleaver, (none), candy cane sword    cane, little paper umbrella, disco ball, saucepan, pasta spoon, turtle    totem, seal-clubbing club]
168 combinations checked, best score 1,393.22

Case 3 - Armed with a 1-hander (June cleaver) (but no familiar)​

> modtrace item



type source Item Drop Item Drop Penalty Sporadic Item Drop Combat Item Damage Percent
Item Cincho de Mayo +15.00 = +15.00
Item combat lover's locket +25.00 = +40.00
Skill Powers of Observatiogn +10.00 = +50.00
Skill Natural Born Scrabbler +5.00 = +55.00
Skill 20/20 Vision +10.00 = +65.00
Skill Fruit Recognition +5.00 = +70.00
Skill Mad Looting Skillz +20.00 = +90.00
Skill Thief Among the Honorable +5.00 = +95.00
Skill Deft Hands +25.00 = +25.00


> modtrace exp



type source Experience Muscle Experience Mysticality Experience Moxie Experience Familiar Experience Muscle Experience Percent Mysticality Experience Percent Moxie Experience Percent
Sign Opossum +10.00 = +10.00
Skill Crimbo Training: Passenger Greeter +1.00 = +1.00
Class EXP/2 +20.97 = +20.97
Class EXP/4 +9.08 = +9.08 +9.08 = +9.08


Maximizer suggests: keeping June cleaver equipped, also equipping "umbrella bucket style" in the offhand

Maximizer logs:
Code:
Maximizer: 5item,10exp,+200bonus June cleaver,-tie,2 dump
Maximizing...
Outfits    [Eldritch Equipage, Bounty-Hunting Rig, BRICKOfig Outfit, Crimbo Duds,    Furry Suit, Mutant Parts Apparel, Bow Tux]
SLOT HAT
[helmet turtle    (1,484), ravioli hat (1,484), disco mask (1,484), coconut shell (1,484),    seal-skull helmet (1,484), mariachi hat (1,484), Hollandaise helmet    (1,484), Apriling band helmet (1,484)]
[Apriling band helmet]
SLOT    WEAPON
[toy accordion (1,284)]
[toy accordion]
SLOT OFFHAND
[hobo    code binder (1,484), magical ice cubes (1,484), stuffed spooky gravy fairy    (1,484), stuffed astral badger (1,484), stuffed MagiMechTech    MicroMechaMech (1,484), stuffed snowy owl (1,484), august scepter (1,484),    Roman Candelabra (1,484), (none) (1,484), unbreakable umbrella (broken)    (1,609)]
[unbreakable umbrella (broken)]
SLOT CONTAINER
[bat    wings (1,484)]
[bat wings]
SLOT SHIRT
[Jurassic Parka    (kachungasaur mode) (1,493)]
[Jurassic Parka (kachungasaur mode)]
SLOT    PANTS
[old sweatpants (1,484), tearaway pants (1,484), designer    sweatpants (1,484)]
[designer sweatpants]
SLOT ACCESSORY1
[spring    shoes (1,409), cursed monkey's paw (1,409), Everfull Dart Holster (1,409),    Cincho de Mayo (1,484), astral mask (1,509), combat lover's locket (1,534)]
[combat    lover's locket, astral mask, Cincho de Mayo, spring shoes]
SLOT    ACCESSORY2
[seal-clubbing club (1,484), turtle totem (1,484), pasta    spoon (1,484), saucepan (1,484), little paper umbrella (1,484), candy cane    sword cane (1,484), (none) (1,484), June cleaver (1,684)]
[June cleaver]
SLOT    ACCESSORY3
[disco ball (1,484), (none) (1,484)]
[(none)]
SLOT    STICKER3
[seal-clubbing club (1,284), turtle totem (1,284), pasta spoon    (1,284), saucepan (1,284), disco ball (1,284), little paper umbrella    (1,284), candy cane sword cane (1,284), June cleaver (1,484)]
[June    cleaver, candy cane sword cane]
48 combinations checked, best score    1,718.20

Case 4 - Back to default (no familiar, unarmed)​

> modtrace item


type source Item Drop Item Drop Penalty Sporadic Item Drop Combat Item Damage Percent
Item Cincho de Mayo +15.00 = +15.00
Item combat lover's locket +25.00 = +40.00
Skill Powers of Observatiogn +10.00 = +50.00
Skill Natural Born Scrabbler +5.00 = +55.00
Skill 20/20 Vision +10.00 = +65.00
Skill Fruit Recognition +5.00 = +70.00
Skill Mad Looting Skillz +20.00 = +90.00
Skill Thief Among the Honorable +5.00 = +95.00
Skill Deft Hands +25.00 = +25.00


> modtrace exp

type source Experience Muscle Experience Mysticality Experience Moxie Experience Familiar Experience Muscle Experience Percent Mysticality Experience Percent Moxie Experience Percent
Sign Opossum +10.00 = +10.00
Skill Crimbo Training: Passenger Greeter +1.00 = +1.00
Class EXP/2 +20.97 = +20.97
Class EXP/4 +9.08 = +9.08 +9.08 = +9.08



Maximizer suggests: no change, stay unequipped

Maximizer logs:

Code:
Maximizer: 5item,10exp,+200bonus June cleaver,-tie,2 dump
Maximizing...
Outfits    [Eldritch Equipage, Bounty-Hunting Rig, BRICKOfig Outfit, Crimbo Duds,    Furry Suit, Bow Tux]
SLOT HAT
[helmet turtle (1,284), ravioli hat    (1,284), disco mask (1,284), coconut shell (1,284), seal-skull helmet    (1,284), mariachi hat (1,284), Hollandaise helmet (1,284), Apriling band    helmet (1,284)]
[Apriling band helmet]
SLOT WEAPON
[toy accordion    (894), (none) (894)]
[(none)]
SLOT OFFHAND
[hobo code binder    (894), magical ice cubes (894), stuffed spooky gravy fairy (894), stuffed    astral badger (894), stuffed MagiMechTech MicroMechaMech (894), stuffed    snowy owl (894), august scepter (894), Roman Candelabra (894), (none)    (894), unbreakable umbrella (broken) (1,019)]
[unbreakable umbrella    (broken)]
SLOT CONTAINER
[bat wings (1,284)]
[bat wings]
SLOT    SHIRT
[Jurassic Parka (kachungasaur mode) (1,293)]
[Jurassic Parka    (kachungasaur mode)]
SLOT PANTS
[old sweatpants (1,284), tearaway    pants (1,284), designer sweatpants (1,284)]
[designer sweatpants]
SLOT    ACCESSORY1
[spring shoes (1,209), cursed monkey's paw (1,209), Everfull    Dart Holster (1,209), Cincho de Mayo (1,284), astral mask (1,309), combat    lover's locket (1,334)]
[combat lover's locket, astral mask, Cincho de    Mayo, spring shoes]
SLOT ACCESSORY2
[seal-clubbing club (894),    turtle totem (894), pasta spoon (894), saucepan (894), little paper    umbrella (894), candy cane sword cane (894), (none) (894), June cleaver    (1,094)]
[June cleaver]
SLOT ACCESSORY3
[disco ball (894), (none)    (894)]
[(none)]
SLOT STICKER3
[seal-clubbing club (894), turtle    totem (894), pasta spoon (894), saucepan (894), disco ball (894), little    paper umbrella (894), candy cane sword cane (894), (none) (894), June    cleaver (1,094)]
[June cleaver, (none), candy cane sword cane, little    paper umbrella, disco ball, saucepan, pasta spoon, turtle totem,    seal-clubbing club]
168 combinations checked, best score 1,393.20
 
Well I dreamed about this last night. That may be a good sign - subconscious background processing - or it may need I need to Get A Life. I am writing this before my morning copy and without looking at any code to answer my own speculations. But sometimes asking questions does trigger new lines of inquiry.

I have always maintained that, based upon the code, the maximizer not recommending a weapon and the maximizer failing to equip the recommended weapon are different problems. The GUI and the cli/script calls illustrate that. When I look at the dump 2 logs I am either skimming them too fast, not understanding them or they are confirming that the maximizer did select a weapon. So how are we deciding that a weapon was not equipped? Does the code run the maximizer and then check the weapon slot? The actual equipping is a request so is it possible failure to equip is the result of some kind of timing? Does issuing a refresh change anything?

If someone wants to point me to the autoscend maximizer call and failure to equip check that will save me some time with grep.

My tests inspect the request that is built but they can't send it to KoL and get an answer. Is that a point of failure in the live world?

Using the debugger and creating conditions that are unlikely to occur naturally I have noticed foldables introduce some complexity when executing maximizer recommendations and there are still times when KoLmafia will complain about a conflict between a two handed weapon and something in the off hand slot rather than unequip something to resolve that. If something like that was going on would autoscend be aware?

I will revisit this post later :-)
 
Hah! I dreamed about it last night too. Had gathered some data but didn't have a chance to post it. Great to be in such excellent debugging company!

Helpful to read your musings, and I'll add some narrative of my own:
  • Ryo alluded to this, but it looks like there's distinct steps of Maximizer Speculation, followed by Maximizer Execution. From context, seems like scoring is done by speculation, and equipping is done by execution
  • Ran into a strange case on day3 of ascension. Still no adventures spent. When I logged in, character was still in the error state. As I did more testing (including equipping, and then unequipping a June cleaver for maximizer calls) something changed, and maximizer started suggesting I equip a weapon even from unarmed! But importantly, when I closed Mafia and re-opened it, I was able to re-enter the error state. Strong intuition that we're looking at a caching issue, so started looking into static fields, how the code uses clone(), and Maximizer.firstTime
  • Luckily for the above, I had added some logging into MaximizerSpeculation.java, and built a local copy of Mafia with more verbose logging around each Maximizer combination suggested
    • Here's an example of the code change
    • maximizer3.PNG
    • Case A: output when running maximizer with equipped 1-hander: suggests equipping weapon & offhand
    • Case B: output when running maximizer while unarmed: suggests equipping weapon & offhand (unexpectedly left the error state and now "working as intended")
    • Case C: after restarting Mafia, output when running maximize while unarmed: suggests remained unarmed (back to error state)
    • Next steps: filter out unimportant equip slots, add any fields folks find interesting, and move logs into a sheet to review more easily
 

Attachments

Last edited:
Case C, combo 21

That appears to be the highest score and does not include a weapon.

I do note that it improves combo 20 by about 170 by dropping the broken umbrella offhand.

That seems counterintuitive.

Thanks for reminding me of statics and caching. I have a vague recollection of trying to write a test that called the maximizer, saved the results, called it again saved the results and then compared them. I'm pretty sure I wanted to compare calling via the GUI vs calling via cli/script and I gave up because actually making a copy of the static data was more fiddly than I wanted to deal with.
 
Combo 21 is the same as combo 2 and 5, but while those score 999.75, 21 scores 1393.2

As you are comfortable recompiling Mafia, could you add a log in src/net/sourceforge/kolmafia/persistence/ModifierDatabase.java, line 432, to see if it ever sets a familiar on the modifiers object? I added a note for suspicion last time I was in that area of the code. The score difference is probably too high for it to be that, though.

The reason why it doesn't happen when you have a weapon equipped (I think) is that Mafia will add the currently equipped items to the list of items it should consider. So if you have no item equipped, it will definitely consider equipping no item, whereas if you have an item equipped, it won't.

One caveat in this is that if you have DFSS, a weapon and no offhand, it seems it should consider no item to be a valid one-handed weapon, which should then get added to the valid weapons in Evaluator line "automatic.get(Slot.WEAPON).addAll(automatic.get(Evaluator.WEAPON_1H));". Why this doesn't break things I don't know. I thought there could be an issue with "addAll" meaning "none" appears in the list twice (as it is both a valid weapon and a valid one-handed weapon), but I also can't see how that would break anything looking at the loops. It might be why there are multiple identical combos, though.
 
Combo 21 is the same as combo 2 and 5, but while those score 999.75, 21 scores 1393.2

Missed that. Thank you. I'd say if two things appear the same but give different scores then we need to understand why they are not the same or accept that the maximizer is non-deterministic :-)

As you are comfortable recompiling Mafia, could you add a log in src/net/sourceforge/kolmafia/persistence/ModifierDatabase.java, line 432, to see if it ever sets a familiar on the modifiers object? I added a note for suspicion last time I was in that area of the code. The score difference is probably too high for it to be that, though.

I'll try a log or breakpoint but my runs are not having the problem.
 
As you are comfortable recompiling Mafia, could you add a log in src/net/sourceforge/kolmafia/persistence/ModifierDatabase.java, line 432, to see if it ever sets a familiar on the modifiers object? I added a note for suspicion last time I was in that area of the code. The score difference is probably too high for it to be that, though.

I can do it (still in the error state :cool:). Added a log there and recompiled Mafia. Will run through some maximizer tests later today
 
Added this to ModifierDatabase.java, line 432
Code:
RequestLogger.printLine("*** Setting familiar in ModifierDatabase: " + fam.toString());
  • Logged in
  • Ran maximizer string while unarmed
  • Equip June cleaver
  • Ran maximizer string while equipping a one-hander
  • Unequip June cleaver
  • Equip familiar cubeling
  • Run maximizer string while unarmed
  • Unequip familiar cubeling
  • Run maximizer string while unarmed
  • Run maximizer string (append ",switch cubeling,switch volleyball") while unarmed
Attached log doesn't show any triggers of our special log line.
 

Attachments

Back
Top