# Talk:Minimax

WikiProject Mathematics (Rated Start-class, Mid-priority)
This article is within the scope of WikiProject Mathematics, a collaborative effort to improve the coverage of Mathematics on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
Mathematics rating:
 Start Class
 Mid Priority
Field: Applied mathematics
One of the 500 most frequently viewed mathematics articles.

## error in pseudocode

I strongly believe that the negamax pseudocode has an error. When exiting at a terminal node, this possibly happens at a depth <> 0. Then, the returning heuristic value should have a minus, if depth is an odd number. The correct algorithm at that point, in my opinion, is that: if node is a terminal node or depth <= 0:

       return the heuristic value of node


if depth = 0:

       return the heuristic value of node


if node is a terminal node

      if (depth is a even number):
return the heuristic value of node
else
return (-1) * the heuristic value of node  — Preceding unsigned comment added by 155.207.112.128 (talk) 09:42, 23 August 2011 (UTC)


## integral junk

do we really need it?

## Error in the pseudocode?

The line

alpha = node.player==1 and math.max(alpha,score) or math.min(alpha,score)

should be

alpha = (node.player==1) ? math.max(alpha,score) : math.min(alpha,score)

shouldn't it? Thanks! — Preceding unsigned comment added by 87.64.143.40 (talk) 23:21, 2 August 2011 (UTC)

## discussion

This is a minor point, but the phrase "since it is not computationally possible to look ahead as far as the completion of the game" should really read "it is not feasible" or "the time it would require to look ahead as far as the completion of the game but would be far longer than the lifetime of the universe" or "since it is intractable to look ahead as far as the completion of the game"

It is very much possible to the only limiting factors are time and memory

I'm not sure if you can make a generic statement that alpha-beta cuts the ply by half. It's just an empirical observation. I remember reading two-thirds somewhere.

Polished up the English a bit. Took out the hypothetical statement about the absence of an algorithm that would be able to analyse chess. But I'm afraid that this needs more polishing, especially of some statements that seem wrong to me:

A minmax algorithm would not decide infinity to a node if the game is not decided, right? A ply is a move of one player, so we should say the lookahead or number of plies.

I did not change this because my AI knowledge might be outdated, any expert advice available?

Robert Dober 2003-07-05 MEDST

I cut this bit out and will leave in here:

Article originally from FOLDOC; copied with permission. Feel free to update as needed. --/Mat 05:00, 6 Apr 2004 (UTC)

I have a question: What happens if you call it with depth 1? It looks like you would not get the right result. ie: From the example picture, say it is called on the leftmost node at depth 3, and told to run to depth 1. Also assume that this node is a maximizing instead of minimizing node. (If that is hard to imagine, then imagine a new tree with a maximizing root node and 2 minimizing leaf nodes with values 10 and infinity). This should explore both children of the node, returning their heuristic evaluation. The call tree looks like this: minimax(<furthest left node at depth 3>, 1)

