PolyBoRi
LessWeightedLengthInStratModified.h
Go to the documentation of this file.
00001 // -*- c++ -*-
00002 //*****************************************************************************
00014 //*****************************************************************************
00015 
00016 #ifndef polybori_groebner_LessWeightedLengthInStratModified_h_
00017 #define polybori_groebner_LessWeightedLengthInStratModified_h_
00018 
00019 // include basic definitions
00020 #include "groebner_defs.h"
00021 
00022 BEGIN_NAMESPACE_PBORIGB
00023 
00024 inline wlen_type wlen_literal_exceptioned(const PolyEntry& e){
00025     wlen_type res=e.weightedLength;
00026     if ((e.deg==1) && (e.length<=4)){
00027         //if (e.length==1) return -1;
00028         //if (e.p.hasConstantPart()) return 0;
00029         return res-1;
00030     }
00031     return res;
00032 }
00033 
00039 
00040 class LessWeightedLengthInStratModified{
00041 public:
00042   const ReductionStrategy* strat;
00043   LessWeightedLengthInStratModified(const ReductionStrategy& strat){
00044     this->strat=&strat;
00045   }
00046   bool operator() (const Monomial& a , const Monomial& b){
00047     wlen_type wa=wlen_literal_exceptioned((*strat)[a]);
00048     wlen_type wb=wlen_literal_exceptioned((*strat)[b]);
00049     
00050     return wa<wb;
00051     
00052   }
00053   bool operator() (const Exponent& a , const Exponent& b){
00054     wlen_type wa=wlen_literal_exceptioned((*strat)[a]);
00055     wlen_type wb=wlen_literal_exceptioned((*strat)[b]);
00056     
00057     return wa<wb;
00058     
00059   }
00060 };
00061 
00062 END_NAMESPACE_PBORIGB
00063 
00064 #endif /* polybori_LessWeightedLengthInStratModified_h_ */