Fixes to FCSimplex for some versions of compilers
authorMorgan Deters <mdeters@cs.nyu.edu>
Mon, 29 Apr 2013 14:50:43 +0000 (10:50 -0400)
committerMorgan Deters <mdeters@cs.nyu.edu>
Mon, 29 Apr 2013 16:11:41 +0000 (12:11 -0400)
configure.ac
src/theory/arith/error_set.h
src/theory/arith/fc_simplex.h
src/theory/arith/soi_simplex.cpp
src/theory/arith/soi_simplex.h

index deee4fa687f9ba0ec32ccc42bf6f5e6a8c39007a..ca868c0d09f96c60334aa9540dd00af219b3f647 100644 (file)
@@ -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 <ext/pb_ds/priority_queue.hpp>
+typedef pb_ds::priority_queue<void, void, void> pq;])],
+  [CVC4_PB_DS_NAMESPACE=pb_ds],
+  [AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+    #include <ext/pb_ds/priority_queue.hpp>
+    typedef __gnu_pbds::priority_queue<void, void, void> 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
 
index ce64125736fe7f900438e6e3d092ce9863c0a11d..e616db3b91e51dbdf633f62034c056b4ea22f9bc 100644 (file)
@@ -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;
 
index 0dafa83ffdd38ba8ed40e14ba53cd82ab1e2459b..51514bcfb3977c0a3214bd93a213f538c3916e92 100644 (file)
@@ -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<false>:
-      &LinearEqualityModule::preferWitness<true>;
+    if(useBlands) {
+      return &LinearEqualityModule::preferWitness<false>;
+    } else {
+      return &LinearEqualityModule::preferWitness<true>;
+    }
   }
 
   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<false>:
-      &LinearEqualityModule::preferWitness<true>;
+    LinearEqualityModule::UpdatePreferenceFunction upf;
+    if(useBlands) {
+      upf = &LinearEqualityModule::preferWitness<false>;
+    } else {
+      upf = &LinearEqualityModule::preferWitness<true>;
+    }
 
     LinearEqualityModule::VarPreferenceFunction bpf = useBlands ?
       &LinearEqualityModule::minVarOrder :
index f19b13fa5cdb82bd65264ce0222980eb4ea55646..7255d92efbff1df28211403ba0561c7fd81c8c1a 100644 (file)
@@ -674,9 +674,12 @@ WitnessImprovement SumOfInfeasibilitiesSPD::soiRound() {
   Assert(d_soiVar != ARITHVAR_SENTINEL);
 
   bool useBlands = degeneratePivotsInARow() >= s_maxDegeneratePivotsBeforeBlandsOnLeaving;
-  LinearEqualityModule::UpdatePreferenceFunction upf = useBlands ?
-    &LinearEqualityModule::preferWitness<false>:
-    &LinearEqualityModule::preferWitness<true>;
+  LinearEqualityModule::UpdatePreferenceFunction upf;
+  if(useBlands) {
+    upf = &LinearEqualityModule::preferWitness<false>;
+  } else {
+    upf = &LinearEqualityModule::preferWitness<true>;
+  }
 
   LinearEqualityModule::VarPreferenceFunction bpf = useBlands ?
     &LinearEqualityModule::minVarOrder :
index 1a6becccbd7ffafaaa792d1dc30e0a8df3edfa8c..006839a55536dfa477027390f353459b57579724 100644 (file)
@@ -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<false>:
-      &LinearEqualityModule::preferWitness<true>;
+    if(useBlands) {
+      return &LinearEqualityModule::preferWitness<false>;
+    } else {
+      return &LinearEqualityModule::preferWitness<true>;
+    }
   }
 
   bool debugSOI(WitnessImprovement w, std::ostream& out, int instance) const;