process child 1:
max(-inf, -(minimax(<child-with-value-10>, 0))
minimax(<child-with-value-10>, 0) returns 10
max(-inf, -10) returns -10
process child 2:
max(-10, -(minimax(<child-with-value-inf>, 0))
minimax(<child-with-value-inf>, 0) returns inf
max(-10, -inf) returns -10


minimax call returns -10

Wouldn't we have wanted to pick the infinity value? —Preceding unsigned comment added by 63.107.91.99 (talk) 20:53, 2 September 2008 (UTC)

Resolved

As an amateur popping in, I can't even begin to understand the math here. Is this a concept that would only be referred to by specialists, or is it possible to add a more extensive plain English section to this article? (A good place to start might be, what do these equations do? How would they be used?) --Dvyost 04:44, 28 October 2005 (UTC)

I agree. Complex equations are fine, but we also need a plain English explanation right at the beginning. Wikipedia:Explain jargon. So I'm slapping that "too technical" tag (Template:Technical) on this article. --DavidCary 07:15, 20 November 2005 (UTC)

## Minimax approximations of continuous functions

I think there's more than one use of the term 'minimax' in mathematics, and consequently there should possibly be a disambig page. I've never heard of the game theory usage of the term, but there's another important usage in relation to the approximation of continuous functions with polynomials. I'm not completely familiar with this so I won't explain it myself, but 'Chebyshev Polynomials' by J.C. Mason and D.C. Handscomb has a fairly good explanation, in particular the use of Chebyshev polynomials (first kind and others) and approximating functions with Chebyshev series on the minimax norm.

Bird of paradox 05:50, 29 October 2005 (UTC)

I agree. This page should be titled Minimax (decision theory). In other math related applications minimax usually refers to an optimization approach minimizing the max error (both continuous and discrete applications actually), as opposed to the squared or absolute error for example. The total error is written something like sum(error^infinity), if I recall. keith 21:48, 24 February 2006 (UTC)

## cases where minimax does *not* give the optimal strategy

• games where at least one of the players doesn't seem to play rationally (such as when a non-zero-sum game is converted to a zero-sum game by adding "nature": we can often predict exactly what nature would do. Nature hardly ever acts like a "rational" Homo economicus.)
• infinite games

Are there any other cases where minimax is non-optimal? --DavidCary 07:15, 20 November 2005 (UTC)

## Rawls?

Something should be said of John Rawls on the page. Maximin, at least, is tossed around in philosophical parley to refer to his theory of ethics/justice. --JMD (talkcontribs) 05:48, 27 July 2006 (UTC)

I agree. I linked to this article from the mention in Theory of Justice. OckRaz (talk) 12:21, 14 December 2007 (UTC)
I have found (in my personal experience) that for at least the last half decade some philosophers have been using 'maximin' as shorthand for Rawls' Difference Principle. The first time that I came accross this, I found it confusing. I hope that the article as it now stands will help others who are in a similar situation. My only concern is that they'd have to look for minimax rather than maximin. If I can figure out how to redirect from the latter to the former, then I will do that too. OckRaz (talk) 13:10, 14 December 2007 (UTC)

## Who invented?

If this is a theory someone had to invent it. Anyone know who? -Ravedave (help name my baby) 17:45, 25 August 2006 (UTC)

## Origin of "minimax"?

Two possible origins of the term "minimax" are given in the text (as of 2006/10/1). Which one is the right one?

"Minimax (sometimes minmax) is a method in decision theory for minimizing the maximum possible loss"

"(A is called the maximizing player and B is called the minimizing player), hence it is called the minimax algorithm."

Eric Le Bigot

Seems to me like they are both the explanation. --Zvika 09:14, 14 October 2006 (UTC)

## Folk usage in gaming?

The article as it stands accurately reflects my understanding of what "minimax" means. However, there appears to be a folk misuse of the term amongst RPG and MMO players in which it refers simply to minimizing less important character stats (e.g., Charisma) in favor of maximizing more directly-applicable combat stats (Strength, Dexterity) when the option to manually adjust those stats exists. Should there maybe be an acknowledgement of this misuse in the article? It seems pretty common. El Mariachi 09:36, 16 November 2006 (UTC)

I think this use you present is fairly minor compared with the mathematical usage of the term and would hinder the article flow if it appears as a different section. I would be willing to consider a {{for}} template pointing to a separate article, if you think there's enough content in the alternate use to warrant an article. --Zvika 20:00, 20 November 2006 (UTC)
Definitely not worth a separate article. How about a one-sentence parenthetical acknowledgement at the end? I'm just concerned that people who are only familiar with the gaming usage will read this entry and think the term has any proper relation. El Mariachi 00:04, 23 November 2006 (UTC)
Again, I have never encountered this use, but if you are sure it really is a common term, then all right, be bold and put it in. --Zvika 14:21, 23 November 2006 (UTC)
This is generally referred to as min/maxing in gaming circles. I have never heard it called minimax or anything like that. 124.168.107.81 (talk) 05:11, 12 June 2008 (UTC)
It seems likely enough that someone might wind up here by accident what with "game" and "minimax". (I have heard "minimax" in RPG context, though much less than min-max, they really blur into each other.) I think the {{for}} bit at the top of the article is perfect. Cretog8 (talk) 05:30, 12 June 2008 (UTC)

## Bottleneck programming

I have redirected Bottleneck programming to this article. However, I found no much context relevant to bottleneck programming.

What I know is that Minimax Programming is also called bottleneck programming. Any hints?

A reference on minimax programming is: @ARTICLE{ahuja1985mlp, author = {AHUJA, RK}, title = {{Minimax linear programming problem}}, journal = {Operations research letters}, year = {1985}, volume = {4}, pages = {131--134}, number = {3}, publisher = {Elsevier} }

Sdudah 04:45, 15 January 2007 (UTC)

## Pseudocode?

The pseudo-code uses depth = 0 for the leaves, but that is inconsistent with the image, and also misleading, since the leaves is deeper down in the tree.

Paxinum 16:16, 5 March 2007 (UTC)

On one hand, maybe it could be changed to depth == DEPTH_MAX or something like that, to make it consistent with the picture. On the other hand, using depth == 0 facilitates the implementation of the algorithm, because you don't have to define DEPTH_MAX (as a global variable or passed as a parameter).
I would say that it is better to keep it the way it is, because the main purpose of the pseudocode is to help the implementation of the algorithm. - Nmnogueira 18:19, 5 March 2007 (UTC)

## LaTeX

Instead of pictures of the equations, can somebody who knows LaTeX please write those formulas to make them more legible (and better looking).--Keynes.john.maynard 20:56, 20 April 2007 (UTC)

The formulas are written in Latex and rendered as images when you view the page. --Zvika 08:04, 21 April 2007 (UTC)

We are redirected here from Minimax theorem, but this theorem seems to have no bearing on the article. Moreover, the sequence of topics is neither logical nor connected. I'd rate this article about 0 out of 10 for coherence and understandability. Brews ohare (talk)

## pseudocode suggestion

for faster parse ::

 max(a,b) == min(-a,-b)


based on code from negamax

 function minimax(node, depth)
if node is a terminal node or depth = CutoffDepth
return the heuristic value of node
let α := -∞                                   (* set to min, so that max is found *)
foreach child of node                         (* evaluate *)
α := max(α, -minimax(child, depth+1))
return α


it isn't going to be oldschool if else minimax then, is it. but isn't it better ? given min(a,b)=max(-a,-b) fact

ca1 16:19, 3 April 2008 (UTC)

It probably won't result in faster code, considering the cost of having two times as many function calls. But it is a nice idea and simplifies the pseudocode. However, I think what you mean is max(a,b) = -min(-a,-b). I changed the text accordingly. --Zvika (talk) 05:28, 4 April 2008 (UTC)
This is not minimax, this is negamax, and while the algorithims return the same result, and performs equivalent computation, this is not the actual minimax algorithm. Additionally, it must be noted that for Negamax, the heuristic depends on the current player to move (it must be negated when current player is Min), while in Minimax it does not. Also, Negamax must be severely altered when turns are not guaranteed to alternate. As such, I believe this pseudocode should be labeled as negamax, or reverted to actual minimax code. 131.151.90.233 (talk) 19:18, 20 March 2009 (UTC)
I also agree and have made the change back to minimax code. GamePlayerAI (talk) 15:19, 3 October 2013 (UTC)

## maximin vs minimax

I think there's already too much going on in this article (minimax equilibrium concept; for statistics; for social welfare...). In any case, I think I want to un-redirect maximin back to its own article. In a few cases (such as zero-sum games) maximizing the minimum of one thing (maximin) is equivalent to minimizing the maximum of another thing (minimax). But it's certainly not always the case.

There is enough room in this article for both, with reorganization, but would it make more sense to have them both in the same article, or separate? Cretog8 (talk) 03:44, 4 June 2008 (UTC)

why isn't it always the case? minimax of a loss function f is always the same as maximin of the utility function -f. Zvika (talk) 04:56, 4 June 2008 (UTC)
I'm thinking in game theory terms. In a zero-sum game, minimax is usually described as minimizing the maximum payoff to the other guy. It could instead be minimizing your own maximum loss, or maximizing your own minimum gain. But I usually see the first description. In a non-zero-sum game, maximin (maximizing your own minimum gain) still has some appeal, and that's the same as minimizing your own maximum loss, but it's not the same as minimizing the other guy's maximum gain. whew!
So, technically, you're right that you can redefine the problem so any maximin is a minimax instead, but I think the exposition would be unpleasant. Probably that's also true for Rawls' stuff. Cretog8 (talk) 05:09, 4 June 2008 (UTC)

## Better Pseudo-code that returns the best move for the AI

Yes the pseduo-code may work but it isn't useable. It returns alpha, not the move that the artificial intelligence should make. Below is better pseduo-code that returns the move that the AI should make. It is taken from page 208 from the book "Algorithms in a Nutshell" http://oreilly.com/catalog/9780596516246

Mtgrares (talk) 20:37, 19 November 2009 (UTC)

## wrong example? section 1.2

In section 1.2 it's written: "if the choices are A1 and B1 then B pays 5 to A", but when I look at the payoff matrix, the cell A1,B1 has the value +3, so B should pay 3 to A, isn't it? —Preceding unsigned comment added by 201.80.137.106 (talk) 15:14, 22 March 2010 (UTC)

## Flawed Example

The example (as of writing this) looks like this:

### Example

B chooses B1 B chooses B2 B chooses B3
A chooses A1     +3     −2     +2
A chooses A2     −1      0     +4
A chooses A3     −4     −3     +1

The following example of a zero-sum game, where A and B make simultaneous moves, illustrates minimax solutions. Suppose each player has three choices and consider the payoff matrix for A displayed at right. Assume the payoff matrix for B is the same matrix with the signs reversed (i.e. if the choices are A1 and B1 then B pays 3 to A). Then, the minimax choice for A is A2 since the worst possible result is then having to pay 1, while the simple minimax choice for B is B2 since the worst possible result is then no payment. However, this solution is not stable, since if B believes A will choose A2 then B will choose B1 to gain 1; then if A believes B will choose B1 then A will choose A1 to gain 3; and then B will choose B2; and eventually both players will realize the difficulty of making a choice. So a more stable strategy is needed.

Some choices are dominated by others and can be eliminated: A will not choose A3 since either A1 or A2 will produce a better result, no matter what B chooses; B will not choose B2 since B3 will produce a better result, no matter what A chooses.

A can avoid having to make an expected payment of more than 1/3 by choosing A1 with probability 1/6 and A2 with probability 5/6, no matter what B chooses. B can ensure an expected gain of at least 1/3 by using a randomized strategy of choosing B1 with probability 1/3 and B2 with probability 2/3, no matter what A chooses. These mixed minimax strategies are now stable and cannot be improved.

Shouldn't the part where it says:

Some choices are dominated by others and can be eliminated: A will not choose A3 since either A1 or A2 will produce a better result, no matter what B chooses; B will not choose B2 since B3 will produce a better result, no matter what A chooses.

Shouldn't B never choose B3, because it will always produce the BEST result for A? If B wants to win, he should always choose B1 or B2, as explained in the next paragraph.

CaseyE3100 (talk) 18:07, 24 December 2010 (UTC)

## Another Wiki page that is effectively worthless

The block that is called "Lua Example" has no description. Is it how to build the tree or traverse the tree. No code comments and a reader is just supposed to work it out for themselves. Thus, why bother inserting the block at all.

And as to the other text. It is written by someone who understands the method/algorithm but has no ability in passing on this knowledge to other readers.

Another effectively worthless piece of technical description. — Preceding unsigned comment added by 81.187.174.42 (talk) 16:02, 9 August 2011 (UTC)