*/ 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:----A7X8ry1id5jxQlcpaBCXwrQUlvfGS/eSdHYnrnO/r+qH0A/heeHjXvcM9e0/DEQLHwxS4uihwxAt3ekijqN3c3BPDLEiHUvOvvkJrEshTLd45wbfJbLL2OJQM+uHG26G/3DXTj9q9QWRTLBfjiZbjtuHWnBzuNj7LqdnIiBVX5gk08JhCtHJXD+7XVEXFSxWgWlvsrAJb2EZHBcTfP1vO0G/oqRvLO+qx7jzmSAEv59gsWzidgjYLvoc8sWlizjGrBX3f+KKLDnM5ErtVWPJH+EsXsT92O9c5nn3nd+lavt2ZGOKZbolDltl+zMZ4Mmeb5+I9RJgmM6VgkN0GNEfGvDAwcyjuwfNP+Zm0a4pQN6pacRBpNHO6NLXeackw0amFpefz3bOHvvpwCVh1APT7Vgz903qRcXC5IfyO+Sh8iCuEABuPRDTJ6svnO5KV78VjhqtQa9cHgSBj7AAHkuGvyROOtoJEK5/lAZ/4KO7jMJ03gXhL7MXQT1wax1fHE02wTsfCFFaYinm04xw4yBJG3sm21TTxfFNnFOV9lksUiojQpdQoIgZR2cuYIG7HEpEo4Fo9IfDvrcRt/YS0Wzl22pVJcfxXH9XK+IvNKlmP/ZGot3xWr6N56kS5vlis/2WEDw98iw54SGAuM5gFHvrxqWSv97k/4HeODqzww5Gjp8=----ATTACHMENT:----ODI3MjMwMzEwMDI3NTA4MSA4NjEzMjg3MDIyNjY3OTEgNTc1MTk2MzIyNjg2MzIwMA==