Changes between Version 7 and Version 8 of WikiStart
- Timestamp:
- Mar 4, 2022, 9:33:05 AM (3 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
WikiStart
v7 v8 7 7 8 8 You can copy the code using 9 {{{git clone https://git lab.ewi.tudelft.nl/pkmurukannaiah/bw4t-matrx-collaborativeai.git}}}9 {{{git clone https://github.com/rsverhagen94/TU-Delft-Collaborative-AI-Trust.git}}} 10 10 11 11 … … 22 22 23 23 == Setup 24 You can change the runsession.py or runtournament.py script that contains the setup settings for the run.25 26 === runsessionsettings27 28 * Edit {{{ runsession.py}}} program with your favourite text editor24 You 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 29 29 * If you added a new TeamXXAgent, import it 30 30 * locate the section containing the agents list, like this 31 31 {{{ 32 32 agents = [ 33 {'name':'agent1', 'botclass': RandomAgent, 'settings':{'slowdown':3, 'colorblind':True}},34 {'name':'agent2', 'botclass': RandomAgent, 'settings':{'slowdown':2, 'shapeblind':True}},35 {'name':'human 1', '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':{}} 36 36 ] 37 37 … … 40 40 * save the file. Make sure it remains plain ASCI text and don't change the end-of-line markers. 41 41 42 === runtournament settings43 * 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 48 42 == 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 /tournamentto halt with a write error.43 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 to halt with a write error. 50 44 51 45 === Run Session 52 * run {{{python runsession.py}}}46 * run {{{python main.py}}} 53 47 * In a web browser (eg safari or firefox) go to http://localhost:3000 54 48 * Go to god mode and start the simulation by pressing the white triangle at the top 55 49 * The log file is written to world1 directory. 56 57 === Run Tournament58 * run {{{python runtournament.py}}}59 * The log file is written to worldXX directory60 * You can not use the browser to see the progress with tournaments61 50 62 51 = Human agent … … 74 63 = Implementing your agent 75 64 To 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}}}. 65 To do this, you must extend {{{filter_bw4t_observations}}} and {{{decide_on_bw4t_action}}} of {{{bw4t/BW4TBaseLineAgent}}}. 66 So to implement your agent, you only need to extend the {{{bw4t/BW4TBrain}}} and {{{bw4t/BW4TBaseLineAgent}}}. 77 67 78 68 If you implement __init__, you must call super().init(settings) with the original settings as first call in your init function. … … 80 70 If you implement initialize, you must call super().initialize() with the original settings as first call in your initialize function. 81 71 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 72 You cannot override get_log_data because we use it already for logging the outcomes of the game. 73 74 75 With that done, you can import and use your agent in main.py, check [[wiki:#Setup]]. 76 77 The following sections give some details about the two functions to implement. 88 78 89 79 == filter_bw4t_observations … … 115 105 * filter_bw4t_observations replaces filter_observations. Agents must not override filter_observations 116 106 * 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.**118 107 119 108 The following values are enforced for the parameters for all actions 120 109 ||action parameter||value|| 121 110 ||grab_range||1|| 122 ||max_objects||3||123 111 ||action_duration||set by the agent slowdown setting|| 124 112 … … 331 319 It 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 332 320 333 Check the PatrollingAgent example to see how to use it.334 321 FAIK 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 335 322 … … 358 345 The blocks have a number of options for their shape 359 346 ||shape number||shape|| 360 ||img field||as in the image data?||361 347 ||0||rectangle|| 362 348 ||1||triangle||