Bug - Confirmed Maximizer didn't equip a weapon

ziz

Member
Broad issue: The maximizer didn't equip a weapon on the first turn of a new ascension for me (a low-to-mid-shiny account as a DB in softcore standard using autoscend).

Run on:
KoLmafia r27817
Build main-3be85c4 17.0.9 (Eclipse Adoptium 17.0.9+9) Linux amd64 6.2.0-1018-azure

The specific failure here is:

Code:
Maximizer: 5item,meat,0.5initiative,0.1da 1000max,dr,0.5all res,1.5mainstat,-fumble,0.4hp,0.2mp 1000max,3mp regen,1.5weapon damage,0.75weapon damage percent,1.5elemental damage,2familiar weight,5familiar exp,10exp,5Moxie experience percent,effective

which should have equipped a weapon - probably my disco ball, since that's what got equipped by the maximizer later after the problem stopped happening (possibly "because I equipped a weapon through the gcli", that was the action I took between "doesn't work" and "works"). Instead, it chose not to equip a weapon at all:

Code:
equip hat mariachi hat
Preference lastEncounter changed from garbage tourist to Adjust your Parka
Encounter: Adjust your Parka
Took choice 1481/1: Pull the kachungasaur tab
choice.php?whichchoice=1481&option=1
Preference parkaMode changed from  to kachungasaur

equip shirt Jurassic Parka
You acquire an item: Letter for Melvign the Gnome
Preference _concoctionDatabaseRefreshes changed from 47 to 48

equip pants old sweatpants

equip acc1 combat lover's locket

equip acc2 cursed monkey's paw

equip acc3 astral belt

In the autoscend discord channel, this has been described a few times (here and here at least, on a quick search for "maximizer"), and the consensus seems to be "solidly a Mafia bug", so I looked for another thread reporting this issue and couldn't find one; if there is one and my forum search skills are just Bad(tm), I'm glad to move my log there.

Session log attached, including a bunch of comments (all prefixed with >>> NB: ) and the extra console output from the 2 dump maximizer rerun that autoscend does.

Sorry I don't have a log with debug on, or more careful testing of what happens; I was just trying to kick off another ascension before bed and was very tired. I'll capture more details and do more experimenting next ascension (in 2-3 days if all goes as I expect) if this happens again.
 

Attachments

  • sepos_maximizer_bug_20240131.txt
    30.3 KB · Views: 4

fronobulax

Developer
Staff member
autoscend routinely fails to equip a weapon for a low level character for me but I have tracked that down, in part, to having Way of the Surprising Fist permed.

I have also experimented with some autoscend maximizer strings that gave counter-intuitive results and gotten the expected results when I simplified the strings by dropping "clauses". While there may be a solid mafia bug it may also be that with the weights and tiebreakers and sense of mystery around how the maximizer does things it may be that no weapon is a solution that satisfies most or all of the constraints and weights.

Finally, speaking as a one time numerical analyst, the maximizer is problematic because there is not guarantee that every string passed to it will have a unique solution or even any solution. But since the maximizer is not equipped to detect this it will present a bad answer with no real indication.

The best way to make some progress on this would be to specify a short list of available equipment, char stats, available skills and the shortest, least complicated maximizer string that demonstrates the problem. If someone who is Java literate presented that as a test in a PR I'm sure it would get the needed attention.
 

Malibu Stacey

Active member
I have also experimented with some autoscend maximizer strings that gave counter-intuitive results and gotten the expected results when I simplified the strings by dropping "clauses". While there may be a solid mafia bug it may also be that with the weights and tiebreakers and sense of mystery around how the maximizer does things it may be that no weapon is a solution that satisfies most or all of the constraints and weights.
When the bug happens, adding 2 dump to the maximizer & running it again gives
Code:
SLOT STICKER3
[(none) (1,682), seal-clubbing club (1,682), turtle totem (1,682), saucepan (1,682), disco ball (1,682), industrial fire extinguisher (1,699), candy cane sword cane (1,714), June cleaver (1,906)]
[June cleaver, candy cane sword cane]

And it still doesn't equip either of those.

Sure autoscend has an arcane maximizer string but the debugging info the maximizer is saying it's finding stuff it can equip and then just not doing it. Also a reliable workaround appears to be to equip any weapon then run the maximizer again et voila it starts equipping weapons from that point on with the exact same maximizer string.

I've asked the people who hit the abort I added to debug this to post their session logs in here.
 

MCroft

Developer
Staff member
I'm one of those.

What I see is that it tells me it is wielding the Turtle Totem and then doesn't. Which suggests to me that it isn't a failure to determine the correct item but a failure to actually equip it.

Rich (BB code):
[ERROR] It looks like the maximizer didn't equip any weapons for you. Lets dump some debugging info to help the KolMafia devs look into this.

Maximizer: 5item,meat,0.5initiative,0.1da 1000max,dr,0.5all res,1.5mainstat,-fumble,mox,0.4hp,0.2mp 1000max,3mp regen,0.25spell damage,1.75spell damage percent,2familiar weight,5familiar exp,15Mysticality experience,5Mysticality experience percent,+200bonus cursed magnifying glass,2 dump

Maximizing...

Outfits [Bugbear Costume, Knob Goblin Elite Guard Uniform, Hot and Cold Running Ninja Suit, eXtreme Cold-Weather Gear, Mining Gear, Swashbuckling Getup, Crimbo Duds, 8-Bit Finery, Bow Tux, Encephalic Ensemble, Glad Bag Glad Rags, Terrycloth Tackle, Tropical Crimbo Duds, Bounty-Hunting Rig, Palmist Paraphernalia, Tapered Threads, Roy Orbison Disguise, Pyretic Panhandler Paraphernalia, Dwarvish War Uniform, Pork Elf Prizes, Slimesuit, Primitive Radio Duds, Vestments of the Treeslayer, Crappy Mer-kin Disguise, Legendary Regalia of the Chelonian Overlord, Legendary Regalia of the Groovelord, Legendary Regalia of the Master Squeezeboxer, BRICKOfig Outfit, Knight's Armor, Fancy Tux, Transparent Trappings, Unblemished Uniform, Blasphemous Bedizenment, Uncle Hobo's Rags, Bits o' Honey, Luniform, Sucker Samurai Suit, Wax Wardrobe, Hot Daub Ensemble, Pinata Provisions, Animelf Apparel, Seafaring Suit, Hateful Habiliment, Cool Irons, Warbear Dress Armor, Brogre Brouture, Space Beast Furs, Xiblaxian Stealth Suit, Topiaria, Gabardine Guise, Cooper's Couture, The Jokester's Costume, Eldritch Equipage, Miming Paraphernalia, FantasyRealm Wizard's Outfit, FantasyRealm Thief's Outfit, Snakeskin Suit, Slime Enslamble, Mutant Parts Apparel, Loofah Loungewear, PirateRealm Assortment, Whittled Wearables, Guzzlr Uniform, Lathed Livery, Trainbot Trappings, Shadow Shuit, Elf Guard Fatigues, Crimbuccaneer rigging]

SLOT HAT
[Hollandaise helmet (1,138), mariachi hat (1,139)]
[mariachi hat]

SLOT WEAPON
[(none) (742), toy accordion (742)]
[toy accordion]

SLOT OFFHAND
[hobo code binder (742), (none) (742), august scepter (916), cursed magnifying glass (1,014)]
[cursed magnifying glass]

SLOT PANTS
[old sweatpants (1,139)]
[old sweatpants]

SLOT ACCESSORY1
[astral belt (1,139)]
[astral belt]

SLOT ACCESSORY2


[(none) (742), turtle totem (742), saucepan (742), candy cane sword cane (774)]


[candy cane sword cane]


SLOT STICKER3
[(none) (742), turtle totem (742), saucepan (742), candy cane sword cane (774)]
[candy cane sword cane, saucepan]

6 combinations checked, best score 1,139.35

Wielding turtle totem...
 

Capn

Member
I bumped into this issue yesterday in aftercore running VeracitySpacegate. Started fighting a hostile alien barehanded.

Or perhaps my broken champagne bottle ran out of charges. . . nevermind me.
 
Last edited:

fronobulax

Developer
Staff member
Running autoscend. Saw some of the debugging. A quick glance suggests that the maximizer recommends a weapon and that mafia fails to equip it. My hypothesis about way of the Surprising Fist does not seem supported.
 

fronobulax

Developer
Staff member
I'm going to post a PR eventually.

I tried to write a failing test using data from a character and I got one. I then experimented with the keywords and it seems that the presence of the keyword "effective" caused the failure.

5item,meat,0.5initiative,0.1da 1000max,dr,0.5all res,1.5mainstat,-fumble,mox,0.4hp,0.2mp 1000max,3mp regen,1.5weapon damage,0.75weapon damage percent,1.5elemental damage,2familiar weight,5familiar exp,10exp,5Muscle experience percent
works but

5item,meat,0.5initiative,0.1da 1000max,dr,0.5all res,1.5mainstat,-fumble,mox,0.4hp,0.2mp 1000max,3mp regen,1.5weapon damage,0.75weapon damage percent,1.5elemental damage,2familiar weight,5familiar exp,10exp,5Muscle experience percent,effective
doesn't.

I am sharing that now incase someone else wants to look at this before I clean up my kludgy test and get back to this after dinner :)
 

fronobulax

Developer
Staff member
The maximizer help says
effective - With positive weight, if muscle higher than moxie, only melee weapons are considered, if moxie higher or equal to muscle, ranged weapons (and knives with Tricky Knifework known) are considered.

