Argmax

There’s a really great function that sneaks in when you start learning about AI. It’s called “argmax” and they throw it in there without even really explaining it as if it were entirely self-explanatory. It means “the value of the variable that makes the expression maximum.” So, for example: (and sorry about lack of typesetting)

argmaxx -(x-3)2 = 3

because the way to maximize -(x-3)2 is by putting in 3 for x. If you take the “max” instead, it’d be 0:

max -(x-3)2 = 0

because any negative squared thing is never going to get bigger than 0.

But the great thing about argmax is that you can use it in contexts that are not quite so mathy. If p is a product:

argmaxp price(p)

means “the price of the most expensive product.” But even better, you can talk about it even when you have no freakin' clue how to evaluate it. Let c be a career among all the possible careers you could take:

argmaxc happiness(your life, your family, your friends, your belongings, c)

and that represents the career that will make you the happiest, given everything else. Okay, so what’s this all leading up to? If you have a group of people and they want to do a thing, but they want to do different things, you should do the thing that makes the most people the happiest. If every person i assigned an enjoyment value eij for each thing j that he/she wanted to do, then just add up the enjoyment values and take the argmax.

argmaxj sumi eij

This is exactly Beej’s “voting game.” If there are two choices of things to do, A and B, and there are three people, p1, p2, and p3, and the votes go like this:
      A    B
p1  3    4
p2  5    1
p3  2    4
you add this all up, and thing A gets 10 points and thing B gets 9 points, so you should do thing A. Even though p1 and p3 would rather do thing B, p2 REALLY wants thing A, so thing A is the thing to do.

This is a great algorithm! It leads to maximal total enjoyment, right? So that’s cool. p1 and p3 can’t complain, because if they had really wanted to do thing 2, they could have given it a higher score. If they really didn’t want to do thing 1, they could have given it fewer points.

But there seems to be one small flaw: p1 and p3 might be a little irritated at this; after all, they’re the majority! They might perceive p2 as “pushy.” And they’ll feel like p2 “owes” them something; they’re caving to him this time. Maybe next time p2 should let p1 and p3 do what they want, even if p2 wins the voting game again.

HOW TO SOLVE THIS?
One solution: everyone can only use a total of 10 points per game. When someone wins, everyone else gets “bonus” points equal to what they voted but lost. So in the example above, p1 gets 7 and p3 gets 6 (p2 gets 0). This represents what p2 “owes” them for winning. They p1 and p3 are sad now, but will be more likely to be happy in the future.

This is not great because that’s a lot of remembering. But I feel like, over time, everyone will be optimally happy.

ANOTHER OPTION:
p2 wins and everyone else chill the fuck out!

EITHER WAY:
play the voting game, deal with the results, and don’t harbor resentment about it.

THIS MEANS:
Beej, I’m officially a convert (although maybe we should allow values up to 10 to allow more variation. Or maybe it’s fine as is).


blog 2024 2023 2022 2021 2020 2019 2018 2017 2016 2015 2014 2013 2012 2011 2010