function RuleWatchNode::watch2OnHighest
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.
Parameters
Decisions $decisions The decisions made so far by the solver:
File
-
vendor/
composer/ composer/ src/ Composer/ DependencyResolver/ RuleWatchNode.php, line 56
Class
- RuleWatchNode
- Wrapper around a Rule which keeps track of the two literals it watches
Namespace
Composer\DependencyResolverCode
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;
}
}
}