10 #ifdef SMTRAT_DEVOPTION_Validation
11 #define SMTRAT_DEVOPTION_VALIDATION_ICP
18 #include "../LRAModule/LRAModule.h"
19 #include "../LRAModule/LRASettings.h"
31 template<
class Settings>
35 template<
template<
typename>
class Operator>
46 bool operator ()( std::pair<double, unsigned> lhs, std::pair<double, unsigned> rhs )
const
48 return lhs.first < rhs.first || ((lhs.first == rhs.first) && lhs.second > rhs.second);
56 assert(_lhs.type() == carl::FormulaType::CONSTRAINT);
57 assert(_rhs.type() == carl::FormulaType::CONSTRAINT);
58 return _lhs.constraint() < _rhs.constraint();
74 typedef carl::FastPointerMap<Poly*, weights>
WeightMap;
120 #ifdef SMTRAT_DEVOPTION_VALIDATION_ICP
136 return SettingsType::moduleName;
246 Answer callBackends(
bool _final =
false,
bool _full =
true, carl::Variable _objective = carl::Variable::NO_VARIABLE );
319 std::map<carl::Variable, double>
createModel(
bool antipoint =
false )
const;
349 bool performSplit(
bool _contractionApplied,
bool& _moreContractionFound );
351 bool splitToBoundedIntervalsWithoutZero( carl::Variable& _variable,
Rational& _value,
bool& _leftCaseWeak,
bool& _preferLeftCase, std::vector<std::map<carl::Variable, icp::IcpVariable*>::const_iterator>& _suitableVariables );
456 for(
auto& cc : _ccs )
466 for(
auto& f : _cc.
origin() )
470 std::cout << f << std::endl;
493 if( _interval.lower_bound_type() == carl::BoundType::INFTY || _interval.upper_bound_type() == carl::BoundType::INFTY )
Class to create a settings object for the ICPModule.
void activateLinearConstraint(const FormulaT &_formula, const FormulaT &_origin)
bool informCore(const FormulaT &)
void debugPrint() const
Printout of actual tables of linear constraints, active linear constraints, nonlinear constraints and...
bool removeCandidateFromRelevant(icp::ContractionCandidate *_candidate)
Removes a candidate from the icpRelevantCandidates.
Answer callBackends(bool _final=false, bool _full=true, carl::Variable _objective=carl::Variable::NO_VARIABLE)
bool addCandidateToRelevant(icp::ContractionCandidate *_candidate)
Adds the specific candidate to IcpRelevantCandidates.
carl::Contraction< Operator, Poly > Contractor
smtrat::Conditionals mLRAFoundAnswer
std::vector< FormulaT > createPremise()
FormulaSetT createPremiseDeductions()
std::map< const icp::LRAVariable *, ContractionCandidates > mLinearConstraints
bool fulfillsTarget(const DoubleInterval &_interval) const
std::map< carl::Variable, icp::IcpVariable * > mVariables
bool initialLinearCheck(Answer &_answer)
Performs a consistency check on the linearization of the received constraints.
EvalDoubleIntervalMap mIntervals
FormulaT getReceivedFormulas(const FormulaT &_deduction)
Parses obtained deductions from the LRA module and maps them to original constraints or introduces ne...
bool fulfillsTarget(icp::ContractionCandidate &_cc) const
bool checkBoxAgainstLinearFeasibleRegion()
Checks the actual intervalBox with the LRASolver.
void createLinearCCs(const FormulaT &_constraint, const FormulaT &_original)
Creates the linear contraction candidates corresponding to the given linear constraint.
void resetHistory(icp::ContractionCandidate *)
Methods:
std::set< icp::ContractionCandidate *, icp::contractionCandidateComp > mActiveNonlinearConstraints
bool contractionCandidatesHaveLegalOrigins(const ContractionCandidates &_ccs) const
ModuleInput::iterator eraseSubformulaFromPassedFormula(ModuleInput::iterator _subformula, bool _ignoreOrigins=false)
Removes everything related to the sub-formula to remove from the passed formula in the backends of th...
double mDefaultSplittingSize
void remapAndSetLraInfeasibleSubsets()
Sets the own infeasible subset according to the infeasible subset of the internal lra module.
void setContraction(const FormulaT &_constraint, icp::IcpVariable &_icpVar, const DoubleInterval &_contractedInterval, bool _allCCs)
icp::HistoryNode * mHistoryActual
carl::FastPointerMap< Poly *, weights > WeightMap
SplittingHeuristic mSplittingHeuristic
std::map< ConstraintT, ContractionCandidates > mNonlinearConstraints
double satBasedSplittingImpact(icp::IcpVariable &_icpVariable, const EvalDoubleIntervalMap &_intervals, const DoubleInterval &_seperatedPart, bool _calculateImpact)
bool intervalsEmpty(const EvalDoubleIntervalMap &_intervals) const
double mRelativeContraction
carl::FastMap< Poly, Contractor< carl::SimpleNewton > > mContractors
Members:
void printIcpRelevantCandidates() const
Prints all icpRelevant candidates with their weight and id.
FormulasT getCurrentBoxAsFormulas() const
FormulasT createBoxFormula(bool _onlyOriginalVariables)
std::set< icp::ContractionCandidate *, icp::contractionCandidateComp > mActiveLinearConstraints
RationalInterval doubleToRationalInterval(carl::Variable::Arg _var, const DoubleInterval &_interval, EvalRationalIntervalMap::const_iterator _initialIntervalIter) const
void contraction(icp::ContractionCandidate *_selection)
Calls the actual contraction function and implements threshold functionality.
bool performSplit(bool _contractionApplied, bool &_moreContractionFound)
Poly createNonlinearCCs(const ConstraintT &_constraint, const std::vector< Poly > &_tempMonomes)
Creates the non-linear contraction candidates from all items in mTemporaryMonomes and empties mTempor...
unsigned mNumberOfReusagesAfterTargetDiameterReached
carl::FastMap< FormulaT, FormulaT > mDeLinearizations
void printAffectedCandidates() const
Prints the mapping from variable to ContractionCandidates which contain this variable.
bool splitToBoundedIntervalsWithoutZero(carl::Variable &_variable, Rational &_value, bool &_leftCaseWeak, bool &_preferLeftCase, std::vector< std::map< carl::Variable, icp::IcpVariable * >::const_iterator > &_suitableVariables)
std::string moduleName() const
void updateAbsoluteContraction(const DoubleInterval &_interval, const DoubleInterval &_contractedInterval)
icp::ContractionCandidateManager mCandidateManager
FormulaSetT mNotEqualConstraints
void removeCore(ModuleInput::const_iterator)
void addConstraint(const FormulaT &_formula)
void splittingBasedContraction(icp::IcpVariable &_icpVar, const FormulaT &_violatedConstraint, const DoubleInterval &_contractedInterval)
void updateRelevantCandidates(carl::Variable::Arg _var)
Update all affected candidates and reinsert them into icpRelevantCandidates.
double mCovererdRegionSize
FormulaT intervalBoundToFormula(carl::Variable::Arg _var, const DoubleInterval &_interval, EvalRationalIntervalMap::const_iterator _initialIntervalIter, bool _upper) const
void printIcpVariables() const
Prints all icpVariables.
Answer checkCore()
Checks the received formula for consistency.
EvalRationalIntervalMap getCurrentBoxAsIntervals() const
bool intervalsEmpty(bool _original=false) const
void addProgress(double _progress)
void updateModel() const
Updates the model, if the solver has detected the consistency of the received formula,...
void setContraction(icp::ContractionCandidate *_selection, icp::IcpVariable &_icpVar, const DoubleInterval &_contractedInterval)
LRAModule< LRASettingsICP > mLRA
icp::HistoryNode * mHistoryRoot
ModuleInput * mValidationFormula
double calculateCurrentBoxSize()
icp::ContractionCandidate * chooseContractionCandidate()
Method to determine the next combination of variable and constraint to be contracted.
FormulasT createConstraintsFromBounds(const EvalDoubleIntervalMap &_map, bool _isOriginal=true)
creates constraints for the actual bounds of the original variables.
void printPreprocessedInput(std::string _init="") const
Prints all intervals from mIntervals, should be the same intervals as in mHistoryActual->intervals().
bool contractionCandidateHasLegalOrigins(const icp::ContractionCandidate &_cc) const
bool mOriginalVariableIntervalContracted
bool addCore(ModuleInput::const_iterator)
double mContractionThreshold
bool contractionCandidatesHaveLegalOrigins() const
carl::FastMap< Poly, carl::Variable > mVariableLinearizations
EvalRationalIntervalMap mInitialIntervals
void pushBoundsToPassedFormula()
Creates Bounds and passes them to PassedFormula for the Backends.
std::map< carl::Variable, Poly > mSubstitutions
std::map< carl::Variable, double > createModel(bool antipoint=false) const
ICPModule(const ModuleInput *, Conditionals &, Manager *const =NULL)
Constructors:
bool checkNotEqualConstraints()
void printIntervals(bool _original=false) const
Prints all intervals from mIntervals, should be the same intervals as in mHistoryActual->intervals().
FormulasT variableReasonHull(icp::set_icpVariable &_reasons)
Compute hull of defining origins for set of icpVariables.
carl::FastMap< FormulaT, FormulaT > mLinearizations
std::queue< FormulasT > mBoxStorage
void contractCurrentBox()
void printContraction(const icp::ContractionCandidate &_cc, const DoubleInterval &_before, const DoubleInterval &_afterA, const DoubleInterval &_afterB=DoubleInterval::empty_interval(), std::ostream &_out=std::cout) const
void setBox(icp::HistoryNode *_selection)
Set all parameters of the module according to the selected HistoryNode.
icp::IcpVariable * getIcpVariable(carl::Variable::Arg _var, bool _original, const icp::LRAVariable *_lraVar)
void sizeBasedSplitting(carl::Variable &_variable, Rational &_value, bool &_leftCaseWeak, bool &_preferLeftCase)
double sizeBasedSplittingImpact(std::map< carl::Variable, icp::IcpVariable * >::const_iterator _varIcpVarMapIter) const
Selects the next splitting direction according to different heuristics.
bool satBasedSplitting(carl::Variable &_variable, Rational &_value, bool &_leftCaseWeak, bool &_preferLeftCase)
void fillCandidates()
Fills the IcpRelevantCandidates with all nonlinear and all active linear ContractionCandidates.
static const unsigned mSplittingStrategy
std::set< std::pair< double, unsigned >, comp > mIcpRelevantCandidates
void activateNonlinearConstraint(const FormulaT &_formula)
void updateRelativeContraction(const DoubleInterval &_interval, const DoubleInterval &_contractedInterval)
double mAbsoluteContraction
A module which performs the Simplex method on the linear part of it's received formula.
A base class for all kind of theory solving methods.
const ModuleInput & rReceivedFormula() const
carl::Variable::Arg derivationVar() const
unsigned incrementReusagesAfterTargetDiameterReached()
unsigned reusagesAfterTargetDiameterReached() const
const FormulaSetT & origin() const
std::set< const IcpVariable *, icpVariableComp > set_icpVariable
bool contains(const std::vector< TagPoly > &polys, const Poly &poly)
Class to create the formulas for axioms.
carl::FormulaSet< Poly > FormulaSetT
std::set< icp::ContractionCandidate *, icp::contractionCandidateComp > ContractionCandidates
carl::Formula< Poly > FormulaT
const settings::Settings & Settings()
carl::Model< Rational, Poly > Model
carl::Interval< double > DoubleInterval
std::map< carl::Variable, RationalInterval > EvalRationalIntervalMap
carl::Interval< Rational > RationalInterval
carl::MultivariatePolynomial< Rational > Poly
Answer
An enum with the possible answers a Module can give.
std::vector< std::atomic_bool * > Conditionals
A vector of atomic bool pointers.
carl::Constraint< Poly > ConstraintT
carl::Formulas< Poly > FormulasT
std::map< carl::Variable, DoubleInterval > EvalDoubleIntervalMap
bool operator()(std::pair< double, unsigned > lhs, std::pair< double, unsigned > rhs) const
std::list< linearVariable * > origins