Skip to content
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

Bound Manager Class #429

Conversation

AleksandarZeljic
Copy link
Collaborator

BoundManager class is a context-dependent implementation of a centralized
variable registry and their bounds. The intent it so use a single BoundManager
object between multiple bound tightener classes, which enables
those classes to care only about bounds and forget about book-keeping.
Furthermore, the context-dependent implementation eliminates the need for
eager memory book-keeping.

BoundManager provides a method to obtain a new variable with:

  • registerNewVariable().

The bound values and tighten flags are stored using context-dependent objects,
which backtrack automatically with the central _context object.

There are two sets of methods to set bounds:

  • setLower/UpperBounds - local methods used to update bounds
  • tightenLower/Upper Bounds - shared method to update bounds,
    propagates the new bounds to the _tableau (if registered) to keep the
    assignment and basic/non-basic variables updated accordingly.

As soon as bounds become inconsistent, i.e. lowerBound > upperBound, an
InfeasableQueryException is thrown. In the long run, we want the exception
replaced by a flag, and switch to the conflict analysis mode instead.

It is assumed that variables are not introduced on the fly, and as such
interaction with context-dependent features is not implemented.

Another thing we may want to consider in the long run, is to make the
BoundManager a VariableWatcher, and move those features from Tableau.

Integration into the master can be gradual, first allowing each class storing
bounds a private copy of the object, before switching to a centralized object,
instant bound visibility and elimination of tightening propagation.

src/engine/Tableau.cpp Outdated Show resolved Hide resolved
src/engine/Tableau.cpp Outdated Show resolved Hide resolved
src/engine/BoundManager.h Outdated Show resolved Hide resolved
src/engine/BoundManager.h Outdated Show resolved Hide resolved
src/engine/BoundManager.h Outdated Show resolved Hide resolved
src/engine/BoundManager.h Outdated Show resolved Hide resolved
src/engine/BoundManager.h Show resolved Hide resolved
src/engine/BoundManager.h Outdated Show resolved Hide resolved
src/engine/BoundManager.cpp Outdated Show resolved Hide resolved
src/engine/BoundManager.cpp Show resolved Hide resolved
@AleksandarZeljic AleksandarZeljic self-assigned this Feb 11, 2021
AleksandarZeljic and others added 26 commits February 22, 2021 12:04
Co-authored-by: anwu1219 <haozewu@stanford.edu>
Co-authored-by: anwu1219 <haozewu@stanford.edu>
Co-authored-by: anwu1219 <haozewu@stanford.edu>
Add tightened flag to BoundManager

The flag is set whenever a bound is updated.
The flag is cleared when getBoundTightnings is called.
Serves as a pooling mechanism for constraint bound propagation.
Allows for elimination of ConstraintBoundTightener class.
@AleksandarZeljic AleksandarZeljic merged commit 8d77741 into NeuralNetworkVerification:master Feb 22, 2021
@AleksandarZeljic AleksandarZeljic deleted the boundManagerPR branch February 22, 2021 21:19
matanost pushed a commit that referenced this pull request Nov 2, 2021
* Add Bound Manager class first version

Co-authored-by: anwu1219 <haozewu@stanford.edu>

* Fix BoundManager ctr and dtr

* Add BoundManger tests (fix initialize method)

Co-authored-by: anwu1219 <haozewu@stanford.edu>

* Add Test BoundManager correctly advances/backtracks with Context

Co-authored-by: anwu1219 <haozewu@stanford.edu>

* Add growing functionality to BoundManager class

* Rename BoundManager getter/setter methods

* Add test for BoundManager::registerVariable()

* Add CVC4 dependencies to MarabouTestLib in CMakeLists

* Store bounds in BoundManager to Vector<CDO<double> *>

* Refactor Tableau tighten*Bound methods

* Add ptr to Tableau to BoundManager

* Protect registerTableauReference( ptrTableau )

* Separate setter and tighten methods in BoundManager

* Add tighten flag for each variable in BoundManager

Add tightened flag to BoundManager

The flag is set whenever a bound is updated.
The flag is cleared when getBoundTightnings is called.
Serves as a pooling mechanism for constraint bound propagation.
Allows for elimination of ConstraintBoundTightener class.

* Add boundsValid check in BoundManager

* Rename boundsValid to consistentBounds

* Add comments, rename getSize, match method order

* Add one central context object for all tests.

* Add BoundManager::getTightenings test

* Fix formatting, typos and comments

* Add BoundManager class description and comments

* Fix formatting in BoundManager.cpp

* Fix wording

* Order includes by own header, name complexity, then alphabetically

* Fix indentation

* Fix spacing

* Remove compilation suffix

* Make getNumberOfVariables const

* Fix indentation, empty lines

* Fix orientation of Boolean comparisons

* Fix blank spaces in Tableau

* Make get*Bound const

* Make consistentBounds() const

* Rename updateNonBasicVariable* to updateVariableToComplyWith*

* Fix indentation in updateVarableToComplyWith*BoundUpdate

* Fix renaming typo

Co-authored-by: anwu1219 <haozewu@stanford.edu>
Co-authored-by: ahmed-irfan <irfan@cs.stanford.edu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants