From bb32f230b1bf822a422efe89f35ac92c8d17c50f Mon Sep 17 00:00:00 2001 From: Morgan Deters Date: Mon, 29 Apr 2013 10:50:43 -0400 Subject: [PATCH] Fixes to FCSimplex for some versions of compilers --- configure.ac | 15 +++++++++++++++ src/theory/arith/error_set.h | 4 ++-- src/theory/arith/fc_simplex.h | 17 +++++++++++------ src/theory/arith/soi_simplex.cpp | 9 ++++++--- src/theory/arith/soi_simplex.h | 8 +++++--- 5 files changed, 39 insertions(+), 14 deletions(-) diff --git a/configure.ac b/configure.ac index deee4fa68..ca868c0d0 100644 --- a/configure.ac +++ b/configure.ac @@ -751,6 +751,21 @@ void foo(int64_t) {}])], AC_LANG_POP([C++]) AC_SUBST([CVC4_NEED_INT64_T_OVERLOADS]) +AC_MSG_CHECKING([for the pb_ds namespace]) +AC_LANG_PUSH([C++]) +AC_COMPILE_IFELSE([AC_LANG_SOURCE([ +#include +typedef pb_ds::priority_queue pq;])], + [CVC4_PB_DS_NAMESPACE=pb_ds], + [AC_COMPILE_IFELSE([AC_LANG_SOURCE([ + #include + typedef __gnu_pbds::priority_queue pq;])], + [CVC4_PB_DS_NAMESPACE=__gnu_pbds], + [AC_MSG_ERROR([can't find required priority_queue in either __gnu_pbds or pb_ds namespace])])]) +AC_LANG_POP([C++]) +AC_DEFINE_UNQUOTED(CVC4_PB_DS_NAMESPACE, ${CVC4_PB_DS_NAMESPACE}, [The namespace for pb_ds data structures.]) +AC_MSG_RESULT([$CVC4_PB_DS_NAMESPACE]) + # Check for ANTLR runantlr script (defined in config/antlr.m4) AC_PROG_ANTLR diff --git a/src/theory/arith/error_set.h b/src/theory/arith/error_set.h index ce6412573..e616db3b9 100644 --- a/src/theory/arith/error_set.h +++ b/src/theory/arith/error_set.h @@ -87,10 +87,10 @@ public: // // typedef FocusSet::handle_type FocusSetHandle; -typedef __gnu_pbds::priority_queue< +typedef CVC4_PB_DS_NAMESPACE::priority_queue< ArithVar, ComparatorPivotRule, - __gnu_pbds::pairing_heap_tag> FocusSet; + CVC4_PB_DS_NAMESPACE::pairing_heap_tag> FocusSet; typedef FocusSet::point_iterator FocusSetHandle; diff --git a/src/theory/arith/fc_simplex.h b/src/theory/arith/fc_simplex.h index 0dafa83ff..51514bcfb 100644 --- a/src/theory/arith/fc_simplex.h +++ b/src/theory/arith/fc_simplex.h @@ -146,9 +146,11 @@ private: LinearEqualityModule::UpdatePreferenceFunction selectLeavingFunction(ArithVar x){ bool useBlands = d_leavingCountSinceImprovement.isKey(x) && d_leavingCountSinceImprovement[x] >= s_maxDegeneratePivotsBeforeBlandsOnEntering; - return useBlands ? - &LinearEqualityModule::preferWitness: - &LinearEqualityModule::preferWitness; + if(useBlands) { + return &LinearEqualityModule::preferWitness; + } else { + return &LinearEqualityModule::preferWitness; + } } bool debugDualLike(WitnessImprovement w, std::ostream& out, @@ -183,9 +185,12 @@ private: UpdateInfo selectUpdateForPrimal(ArithVar basic, bool useBlands){ TimerStat::CodeTimer codeTimer(d_statistics.d_selectUpdateForPrimal); - LinearEqualityModule::UpdatePreferenceFunction upf = useBlands ? - &LinearEqualityModule::preferWitness: - &LinearEqualityModule::preferWitness; + LinearEqualityModule::UpdatePreferenceFunction upf; + if(useBlands) { + upf = &LinearEqualityModule::preferWitness; + } else { + upf = &LinearEqualityModule::preferWitness; + } LinearEqualityModule::VarPreferenceFunction bpf = useBlands ? &LinearEqualityModule::minVarOrder : diff --git a/src/theory/arith/soi_simplex.cpp b/src/theory/arith/soi_simplex.cpp index f19b13fa5..7255d92ef 100644 --- a/src/theory/arith/soi_simplex.cpp +++ b/src/theory/arith/soi_simplex.cpp @@ -674,9 +674,12 @@ WitnessImprovement SumOfInfeasibilitiesSPD::soiRound() { Assert(d_soiVar != ARITHVAR_SENTINEL); bool useBlands = degeneratePivotsInARow() >= s_maxDegeneratePivotsBeforeBlandsOnLeaving; - LinearEqualityModule::UpdatePreferenceFunction upf = useBlands ? - &LinearEqualityModule::preferWitness: - &LinearEqualityModule::preferWitness; + LinearEqualityModule::UpdatePreferenceFunction upf; + if(useBlands) { + upf = &LinearEqualityModule::preferWitness; + } else { + upf = &LinearEqualityModule::preferWitness; + } LinearEqualityModule::VarPreferenceFunction bpf = useBlands ? &LinearEqualityModule::minVarOrder : diff --git a/src/theory/arith/soi_simplex.h b/src/theory/arith/soi_simplex.h index 1a6becccb..006839a55 100644 --- a/src/theory/arith/soi_simplex.h +++ b/src/theory/arith/soi_simplex.h @@ -122,9 +122,11 @@ private: LinearEqualityModule::UpdatePreferenceFunction selectLeavingFunction(ArithVar x){ bool useBlands = d_leavingCountSinceImprovement.isKey(x) && d_leavingCountSinceImprovement[x] >= s_maxDegeneratePivotsBeforeBlandsOnEntering; - return useBlands ? - &LinearEqualityModule::preferWitness: - &LinearEqualityModule::preferWitness; + if(useBlands) { + return &LinearEqualityModule::preferWitness; + } else { + return &LinearEqualityModule::preferWitness; + } } bool debugSOI(WitnessImprovement w, std::ostream& out, int instance) const; -- 2.30.2