# documentation files (the "Software"), to deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, # and to permit persons to whom the Software is furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all copies or substantial portions of # the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO # THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. # =================================================================================================================== from common import ENV_AGENT_NAMES from evaluation import PigChaseEvaluator from environment import PigChaseTopDownStateBuilder from malmopy.agent import RandomAgent if __name__ == '__main__': # Warn for Agent name !!! clients = [('127.0.0.1', 10000), ('127.0.0.1', 10001)] agent = RandomAgent(ENV_AGENT_NAMES[1], 3) eval = PigChaseEvaluator(clients, agent, agent, PigChaseTopDownStateBuilder()) eval.run() eval.save('My Exp 1', 'pig_chase_results.json')
# # The above copyright notice and this permission notice shall be included in all copies or substantial portions of # the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO # THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. # =================================================================================================================== from pathlib2 import Path from common import ENV_AGENT_NAMES from danish_puppet import DanishPuppet from environment import PigChaseSymbolicStateBuilder from evaluation import PigChaseEvaluator from utility.util import ensure_folder if __name__ == '__main__': # Warn for Agent name !!! clients = [('127.0.0.1', 10000), ('127.0.0.1', 10001)] agent = DanishPuppet(ENV_AGENT_NAMES[1], helmets=[0, 1], use_markov=True) eval = PigChaseEvaluator(clients, agent, agent, PigChaseSymbolicStateBuilder()) eval.run() folder_path = Path("results", "evaluations") ensure_folder(folder_path) eval.save('My Exp 1', Path(folder_path, "pig_chase_results.json"))
# # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO # THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. # =================================================================================================================== from common import ENV_AGENT_NAMES, ENV_TARGET_NAMES from evaluation import PigChaseEvaluator from environment import PigChaseTopDownStateBuilder, PigChaseSymbolicStateBuilder from malmopy.agent import RandomAgent from agent import PigChaseChallengeAgent, FocusedAgent from json import dump if __name__ == '__main__': # Warn for Agent name !!! name = 'Agent_1' clients = [('127.0.0.1', 10000), ('127.0.0.1', 10001)] agent = FocusedAgent( ENV_AGENT_NAMES[1], ENV_TARGET_NAMES[0] ) ##Defines the type of agents that are going to be used eval = PigChaseEvaluator( clients, agent, agent, PigChaseSymbolicStateBuilder()) ##Initializes the experiment print('Simbolic state builder running') eval.run() eval.save('My Exp 1', '.')
#!/usr/bin/env python # -*- coding: utf-8 -*- from common import ENV_AGENT_NAMES, ENV_TARGET_NAMES from evaluation import PigChaseEvaluator from environment import PigChaseSymoblicStateBuilder from agent import PigChaseChallengeAgent, FocusedAgent from malmopy.visualization import ConsoleVisualizer if __name__ == '__main__': clients = [('127.0.0.1', 10000), ('127.0.0.1', 10001)] builder = PigChaseSymbolicStateBuilder() agent = FocusedAgent(ENV_AGENT_NAMES[1], ENV_TARGET_NAMES[0]) eval = PigChaseEvaluator(clients, agent, agent, builder) eval.run() eval.save('baseline_exp', 'baseline_results.json')
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO # THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. # =================================================================================================================== import sys, os sys.path.append('../') from common import ENV_AGENT_NAMES, ENV_TARGET_NAMES from evaluation import PigChaseEvaluator from environment import PigChaseSymbolicStateBuilder from malmopy.agent import RandomAgent from agent import PigChaseChallengeAgent, FocusedAgent from BayesAgent import BayesAgent import tensorflow as tf if __name__ == '__main__': # Warn for Agent name !!! config = tf.ConfigProto(allow_soft_placement=True) config.gpu_options.allow_growth = True with tf.Session(config = config) as sess: agent = BayesAgent('Agent_2', ENV_TARGET_NAMES[0], 'Agent_1', False, sess) if not agent.save: sess.run(tf.global_variables_initializer()) print "Initialize" clients = [('127.0.0.1', 10000), ('127.0.0.1', 10001)] eval = PigChaseEvaluator(clients, agent, agent, PigChaseSymbolicStateBuilder()) eval.run() eval.save('HiDDeN Vs PigChaseChallenger', 'pig_chase_results')
from common import ENV_AGENT_NAMES from evaluation import PigChaseEvaluator from malmopy.agent import TemporalMemory, LinearEpsilonGreedyExplorer from malmopy.environment.malmo import MalmoALEStateBuilder from agent import PigChaseChallengeAgent, PigChaseQLearnerAgent from malmopy.visualization import ConsoleVisualizer from malmopy.model.chainer import QNeuralNetwork, ReducedDQNChain if __name__ == '__main__': device = -1 nb_actions = 3 visualizer = ConsoleVisualizer() clients = [('127.0.0.1', 10000), ('127.0.0.1', 10001)] memory = TemporalMemory(100000, (18, 18)) chain = ReducedDQNChain((memory.history_length, 18, 18), nb_actions) target_chain = ReducedDQNChain((memory.history_length, 18, 18), nb_actions) model = QNeuralNetwork(chain, target_chain, device) explorer = LinearEpsilonGreedyExplorer(0.6, 0.1, 1000000) agent = PigChaseQLearnerAgent(ENV_AGENT_NAMES[1], nb_actions, model, memory, 0.99, 32, 50000, explorer=explorer, visualizer=visualizer) #builder = MalmoALEStateBuilder() builder = PigChaseTopDownStateBuilder(True) eval = PigChaseEvaluator(clients, agent, agent, builder) eval.run() eval.save('qlearner_exp', 'qlearner_results.json')
from common import ENV_AGENT_NAMES, ENV_TARGET_NAMES from evaluation import PigChaseEvaluator from environment import PigChaseSymbolicStateBuilder from SandhogAgent import SandhogAgent if __name__ == '__main__': clients = [('127.0.0.1', 10000), ('127.0.0.1', 10001)] agent = SandhogAgent(ENV_AGENT_NAMES[1], ENV_AGENT_NAMES[ 0], ENV_TARGET_NAMES[0]) agent2 = SandhogAgent(ENV_AGENT_NAMES[1], ENV_AGENT_NAMES[ 0], ENV_TARGET_NAMES[0]) builder = PigChaseSymbolicStateBuilder() eval = PigChaseEvaluator(clients, agent, agent2, builder) eval.run() eval.save('sandhog_exp', 'sandhog_results.json')
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, # and to permit persons to whom the Software is furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all copies or substantial portions of # the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO # THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. # =================================================================================================================== from common import ENV_AGENT_NAMES, ENV_TARGET_NAMES from evaluation import PigChaseEvaluator from environment import PigChaseSymbolicStateBuilder from myagent import MyAgent if __name__ == '__main__': # Warn for Agent name !!! clients = [('127.0.0.1', 10000), ('127.0.0.1', 10001)] agent = MyAgent(ENV_AGENT_NAMES[1], ENV_TARGET_NAMES[0], ENV_AGENT_NAMES[0]) eval = PigChaseEvaluator(clients, agent, agent, PigChaseSymbolicStateBuilder()) eval.run() eval.save('ParSys', 'pig_chase_results.json')
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of # the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO # THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. # =================================================================================================================== from common import ENV_AGENT_NAMES, ENV_TARGET_NAMES from evaluation import PigChaseEvaluator from environment import PigChaseTopDownStateBuilder, PigChaseSymbolicStateBuilder from malmopy.agent import RandomAgent from HogRiderQ import HogRiderQAgent from agent import FocusedAgent if __name__ == '__main__': # Warn for Agent name !!! clients = [('127.0.0.1', 10000), ('127.0.0.1', 10001)] agent = HogRiderQAgent(ENV_AGENT_NAMES[1]) # we need PigChaseSymbolicStateBuilder eval = PigChaseEvaluator(clients, agent, agent, PigChaseSymbolicStateBuilder()) eval.run() eval.save('HogRider', 'pig_chase_HogRider.json')