What the code seems to be doing is deciding that if something is not considered then it will not be equipped.

While it is possible that other keywords might modify this it seems reasonable to say that the maximizer is doing what it was asked to do, especially if it (for example) unequips a ranged weapon from a muscle character.

So it is reasonable to say this needs to be solved by the user who uses the "effective" keyword - check for a weapon and if none was equipped then rerun the maximization without the keyword, for example. But that doesn't seem satisfactory...

@Malibu Stacey

It might be useful if you tweaked your debugging. I would be very interested in a failure to equip if the "effective" keyword was not used. When it is used, and failed, I would be interested in adjusted muscle and moxie. Whether or not there is an available and usable melee or ranged weapon might also be helpful.

If indeed, this is code that is working as intended how might you suggest changing the intention?
 

xKiv

Active member
So it is reasonable to say this needs to be solved by the user who uses the "effective" keyword - check for a weapon and if none was equipped then rerun the maximization without the keyword, for example. But that doesn't seem satisfactory...

Sometimes that's the kind of thing you need to do if you don't want to regress to some extremely ineffective general solution.
 

fronobulax

Developer
Staff member
I'd like to see an example of failure to equip that does not involve "effective".

I think effective is doing what it is supposed to do and the way ahead is to educate users and possibly add a new keyword or feature so that KoLmafia will detect/warn/abort when no weapon is equipped.
 

MCroft

Developer
Staff member
I also wondered what the keyword was supposed to do. The +effective keyword came out while I was on hiatus from Kol in 2015 and it was not vital to any scenario I cared about when I came back, although I had Tricky Knifework (or did soon enough).

The original ask was to provide a way to include knives if you had the skill and it was active, by adding a special keyword. +effective seems to meet that request.

What it looks like people are using it for is to prevent a moxie character from equipping a melee weapon and getting a lot of glancing blows (and losing fights). That's a good thing.

I guess effective isn't failing if the shortlist doesn't include any weapons. None is not invalid. But it feels like this is a fail that doesn't fail on a technicality and leaves people fighting things unarmed, as a moxie class.

If I could have anything I wanted, I'd want knives added to -melee with skill Tricky Knifework & moxie> muscle and the effective keyword used to mean "given my projected ML, level, and buffed stat, can I hit with this weapon?" Obviously, we'd have to answer "hit what?", but maybe the answer is "the typical monsters in the hardest zone of my current level's quest", or some similar rubric (that could be better unrolled rather than determined at runtime).

We could let the value of the +effective (or whatever we called the potential replacement) determine either the defense score of the beast we're testing effectiveness against or the percentage of hits we'd think was acceptable.

It might need to have a different name, but it seems pretty useful if we make it work.
 

fronobulax

Developer
Staff member
In the absence of an example of a failure to equip without the effective keyword I remain convinced that the user or script writer needs to be prepared to deal with the possibility that there is no weapon that matches the criteria specified. There are too many cases where that is the right answer.

I would prefer to consider some kind of opt-in option to warn about weaponless adventuring.
 

MCroft

Developer
Staff member
In the absence of an example of a failure to equip without the effective keyword I remain convinced that the user or script writer needs to be prepared to deal with the possibility that there is no weapon that matches the criteria specified. There are too many cases where that is the right answer.

I would prefer to consider some kind of opt-in option to warn about weaponless adventuring.
Can you go over the cases where "there is no solution for the requested modifiers" is the right answer but doesn't fail? That seems like it is a fail state, or should be. The reason being that the unarmed condition is a melee attack, so if unarmed, the moxie class is not meeting effective.

If we're in the effective branch and melee weapons (except knives) are not considered, then should they even be appearing in the dump/2 dump shortlists?

In my case, slot WEAPON shows
SLOT WEAPON
[(none) (742), toy accordion (742)]
[toy accordion]
So, I have at least one ranged weapon with a score the same as (none) and it's on the verge of picking it...

This gets overturned in the re-used Accessory Slots:
SLOT ACCESSORY2
[(none) (742), turtle totem (742), saucepan (742), candy cane sword cane (774)]
[candy cane sword cane]

SLOT STICKER3
[(none) (742), turtle totem (742), saucepan (742), candy cane sword cane (774)]
[candy cane sword cane, saucepan]

6 combinations checked, best score 1,139.35

Wielding turtle totem...
 

fronobulax

Developer
Staff member
In general, and ingrained in the thought process of any numerical analyst, before a problem is turned over to a computer for a "solution" some thought should be given to the solution. In particular does the problem have zero, one or many solutions? The world is full of infinite loops and "garbage out" computer solutions because the so called solution is accepted as being correct and unique when it isn't.

