Remove only branches on right levels in revert
parent
ac762ba6e9
commit
d592c0a55e
|
@ -248,7 +248,7 @@ class Solver
|
||||||
while (!empty($this->branches)) {
|
while (!empty($this->branches)) {
|
||||||
list($literals, $branchLevel) = $this->branches[count($this->branches) - 1];
|
list($literals, $branchLevel) = $this->branches[count($this->branches) - 1];
|
||||||
|
|
||||||
if ($branchLevel >= $level) {
|
if ($branchLevel < $level) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -743,22 +743,24 @@ class Solver
|
||||||
$lastLevel = null;
|
$lastLevel = null;
|
||||||
$lastBranchIndex = 0;
|
$lastBranchIndex = 0;
|
||||||
$lastBranchOffset = 0;
|
$lastBranchOffset = 0;
|
||||||
|
$l = 0;
|
||||||
|
|
||||||
for ($i = count($this->branches) - 1; $i >= 0; $i--) {
|
for ($i = count($this->branches) - 1; $i >= 0; $i--) {
|
||||||
list($literals, $level) = $this->branches[$i];
|
list($literals, $l) = $this->branches[$i];
|
||||||
|
|
||||||
foreach ($literals as $offset => $literal) {
|
foreach ($literals as $offset => $literal) {
|
||||||
if ($literal && $literal > 0 && $this->decisions->decisionLevel($literal) > $level + 1) {
|
if ($literal && $literal > 0 && $this->decisions->decisionLevel($literal) > $l + 1) {
|
||||||
$lastLiteral = $literal;
|
$lastLiteral = $literal;
|
||||||
$lastBranchIndex = $i;
|
$lastBranchIndex = $i;
|
||||||
$lastBranchOffset = $offset;
|
$lastBranchOffset = $offset;
|
||||||
$lastLevel = $level;
|
$lastLevel = $l;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($lastLiteral) {
|
if ($lastLiteral) {
|
||||||
$this->branches[$lastBranchIndex][$lastBranchOffset] = array();
|
unset($this->branches[$lastBranchIndex][0][$lastBranchOffset]);
|
||||||
|
$this->branches[$lastBranchIndex][0] = array_values($this->branches[$lastBranchIndex][0]);
|
||||||
$minimizationSteps++;
|
$minimizationSteps++;
|
||||||
|
|
||||||
$level = $lastLevel;
|
$level = $lastLevel;
|
||||||
|
|
Loading…
Reference in New Issue