Fixed bug on MarketRuleManager

- MarketRuleManager was incorrectly using the OldState when applying
rule definitions
Rule solver engine
Completed rule solver engine