Skip to content

Commit def5714

Browse files
authored
Proof production bugfix (#887)
1 parent a1195f6 commit def5714

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

src/engine/PrecisionRestorer.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,16 +134,22 @@ void PrecisionRestorer::restorePrecision( IEngine &engine,
134134
}
135135
}
136136

137-
if ( engine.shouldProduceProofs() )
138-
engine.setBoundExplainerContent( &boundExplainerBackup );
139-
140137
for ( unsigned i = 0; i < targetN; ++i )
141138
{
139+
if ( engine.shouldProduceProofs() )
140+
{
141+
engine.updateGroundUpperBound( i, groundUpperBoundsBackup[i] );
142+
engine.updateGroundLowerBound( i, groundLowerBoundsBackup[i] );
143+
}
144+
142145
tableau.tightenUpperBoundNaively( i, upperBoundsBackup[i] );
143146
tableau.tightenLowerBoundNaively( i, lowerBoundsBackup[i] );
144147
}
145148

146-
engine.propagateBoundManagerTightenings();
149+
if ( engine.shouldProduceProofs() )
150+
engine.setBoundExplainerContent( &boundExplainerBackup );
151+
152+
tableau.updateVariablesToComplyWithBounds();
147153

148154
// Restore constraint status
149155
for ( const auto &pair : targetEngineState._plConstraintToState )

src/engine/ReluConstraint.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -271,11 +271,11 @@ void ReluConstraint::notifyUpperBound( unsigned variable, double newBound )
271271
_boundManager->tightenUpperBound( _b, bound, *_tighteningRow );
272272
else
273273
{
274-
if ( FloatUtils::isZero( bound ) )
274+
if ( !FloatUtils::isPositive( bound ) )
275275
_boundManager->addLemmaExplanationAndTightenBound(
276276
_b, 0, Tightening::UB, { variable }, Tightening::UB, getType() );
277277
// Bound cannot be negative if ReLU is inactive
278-
else if ( FloatUtils::isNegative( bound ) )
278+
if ( FloatUtils::isNegative( bound ) )
279279
throw InfeasibleQueryException();
280280
}
281281
}
@@ -326,11 +326,11 @@ void ReluConstraint::notifyUpperBound( unsigned variable, double newBound )
326326
_boundManager->tightenLowerBound( _b, -bound, *_tighteningRow );
327327
else
328328
{
329-
if ( FloatUtils::isZero( bound ) )
329+
if ( !FloatUtils::isPositive( bound ) )
330330
_boundManager->addLemmaExplanationAndTightenBound(
331331
_b, 0, Tightening::LB, { variable }, Tightening::UB, getType() );
332332
// Bound cannot be negative if ReLU is active
333-
else if ( FloatUtils::isNegative( bound ) )
333+
if ( FloatUtils::isNegative( bound ) )
334334
throw InfeasibleQueryException();
335335
}
336336
}

0 commit comments

Comments
 (0)