Skip to content

Commit

Permalink
Write proofs as JSON files (#696)
Browse files Browse the repository at this point in the history
  • Loading branch information
OmriIsacHUJI authored Dec 20, 2023
1 parent c040dbe commit c2bf020
Show file tree
Hide file tree
Showing 7 changed files with 520 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/configuration/GlobalConfiguration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ const unsigned GlobalConfiguration::DNC_DEPTH_THRESHOLD = 5;

const double GlobalConfiguration::MINIMAL_COEFFICIENT_FOR_TIGHTENING = 0.01;
const double GlobalConfiguration::LEMMA_CERTIFICATION_TOLERANCE = 0.000001;
const bool GlobalConfiguration::WRITE_JSON_PROOF = false;

#ifdef ENABLE_GUROBI
const unsigned GlobalConfiguration::GUROBI_NUMBER_OF_THREADS = 1;
Expand Down
4 changes: 4 additions & 0 deletions src/configuration/GlobalConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@ class GlobalConfiguration
*/
static const double LEMMA_CERTIFICATION_TOLERANCE;

/* Denote whether proofs should be written as a JSON file
*/
static const bool WRITE_JSON_PROOF;

#ifdef ENABLE_GUROBI
/*
The number of threads Gurobi spawns
Expand Down
9 changes: 8 additions & 1 deletion src/engine/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3555,7 +3555,14 @@ bool Engine::certifyUNSATCertificate()
groundLowerBounds[i] = _groundBoundManager.getLowerBound( i );
}

Checker unsatCertificateChecker( _UNSATCertificate, _tableau->getM(), _tableau->getSparseA(),
if ( GlobalConfiguration::WRITE_JSON_PROOF )
{
File file( JsonWriter::PROOF_FILENAME );
JsonWriter::writeProofToJson( _UNSATCertificate, _tableau->getM(), _tableau->getSparseA(),
groundUpperBounds, groundLowerBounds, _plConstraints, file );
}

Checker unsatCertificateChecker( _UNSATCertificate, _tableau->getM(), _tableau->getSparseA(),
groundUpperBounds, groundLowerBounds, _plConstraints );
bool certificationSucceeded = unsatCertificateChecker.check();

Expand Down
1 change: 1 addition & 0 deletions src/engine/Engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "GurobiWrapper.h"
#include "IEngine.h"
#include "InputQuery.h"
#include "JsonWriter.h"
#include "LinearExpression.h"
#include "LPSolverType.h"
#include "Map.h"
Expand Down
8 changes: 8 additions & 0 deletions src/engine/PiecewiseLinearConstraint.h
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,14 @@ class PiecewiseLinearConstraint : public ITableau::VariableWatcher
return {};
}

/*
Get the tableau auxiliary vars
*/
virtual const List<unsigned> &getTableauAuxVars() const
{
return _tableauAuxVars;
}

protected:
unsigned _numCases; // Number of possible cases/phases for this constraint
// (e.g. 2 for ReLU, ABS, SIGN; >=2 for Max and Disjunction )
Expand Down
Loading

0 comments on commit c2bf020

Please sign in to comment.