File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change 22
33- Update docs example in travelingsalesman.
44- Update the documentation so that the examples are runnable by copy-pasting.
5+ - Add example in the docs of game solver.
56
67### 0.2.9
78
Original file line number Diff line number Diff line change @@ -55,6 +55,43 @@ Solves a zero-sum game using the simplex method.
5555
5656# Returns
5757- An array of `GameResult` objects containing the probabilities and value of the game.
58+
59+ # Example
60+
61+ ```julia
62+ mat = [1 4 5; 5 6 2]
63+
64+ # 1 4 5
65+ # 5 6 2
66+ # The row player has 2 strategies, and the column player has 3 strategies.
67+ # If the row player selects the first strategy and the column player selects the second strategy,
68+ # the row player receives 4.
69+
70+ problem = GameProblem(mat)
71+
72+ result = solve(problem)
73+
74+ result1 = result[1] # The result for the row player
75+
76+ println(result1.probabilities)
77+ # 2-element Vector{Float64}:
78+ # 0.42857142857142855
79+ # 0.5714285714285714
80+
81+ println(result1.value)
82+ # 3.285714285714285
83+
84+ result2 = result[2] # The result for the column player
85+
86+ println(result2.probabilities)
87+ # 3-element Vector{Float64}:
88+ # 0.42857142857142855
89+ # -0.0
90+ # 0.5714285714285714
91+
92+ println(result2.value)
93+ # -3.285714285714285
94+ ```
5895"""
5996function solve (p:: GameProblem ; verbose:: Bool = false ):: Vector{GameResult}
6097 rowplayers_result = game_solver (p. decisionMatrix, verbose = verbose)
You can’t perform that action at this time.
0 commit comments