-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c9829db
commit 0ff58b8
Showing
4 changed files
with
67 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
test/howtos/gt/howto_gt_native_002_prisonners_dilemma_3p.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
## ------------------------------------------------------------------------------------------------- | ||
## -- Project : MLPro - A Synoptic Framework for Standardized Machine Learning Tasks | ||
## -- Package : mlpro.gt.examples | ||
## -- Module : howto_gt_native_002_prisonners_dilemma_3p.py | ||
## ------------------------------------------------------------------------------------------------- | ||
## -- History : | ||
## -- yyyy-mm-dd Ver. Auth. Description | ||
## -- 2023-12-07 0.0.0 SY Creation | ||
## -- 2023-12-07 1.0.0 SY Release of first version | ||
## ------------------------------------------------------------------------------------------------- | ||
|
||
""" | ||
Ver. 1.0.0 (2023-12-07) | ||
This module shows how to run a game, namely 3P Prisoners' Dilemma with two solvers, such as random | ||
solver and min greedy policy. | ||
You will learn: | ||
1) How to set up a game, including solver, competition, coalition, payoff, and more | ||
2) How to run the game | ||
3) How to analyse the game | ||
""" | ||
|
||
from mlpro.gt.native.basics import * | ||
from mlpro.gt.pool.native.games.prisonersdilemma_3p import * | ||
from pathlib import Path | ||
|
||
|
||
|
||
if __name__ == "__main__": | ||
cycle_limit = 10 | ||
logging = Log.C_LOG_ALL | ||
visualize = False | ||
path = str(Path.home()) | ||
|
||
else: | ||
cycle_limit = 1 | ||
logging = Log.C_LOG_NOTHING | ||
visualize = False | ||
path = None | ||
|
||
PD2P_Game = PrisonersDilemma3PGame() | ||
|
||
training = GTTraining( | ||
p_game_cls=PrisonersDilemma3PGame, | ||
p_cycle_limit=cycle_limit, | ||
p_path=path, | ||
p_visualize=visualize, | ||
p_logging=logging | ||
) | ||
|
||
training.run() |