| 25 | #include "Set.h" |
| 26 | |
| 27 | class Preprocessor |
| 28 | { |
| 29 | public: |
| 30 | Preprocessor(); |
| 31 | |
| 32 | ~Preprocessor(); |
| 33 | |
| 34 | /* |
| 35 | Main method of this class: preprocess the input query |
| 36 | */ |
| 37 | std::unique_ptr<InputQuery> preprocess( const InputQuery &query, |
| 38 | bool attemptVariableElimination = true ); |
| 39 | |
| 40 | /* |
| 41 | Have the preprocessor start reporting statistics. |
| 42 | */ |
| 43 | void setStatistics( Statistics *statistics ); |
| 44 | |
| 45 | /* |
| 46 | Obtain the values of variabels that have become fixed. |
| 47 | */ |
| 48 | bool variableIsFixed( unsigned index ) const; |
| 49 | double getFixedValue( unsigned index ) const; |
| 50 | |
| 51 | /* |
| 52 | Obtain the values of variables that have been merged. |
| 53 | */ |
| 54 | bool variableIsMerged( unsigned index ) const; |
| 55 | unsigned getMergedIndex( unsigned index ) const; |
| 56 | |
| 57 | /* |
| 58 | Check whether a variable is unused by symbolically fixed. |
| 59 | */ |
| 60 | bool variableIsUnusedAndSymbolicallyFixed( unsigned index ) const; |
| 61 | |
| 62 | /* |
| 63 | Obtain the new index of a variable. |
| 64 | */ |
| 65 | unsigned getNewIndex( unsigned oldIndex ) const; |
| 66 | |
| 67 | /* |
| 68 | Given an inputQuery with all variable assignment other than ones for |
| 69 | variables corresponding to eliminated neurons, compute the full |
| 70 | assignment. |
| 71 | */ |
| 72 | void setSolutionValuesOfEliminatedNeurons( InputQuery &inputQuery ); |
| 73 | |
| 74 | private: |
| 75 | void freeMemoryIfNeeded(); |
| 76 | |
| 77 | inline double getLowerBound( unsigned var ) |
| 78 | { |
| 79 | return _lowerBounds[var]; |
| 80 | } |
| 81 | |
| 82 | inline double getUpperBound( unsigned var ) |
| 83 | { |
| 84 | return _upperBounds[var]; |
no outgoing calls