-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sigmoid support Ph1 #483
Sigmoid support Ph1 #483
Conversation
Signed-off-by: tagomaru <tagomaru@users.noreply.github.com>
Signed-off-by: tagomaru <tagomaru@users.noreply.github.com>
Signed-off-by: tagomaru <tagomaru@users.noreply.github.com>
src/engine/Engine.cpp
Outdated
@@ -1204,6 +1209,10 @@ bool Engine::processInputQuery( InputQuery &inputQuery, bool preprocess ) | |||
} | |||
}); | |||
|
|||
// TODO: Remove this block after getting ready to support sigmoid with MILP. | |||
if ( _exitCode != Engine::UNSAT && inputQuery.getTranscendentalConstraints().size() > 0 ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we reach here we know that _exitCode != Engine::UNSAT, so we can remove this first condition
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed the first check and moved this condition check to solve method.
src/engine/MILPEncoder.cpp
Outdated
@@ -58,6 +58,22 @@ void MILPEncoder::encodeInputQuery( GurobiWrapper &gurobi, | |||
"Only ReLU and Max are supported\n" ); | |||
} | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems this file doesn't need to change in this PR. Maybe remove the comments?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed.
src/engine/MILPEncoder.cpp
Outdated
@@ -187,3 +203,8 @@ void MILPEncoder::encodeMaxConstraint( GurobiWrapper &gurobi, MaxConstraint *max | |||
} | |||
_binVarIndex++; | |||
} | |||
|
|||
// TODO: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed.
#endif // __TranscendentalConstraint_h__ | ||
|
||
// | ||
// Local Variables: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are no longer needed since we switched to cmake
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed.
src/engine/Engine.cpp
Outdated
@@ -1182,6 +1182,11 @@ bool Engine::processInputQuery( InputQuery &inputQuery, bool preprocess ) | |||
|
|||
struct timespec end = TimeUtils::sampleMicro(); | |||
_statistics.setPreprocessingTime( TimeUtils::timePassed( start, end ) ); | |||
|
|||
// check bound violations of all variables | |||
if ( Options::get()->getBool( Options::CHECK_BOUNDS_BEFORE_SOLVE ) ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is not necessary to conduct this check, because if an invalid bound is derived by DeepPoly, an InfeasibleQueryException will be throw.
See the method Engine::performSymbolicBoundTightening() (in particular Tableau::tightenLowerBound())
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed.
src/nlr/NetworkLevelReasoner.cpp
Outdated
@@ -289,6 +290,26 @@ void NetworkLevelReasoner::dumpTopology() const | |||
layer.second->dump(); | |||
} | |||
|
|||
void NetworkLevelReasoner::checkBoundsViolations() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned in previous comment, this method would not be necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed.
Signed-off-by: tagomaru <tagomaru@users.noreply.github.com>
Signed-off-by: tagomaru <tagomaru@users.noreply.github.com>
Signed-off-by: tagomaru <tagomaru@users.noreply.github.com>
Signed-off-by: tagomaru <tagomaru@users.noreply.github.com>
* initial commit for ph1 Signed-off-by: tagomaru <tagomaru@users.noreply.github.com> * Sigmoid support Ph1 Signed-off-by: tagomaru <tagomaru@users.noreply.github.com> * remove some comments Signed-off-by: tagomaru <tagomaru@users.noreply.github.com> * remove checkBounds and etc Signed-off-by: tagomaru <tagomaru@users.noreply.github.com> * fix memory leak Signed-off-by: tagomaru <tagomaru@users.noreply.github.com> * add some tests Signed-off-by: tagomaru <tagomaru@users.noreply.github.com> * relect andrew's comments Signed-off-by: tagomaru <tagomaru@users.noreply.github.com>
This PR is going to support sigmoid with DeepPoly.
Please note this can support only some UNSAT cases in not a complete but sound way.
Toy model for test
onnx: resources/onnx/fc_2-2sigmoids-3.onnx
keras: resources/keras/fc_2-2sigmoids-3.h5
UNSAT case
Python code
Result
This caused a violation at Neuron_0 of Layer_3 since LB > UB there.
UNKNOWN case
Python code
Result
This caused MarabouError since Marabou couldn't determine whether this was UNSAT. (Actually this case should be SAT, but It doesn't support SAT case yet.)