Changes between Version 7 and Version 8 of WikiStart


Ignore:
Timestamp:
Mar 4, 2022, 9:33:05 AM (3 years ago)
Author:
Ruben Verhagen
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • WikiStart

    v7 v8  
    77
    88You can copy the code using
    9 {{{git clone https://gitlab.ewi.tudelft.nl/pkmurukannaiah/bw4t-matrx-collaborativeai.git}}}
     9{{{git clone https://github.com/rsverhagen94/TU-Delft-Collaborative-AI-Trust.git}}}
    1010
    1111
     
    2222
    2323== Setup
    24 You can change the runsession.py or runtournament.py script that contains the setup settings for the run.
    25 
    26 === runsession settings
    27 
    28 * Edit {{{runsession.py}}} program with your favourite text editor
     24You can change the main.py script that contains the setup settings for the run.
     25
     26=== main.py settings
     27
     28* Edit {{{main.py}}} program with your favourite text editor
    2929* If you added a new TeamXXAgent, import it
    3030* locate the section containing the agents list, like this
    3131{{{
    3232agents = [
    33     {'name':'agent1', 'botclass':RandomAgent, 'settings':{'slowdown':3, 'colorblind':True}},
    34     {'name':'agent2', 'botclass':RandomAgent, 'settings':{'slowdown':2, 'shapeblind':True}},
    35     {'name':'human1', 'botclass':Human, 'settings':{'slowdown':1}}
     33    {'name':'agent1', 'botclass':BaseLineAgent, 'settings':{'slowdown':10}},
     34    {'name':'agent2', 'botclass':BaseLineAgent, 'settings':{}},
     35    {'name':'human', 'botclass':Human, 'settings':{}}
    3636    ]
    3737
     
    4040* save the file. Make sure it remains plain ASCI text and don't change the end-of-line markers.
    4141
    42 === runtournament settings
    43 * Edit {{{runtournament.py}}} program with your favourite text editor. Edit the agents as described with the runsession settings above.
    44 * Additionally there is a {{{teamsize}}} variable. Set it to the desired team size for the sessions.
    45 
    46 The tournament will create and run all possible teams consisting of <teamsize> agents selected from the agents list.
    47 
    4842== Run
    49 While running, do not open the csv log file that the session/tournament is writing to: doing this may block the file for writing and cause the session/tournament to halt with a write error.
     43While running, do not open the csv log file that the session/tournament is writing to: doing this may block the file for writing and cause the session to halt with a write error.
    5044
    5145=== Run Session
    52 * run {{{python runsession.py}}}
     46* run {{{python main.py}}}
    5347* In a web browser (eg safari or firefox) go to http://localhost:3000
    5448* Go to god mode and start the simulation by pressing the white triangle at the top
    5549* The log file is written to world1 directory.
    56 
    57 === Run Tournament
    58 * run {{{python runtournament.py}}}
    59 * The log file is written to worldXX directory
    60 * You can not use the browser to see the progress with tournaments
    6150
    6251= Human agent
     
    7463= Implementing your agent
    7564To implement an agent for BW4T, all you need is to create a class that extends the {{{bw4t/BW4TBrain}}}.
    76 To do this, you must implement {{{filter_bw4t_observations}}} and {{{decide_on_bw4t_action}}}.
     65To do this, you must extend {{{filter_bw4t_observations}}} and {{{decide_on_bw4t_action}}} of {{{bw4t/BW4TBaseLineAgent}}}.
     66So to implement your agent, you only need to extend the {{{bw4t/BW4TBrain}}} and {{{bw4t/BW4TBaseLineAgent}}}.
    7767
    7868If you implement __init__, you must call super().init(settings) with the original settings as first call in your init function.
     
    8070If you implement initialize, you must call super().initialize() with the original settings as first call in your initialize function.
    8171
    82 You cannot override get_log_data because we use it already for logging the outcomes of the game
    83 
    84 
    85 With that done, you can import and use your agent in runsession, check [[wiki:#Setup]].
    86 
    87 The following sections give some details about the two functions to implement
     72You cannot override get_log_data because we use it already for logging the outcomes of the game.
     73
     74
     75With that done, you can import and use your agent in main.py, check [[wiki:#Setup]].
     76
     77The following sections give some details about the two functions to implement.
    8878
    8979== filter_bw4t_observations
     
    115105* filter_bw4t_observations replaces filter_observations. Agents must not override filter_observations
    116106* agent action parameters are restricted, they can not set 'remove_range', 'grab_range', 'door_range' and 'action_duration'.
    117 * If an agent raises an exception, only a message is printed but the world continues running. This is because (1) the agent may be able to recover in the next round (2) other agents that are still running may be still able to complete the task. **You should however ensure such errors do not occur in the first place.**
    118107
    119108The following values are enforced for the parameters for all actions
    120109||action parameter||value||
    121110||grab_range||1||
    122 ||max_objects||3||
    123111||action_duration||set by the agent slowdown setting||
    124112
     
    331319It will take the current agent location as start point and navigate to the waypoint you can add later. The StateTracker contains some processed map so better
    332320
    333 Check the PatrollingAgent example to see how to use it.
    334321FAIK it can only reach reachable places, it will not consider opening doors and refuse planning if the end point can not be reached. Once a door is open, path planning will work
    335322
     
    358345The blocks have a number of options for their shape
    359346||shape number||shape||
    360 ||img field||as in the image data?||
    361347||0||rectangle||
    362348||1||triangle||