0

For my project I'm working on inference, where we get implications such as A ^ B -> P.

I store my consequences and their respective antecedents in a dictionary where the consequent (P) is the key and the antecedents (A ^ B) are the value. However I run into an error when I have multiple implications with the same consequence, as I already used that P as a key. For example:

A ^ B -> P.

C ^ D -> P.

Throws an error. I can't find out a way to store 2 antecedents for the same consequent. Any tips are appreciated!

ΩmegaMan
  • 22,885
  • 8
  • 76
  • 94
Douwe
  • 29
  • 5

1 Answers1

0

Instead of using P as the only key, you need to make a composite key. I would take the hash of A + hash B + hash P which from my vantage point of your base description should create a unique composite key.

Or if the properties/result is held within a class instance, just use that instance as a key.

ΩmegaMan
  • 22,885
  • 8
  • 76
  • 94