OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-rocca commits / dce55be

Rename actions
dce55be3b0d3a28758ebcc2b78366af693aa1f8b
by Hedra <tanksh24@gmail.com> · 2022-01-28T15:11:16.000Z

Changed files (2) +11 -10

examples/flatworld.py +5 -4
……@@ -54,9 +54,9 @@ class FlatworldAgent(OpencogAgent):
5454 # Create Action Space. The set of allowed actions an agent can take.
5555 # TODO take care of action parameters.
5656 action_space = {
57 ExecutionLink(SchemaNode("go_to_the_key")),
58 ExecutionLink(SchemaNode("go_to_the_house")),
59 ExecutionLink(SchemaNode("go_to_the_diamonds")),
57 ExecutionLink(SchemaNode("go_to_key")),
58 ExecutionLink(SchemaNode("go_to_house")),
59 ExecutionLink(SchemaNode("go_to_diamonds")),
6060 }
6161 # Create Goal
6262 pgoal = EvaluationLink(PredicateNode("Reward"), NumberNode("1"))
……@@ -69,13 +69,14 @@ class FlatworldAgent(OpencogAgent):
6969 self.polyaction_mining = False
7070 self.monoaction_general_succeedent_mining = True
7171 self.temporal_deduction = True
72 self.cogscm_minimum_strength = 0.99
72 self.cogscm_minimum_strength = 0.9
7373 self.cogscm_maximum_shannon_entropy = 1
7474 self.cogscm_maximum_differential_entropy = 0
7575 self.cogscm_maximum_variables = 0
7676 self.miner_maximum_iterations = 100000
7777 self.miner_maximum_variables = 9
7878 self.miner_minimum_support = 3
79 self.conditional_conjunction_introduction = False
7980
8081 # Todo: restart the environment to get an initial reward
8182 self.initial_reward = EvaluationLink(PredicateNode("Reward"), NumberNode("0"))
rocca/envs/malmo_demo/flatworld_env.py +6 -6
……@@ -232,7 +232,7 @@ def inside_house(x, z):
232232
233233# Move the agent towards the key
234234# reward=0
235def go_to_the_key(agent):
235def go_to_key(agent):
236236 global holds_key
237237 reward = 0
238238 observation = {}
……@@ -260,7 +260,7 @@ def go_to_the_key(agent):
260260
261261# Move the agent towards the house and enter the house.
262262# reward = 0
263def go_to_the_house(agent):
263def go_to_house(agent):
264264 global holds_key
265265 reward = 0
266266 observation = {}
……@@ -288,7 +288,7 @@ def go_to_the_house(agent):
288288
289289# Move the agent towards the diamond and collect it.
290290# reward = 1
291def go_to_the_diamonds(agent):
291def go_to_diamonds(agent):
292292 curr_x, curr_y, curr_z = get_curr_loc(agent)
293293 turn_to(agent, curr_x, curr_y, curr_z, diamond_x, diamond_y, diamond_z)
294294 time.sleep(0.2)
……@@ -403,15 +403,15 @@ if __name__ == "__main__":
403403 if world_state.number_of_rewards_since_last_state > 0:
404404 total_reward += world_state.rewards[-1].getValue()
405405 print("total reward minecraft = {}".format(total_reward))
406 ob, rw, _ = go_to_the_key(agent)
406 ob, rw, _ = go_to_key(agent)
407407 print("Observation: {}, reward: {}".format(ob, rw))
408408 total_reward += rw
409409
410 ob, rw, _ = go_to_the_house(agent)
410 ob, rw, _ = go_to_house(agent)
411411 print("Observation: {}, reward: {}".format(ob, rw))
412412 total_reward += rw
413413
414 ob, rw, _ = go_to_the_diamonds(agent)
414 ob, rw, _ = go_to_diamonds(agent)
415415 print("Observation: {}, reward: {}".format(ob, rw))
416416 total_reward += rw
417417