So in situations where there is no solution (incompatible constraints for example) or more than one solution (multiple items that are identical in terms of the desired effects) the maximizer will present a solution regardless of feasibility or optimality. These are the cases where the right answer should be no answer and the user should figure out what to do. The maximizer may be trying to tell users that when it predicts zero but in practice people tend to accept whatever the result is.

Hopefully that clarifies "there is no solution for the requested modifiers". Next time I have a specific case I will certainly share and I have a new area to explore - if the maximizer returns a predicted result of zero should a user understand that to mean there is not a unique solution to their request?

Your toy accordion is worthy of study but my first question is whether it is being considered as a weapon or as a way to enable casting Cadenza?
 

fronobulax

Developer
Staff member
I am unilaterally and arbitrarily doing the following later today unless there is new data or an objection:
  • Declaring that the Effective keyword is doing what it is supposed to do and the script writer/user needs to prepare for the possibility that Effective will not equip a weapon or will unequip one that is presently equipped.
  • Changing the PR from Draft to Ready. It tests the expected behavior for Effective. i.e. sometimes not equipping a weapon.
  • Changing the status of this to Not A Bug.
  • Waiting for a Bug Report where the Maximizer fails to equip a weapon that should be considered and the keyword Effective is not used.
  • Waiting for a Feature Request to modify the behavior of Effective or modify the behavior or KoLmafia when no weapon is selected/equipped.
  • Exploring the possibility that when the Maximizer returns a predicted value of zero the user should review the maximization result and not just blindly accept it.
 

MCroft

Developer
Staff member
I am unsatisfied with this result, which is OK, but I will at least explain my reasoning and you may not agree. It makes the plain wording of the keyword not work.
1: I have asked for effective weaponry.
2: I have found effective weaponry
3: I have tried and failed to equip a non-effective weapon that is a melee weapon
4: I am left unarmed, which is also ineffective.

The keyword cannot be satisfied (or perhaps should have been satisfied with a ranged weapon), and instead left me in a state where I have no effective attack.

Failure to satisfy the requested maximizer conditions generally results in a failure.
Maximizer: ML 10000min Maximizing... 540 combinations checked, best score 61.00 (FAIL)

I believe that if the effective keyword is in place, then the weapons (melee - knives) that are not considered for the weapon slot should not be considered for the offhand/onhand combinations in the final attempt. Slot Accessory 2 should never have considered Turtle Totem.

If I wanted to equip the turtle totem as a moxie class, I should avoid the keyword effective.

If we not a bug this, we should just throw out the Effective keyword.
 
Last edited:

MCroft

Developer
Staff member
Alternatively, perhaps we can change knives from melee to ranged if the character has Tricky Knifework and not have to have a special keyword for at all.
 

fronobulax

Developer
Staff member
We have a semantic issue concerning the meaning of effective and that manifests itself as the difference between a Bug Report and a Feature Request.

The documentation says

"effective - With positive weight, if muscle higher than moxie, only melee weapons are considered, if moxie higher or equal to muscle, ranged weapons (and knives with Tricky Knifework known) are considered."

and my reading is that the code matches the documentation.

So there is no Bug.

Furthermore I would paraphrase what effective is doing as picking the best stat and then restricting the weapon selection to weapons based on that stat. If I choose to restrict weapon choices then I have to accept the possibility that there is no good choice. Special cases of knives, with skill, and weapons that use the "best" stat noted.

I have run several instances where effective picks nothing, I run without it and then find the equipped weapon is not really any good. When I run with the weapon it does very little damage and KoL tells me I am not muscular or moxious enough to really use it so running the Maximizer with whatever string I was using really wasn't helping. So I could argue that when the keyword didn't find anything that should be a sign that there is no useful weapon given the rest of the constraints.

I am interested in a hypothetical Feature Request for a new keyword. What should it do and what can it do that cannot be achieved now?

For example, "eForce" would run the maximization with the effective keyword. If a weapon is equipped then the result stands. If no weapon is selected then the maximization is run again without the keyword and that result stands. But the user would still have to deal with the possibility that no weapon was selected so what is gained? And how do I defend against not being able to "hit" anything because that depends upon where I intend to adventure and not just what I am wearing?

If you can reduce your "failure" case to something simple I will gladly try and figure out why the weapon you think should be equipped is not equipped. The Maximizer code is enough of a labyrinth that there could be a real minotaur lurking that needs to be slain.

I need a maximizer string where the effective keyword equips nothing, the string without effective equips something that is not the best choice, stat values, weapons in inventory and the presence or absence of the knife skill and Master of the Surprising Fist. I'd also be interested in the same data for a case where nothing is equipped and the effective keyword is not used. I will set up a disposable test and walk through it with the debugger and try and glean insight. For me that is much easier and less cluttered than dealing with a real character with skills and equipment that are not relevant but still have to be checked.
 
Top