Expand description
Counterfactual Regret (CFR) is a library for finding an approximate nash equilibrium in two-player zero-sum games of incomplete information with perfect recall, such as poker etc., using discounted1 monte carlo2 counterfactual regret minimization3.
§Usage
To use the command line tool, see documentation on
github, or use cfr --help
.
To use this as a rust library, define the IntoGameNode trait for the representation of your extensive form game. See the trait for details and contracts of implementation. The use of IntoIterator allows this conversion to be zero-copy for expensive types, e.g. long history information sets. Once this trait is defined, create an efficient representation of the Game with from_root. Compute an approximate equilibrium with Game::solve. You can then get equilibrium utilities and regret from Strategies::get_info.
§Examples
Once the conversion trait, IntoGameNode, is defined for your game, you solve for equilibria like:
impl IntoGameNode for ExData {
// ...
}
let data: ExData = // ...
let game = Game::from_root(data).unwrap();
let (strats, reg_bounds) = game.solve(
SolveMethod::External,
100, // number of iterations
0.0, // early termination regret
1, // number of threads
None, // advanced options
).unwrap();
// get named versions, i.e. exportable version
let named = strats.as_named();
// compute regret and other values
let strat_info = strats.get_info();
let regret = strat_info.regret();
Brown, Noam, and Tuomas Sandholm. “Solving imperfect-information games via discounted regret minimization.” Proceedings of the AAAI Conference on Artificial Intelligence. Vol. 33. No. 01. (2019) ↩
Lanctot, Marc, et al. “Monte Carlo sampling for regret minimization in extensive games.” Advances in neural information processing systems 22 (2009). ↩
Zinkevich, Martin, et al. “Regret minimization in games with incomplete information.” Advances in neural information processing systems 20 (2007). ↩
Structs§
- Game
- A compact game representation
- Named
Strategy Action Iter - An iterator over named actions and assiciated probabilities
- Named
Strategy Iter - An iterator over named information sets of a strategy.
- Regret
Bound - Regret bound produced by solving a game
- Regret
Params - Advanced parameters for regret calculation
- Strategies
- A compact strategy for both players
- Strategies
Info - Information about the regret and utility of a specific strategy profile
Enums§
- Game
Error - Errors that result from game definition errors
- Game
Node - An intemediary representation of a node in a game tree
- Player
Num - An enum indicating a player
- Solve
Error - Errors that result from problems solving
- Solve
Method - The method to use for finding approximate equilibria
- Strat
Error - Errors that result from incompatible strategy representation
Traits§
- Into
Game Node - A trait that defines how to convert game-tree-like data into a Game