diff --git a/hypothesis.py b/hypothesis.py index 9cd5b6f..a0ca8fc 100644 --- a/hypothesis.py +++ b/hypothesis.py @@ -136,11 +136,6 @@ def _Variants(rule): #location symmetry (knowledge about World_Movement operatio action_values_precons = rule[0] conditions = action_values_precons[2:] action = action_values_precons[0] - for (y,x,v) in conditions: #unnecessary - if (action == left or action == right) and y != 0: - return [] - if (action == up or action == down) and x != 0: - return [] rules = [rule] if DisableOpSymmetryAssumption: return rules diff --git a/main.py b/main.py index 1032536..57abb79 100644 --- a/main.py +++ b/main.py @@ -35,7 +35,7 @@ if __name__ == "__main__": for Time in range(300): start_time = time.time() - FocusSet, RuleEvidence, loc, observed_world, rules, negrules, world, debuginput = NACE_Cycle(Time, FocusSet, RuleEvidence, loc, observed_world, rules, negrules, deepcopy(world)) + usedRules, FocusSet, RuleEvidence, loc, observed_world, rules, negrules, world, debuginput = NACE_Cycle(Time, FocusSet, RuleEvidence, loc, observed_world, rules, negrules, deepcopy(world)) end_time = time.time() print("VALUES", world[VALUES], "FOCUS SET", FocusSet) elapsed_time = end_time - start_time @@ -56,13 +56,13 @@ if d == 'r': predworld = deepcopy(world) if d == 'a': - predworld, score, age = NACE_Predict(Time, FocusSet, deepcopy(predworld), left, rules) + predworld, score, age = NACE_Predict(Time, FocusSet, deepcopy(predworld), left, usedRules) if d == 'd': - predworld, score, age = NACE_Predict(Time, FocusSet, deepcopy(predworld), right, rules) + predworld, score, age = NACE_Predict(Time, FocusSet, deepcopy(predworld), right, usedRules) if d == 'w': - predworld, score, age = NACE_Predict(Time, FocusSet, deepcopy(predworld), up, rules) + predworld, score, age = NACE_Predict(Time, FocusSet, deepcopy(predworld), up, usedRules) if d == 's': - predworld, score, age = NACE_Predict(Time, FocusSet, deepcopy(predworld), down, rules) + predworld, score, age = NACE_Predict(Time, FocusSet, deepcopy(predworld), down, usedRules) if d == 'l': for x in rules: Prettyprint_rule(RuleEvidence, Hypothesis_TruthValue, x) diff --git a/nace.py b/nace.py index 36d9943..6e34fd7 100644 --- a/nace.py +++ b/nace.py @@ -87,9 +87,10 @@ def NACE_Cycle(Time, FocusSet, RuleEvidence, loc, observed_world, rulesin, negru World_Print(planworld) print("\033[0m") FocusSet, RuleEvidence, newrules, newnegrules = _Observe(FocusSet, RuleEvidence, observed_world_old, action, observed_world, rules, negrules, predicted_world) + usedRules = deepcopy(newrules) for rule in rulesExcluded: #add again so we won't loose them newrules.add(rule) - return FocusSet, RuleEvidence, loc, observed_world, newrules, newnegrules, newworld, debuginput + return usedRules, FocusSet, RuleEvidence, loc, observed_world, newrules, newnegrules, newworld, debuginput # APPLY MOVE TO THE WORLD MODEL WHEREBY WE USE THE EXISTING RULES TO DECIDE HOW A GRID ELEMENT CHANGES def NACE_Predict(Time, FocusSet, oldworld, action, rules, customGoal = None):