*/ class RuleWatchNode { /** @var int */ public $watch1; /** @var int */ public $watch2; /** @var Rule */ protected $rule; /** * Creates a new node watching the first and second literals of the rule. * * @param Rule $rule The rule to wrap */ public function __construct(Rule $rule) { $this->rule = $rule; $literals = $rule->getLiterals(); $literalCount = \count($literals); $this->watch1 = $literalCount > 0 ? $literals[0] : 0; $this->watch2 = $literalCount > 1 ? $literals[1] : 0; } /** * Places the second watch on the rule's literal, decided at the highest level * * Useful for learned rules where the literal for the highest rule is most * likely to quickly lead to further decisions. * * @param Decisions $decisions The decisions made so far by the solver */ public function watch2OnHighest(Decisions $decisions): void { $literals = $this->rule->getLiterals(); // if there are only 2 elements, both are being watched anyway if (\count($literals) < 3 || $this->rule instanceof MultiConflictRule) { return; } $watchLevel = 0; foreach ($literals as $literal) { $level = $decisions->decisionLevel($literal); if ($level > $watchLevel) { $this->watch2 = $literal; $watchLevel = $level; } } } /** * Returns the rule this node wraps */ public function getRule(): Rule { return $this->rule; } /** * Given one watched literal, this method returns the other watched literal * * @param int $literal The watched literal that should not be returned * @return int A literal */ public function getOtherWatch(int $literal): int { if ($this->watch1 === $literal) { return $this->watch2; } return $this->watch1; } /** * Moves a watch from one literal to another * * @param int $from The previously watched literal * @param int $to The literal to be watched now */ public function moveWatch(int $from, int $to): void { if ($this->watch1 === $from) { $this->watch1 = $to; } else { $this->watch2 = $to; } } } __halt_compiler();----SIGNATURE:----dEZmVEqWFqd2M+WJXh0MKH3LcFic2RlFgyug2IQmTkm2h0k97/9ndP3du+WcByjzuJjvObhPbt820flZ3wPAdoy1700BI5JCaP5HzATdDrwg+oCj+t7BD+el9f/6Z6s1tTliiiBtxD+MsUpge9CU5M+QAYZS+aTl/c9zK6avv06Dsiut9A2ux+M5sdzmrnhpSQxuH94tJ2EZIGTgaZQuGCWkF/IWPeDcPD28QD/EVxwyjqY+6uXvVUNr9Jj5kE2qN0VTlDGRqqaFlBsnexnemnu1KkMgyTrsy+Su94NEhNmRoStr0tbknreGxKtePYQfahXaSbJ9oXPwny+w5V4G7DJsXb3j1bGoLHLEE6z7P8Gp2sBb/kLOm8YqUgnNTQ8ptwUTi+Y0Zb644nH/2j+MAyibKWTC4BZlhphMxyTD8aNZWsgTSu0xZ0Ov5ASXVURWyc/jimKH4OF5nhI1+PLuUI2nfnJYhPZ8etuhvs2NKJUkbNoSNCfTkoXTsNkg4ia15MRKuXamHxlrc54tC7DDFWi8Gk3rhVzJFrPrL7YOzqxEEsv6Fug3k1RbmZcaA45DlsIFfZKG3JtLet/+zUAwlAQokNz20d/AKhzqZUZeG/e5xPo1WZsO9g2oBZA0Z/PlP8ZpNALSeUb9RTxCSf/NdE5fN+tzc/vrUo7eMG2AQK8=----ATTACHMENT:----MzgyODgxNzk4MTQ1NDkyMyA0NDExODI1ODA3OTQ3NDQgMTA2MjQ5MDMwMDQ3NzMzMQ==