Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r54967 - in sandbox/itl: boost/itl boost/itl_xt boost/validate/driver boost/validate/gentor boost/validate/validater libs/validate/src/gentor
From: afojgo_at_[hidden]
Date: 2009-07-15 07:26:40


Author: jofaber
Date: 2009-07-15 07:26:38 EDT (Wed, 15 Jul 2009)
New Revision: 54967
URL: http://svn.boost.org/trac/boost/changeset/54967

Log:
Added code to LaBatea to monitor the times of law validations. Stable {msvc-9.0}
Text files modified:
   sandbox/itl/boost/itl/interval_base_map.hpp | 3 +
   sandbox/itl/boost/itl/interval_base_set.hpp | 3 +
   sandbox/itl/boost/itl/interval_map.hpp | 4
   sandbox/itl/boost/itl/interval_set.hpp | 16 +++---
   sandbox/itl/boost/itl/separate_interval_set.hpp | 4
   sandbox/itl/boost/itl/split_interval_map.hpp | 4
   sandbox/itl/boost/itl_xt/itvgentor.hpp | 2
   sandbox/itl/boost/validate/driver/itl_driver.hpp | 33 +++++++++++++--
   sandbox/itl/boost/validate/driver/signed_quantifier_driver.hpp | 28 ++++++------
   sandbox/itl/boost/validate/gentor/gentorprofile.hpp | 26 +++++++++++-
   sandbox/itl/boost/validate/validater/itl_set_validater.hpp | 6 +
   sandbox/itl/boost/validate/validater/law_validater.hpp | 64 +++++++++++++++++++++++-------
   sandbox/itl/libs/validate/src/gentor/gentorprofile.cpp | 82 ++++++++++++++++++++++++++++++++-------
   13 files changed, 207 insertions(+), 68 deletions(-)

Modified: sandbox/itl/boost/itl/interval_base_map.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval_base_map.hpp (original)
+++ sandbox/itl/boost/itl/interval_base_map.hpp 2009-07-15 07:26:38 EDT (Wed, 15 Jul 2009)
@@ -314,6 +314,9 @@
     SubType& add(const segment_type& interval_value_pair)
     { that()->template add_<codomain_combine>(interval_value_pair); return *that(); }
 
+ /** Addition of an interval value pair \c interval_value_pair to the map.
+ Iterator \c prior_ is a hint to the position \c interval_value_pair can be
+ inserted after. */
     iterator add(iterator prior_, const segment_type& interval_value_pair)
     { return that()->template add_<codomain_combine>(prior_, interval_value_pair); }
 

Modified: sandbox/itl/boost/itl/interval_base_set.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval_base_set.hpp (original)
+++ sandbox/itl/boost/itl/interval_base_set.hpp 2009-07-15 07:26:38 EDT (Wed, 15 Jul 2009)
@@ -248,6 +248,9 @@
     SubType& add(const segment_type& inter_val)
     { that()->add_(inter_val); return *that(); }
 
+ /** Add an interval of elements \c inter_val to the set. Iterator
+ \c prior_ is a hint to the position \c inter_val can be
+ inserted after. */
     iterator add(iterator prior_, const segment_type& inter_val)
     { return that()->add_(prior_, inter_val); }
 

Modified: sandbox/itl/boost/itl/interval_map.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval_map.hpp (original)
+++ sandbox/itl/boost/itl/interval_map.hpp 2009-07-15 07:26:38 EDT (Wed, 15 Jul 2009)
@@ -299,7 +299,7 @@
         // Detect the first and the end iterator of the collision sequence
         iterator first_ = this->_map.lower_bound(inter_val),
                  last_ = insertion.ITERATOR;
- //assert(end_ == this->_map.upper_bound(inter_val));
+ //assert(end_ == this->_map.upper_bound(inter_val));
 
         iterator it_ = first_;
         interval_type rest_interval = inter_val;
@@ -335,7 +335,7 @@
         // Detect the first and the end iterator of the collision sequence
         iterator first_ = this->_map.lower_bound(inter_val),
                  last_ = insertion.ITERATOR;
- //assert(end_ == this->_map.upper_bound(inter_val));
+ //assert(end_ == this->_map.upper_bound(inter_val));
 
         iterator it_ = first_;
         interval_type rest_interval = inter_val;

Modified: sandbox/itl/boost/itl/interval_set.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval_set.hpp (original)
+++ sandbox/itl/boost/itl/interval_set.hpp 2009-07-15 07:26:38 EDT (Wed, 15 Jul 2009)
@@ -145,7 +145,7 @@
     /// Treatment of adjoint intervals on insertion
     iterator handle_neighbours(iterator it_);
 
- iterator join_segments(const iterator& left_, const iterator& right_);
+ iterator join_on_left(iterator& left_, const iterator& right_);
 } ;
 
 
@@ -181,7 +181,7 @@
     {
         iterator it_nxt=it_; it_nxt++;
         if(it_nxt!=this->_set.end() && (*it_).touches(*it_nxt))
- return join_segments(it_, it_nxt);
+ return join_on_left(it_, it_nxt);
     }
     else
     {
@@ -190,14 +190,14 @@
 
         if((*pred_).touches(*it_))
         {
- iterator it_extended = join_segments(pred_, it_);
+ iterator it_extended = join_on_left(pred_, it_);
 
             iterator succ_=it_extended; succ_++;
             if(succ_!=this->_set.end())
             {
                 // it's a non border element that might have two touching neighbours
                 if((*it_extended).touches(*succ_))
- return join_segments(it_extended, succ_);
+ return join_on_left(it_extended, succ_);
                                 else
                                         return it_extended;
             }
@@ -211,7 +211,7 @@
             {
                 // it's a non border element that might have a right touching neighbours
                 if((*it_).touches(*succ_))
- return join_segments(it_, succ_);
+ return join_on_left(it_, succ_);
             }
         }
     }
@@ -224,7 +224,7 @@
 template <typename DomainT, ITL_COMPARE Compare, template<class,ITL_COMPARE>class Interval, ITL_ALLOC Alloc>
 inline typename interval_set<DomainT,Compare,Interval,Alloc>::iterator
     interval_set<DomainT,Compare,Interval,Alloc>
- ::join_segments(const iterator& left_, const iterator& right_)
+ ::join_on_left(iterator& left_, const iterator& right_)
 {
     // both left and right are in the set and they are neighbours
     BOOST_ASSERT((*left_).exclusive_less(*right_));
@@ -252,7 +252,7 @@
         iterator first_ = this->_set.lower_bound(addend),
                  last_ = insertion.ITERATOR,
                  end_ = insertion.ITERATOR; end_ ++;
- //BOOST_ASSERT(end_ == this->_map.upper_bound(inter_val));
+ //BOOST_ASSERT(end_ == this->_map.upper_bound(inter_val));
         iterator second_= first_; ++second_;
 
         interval_type leftResid = right_subtract(*first_, addend);
@@ -284,7 +284,7 @@
         iterator first_ = this->_set.lower_bound(addend),
                  last_ = insertion,
                  end_ = insertion; end_ ++;
- //BOOST_ASSERT(end_ == this->_map.upper_bound(inter_val));
+ //BOOST_ASSERT(end_ == this->_map.upper_bound(inter_val));
         iterator second_= first_; ++second_;
 
         interval_type leftResid = right_subtract(*first_, addend);

Modified: sandbox/itl/boost/itl/separate_interval_set.hpp
==============================================================================
--- sandbox/itl/boost/itl/separate_interval_set.hpp (original)
+++ sandbox/itl/boost/itl/separate_interval_set.hpp 2009-07-15 07:26:38 EDT (Wed, 15 Jul 2009)
@@ -169,7 +169,7 @@
         iterator first_ = this->_set.lower_bound(addend),
                  last_ = insertion.ITERATOR,
                  end_ = insertion.ITERATOR; end_ ++;
- //BOOST_ASSERT(end_ == this->_map.upper_bound(inter_val));
+ //BOOST_ASSERT(end_ == this->_map.upper_bound(inter_val));
         iterator second_= first_; ++second_;
 
         interval_type leftResid = right_subtract(*first_, addend);
@@ -200,7 +200,7 @@
         iterator first_ = this->_set.lower_bound(addend),
                  last_ = insertion,
                  end_ = insertion; end_ ++;
- //BOOST_ASSERT(end_ == this->_map.upper_bound(inter_val));
+ //BOOST_ASSERT(end_ == this->_map.upper_bound(inter_val));
         iterator second_= first_; ++second_;
 
         interval_type leftResid = right_subtract(*first_, addend);

Modified: sandbox/itl/boost/itl/split_interval_map.hpp
==============================================================================
--- sandbox/itl/boost/itl/split_interval_map.hpp (original)
+++ sandbox/itl/boost/itl/split_interval_map.hpp 2009-07-15 07:26:38 EDT (Wed, 15 Jul 2009)
@@ -198,7 +198,7 @@
         // Detect the first and the end iterator of the collision sequence
         iterator first_ = this->_map.lower_bound(inter_val),
                  last_ = insertion.ITERATOR;
- //assert(end_ == this->_map.upper_bound(inter_val));
+ //assert(end_ == this->_map.upper_bound(inter_val));
 
         iterator it_ = first_;
         interval_type rest_interval = inter_val;
@@ -233,7 +233,7 @@
         // Detect the first and the end iterator of the collision sequence
         iterator first_ = this->_map.lower_bound(inter_val),
                  last_ = insertion.ITERATOR;
- //assert(end_ == this->_map.upper_bound(inter_val));
+ //assert(end_ == this->_map.upper_bound(inter_val));
 
         iterator it_ = first_;
         interval_type rest_interval = inter_val;

Modified: sandbox/itl/boost/itl_xt/itvgentor.hpp
==============================================================================
--- sandbox/itl/boost/itl_xt/itvgentor.hpp (original)
+++ sandbox/itl/boost/itl_xt/itvgentor.hpp 2009-07-15 07:26:38 EDT (Wed, 15 Jul 2009)
@@ -31,6 +31,8 @@
 #ifndef __ITVGENTOR_H_JOFA_000714__
 #define __ITVGENTOR_H_JOFA_000714__
 
+#undef min
+#undef max
 
 #include <boost/itl_xt/gentorit.hpp>
 #include <boost/itl_xt/numbergentor.hpp>

Modified: sandbox/itl/boost/validate/driver/itl_driver.hpp
==============================================================================
--- sandbox/itl/boost/validate/driver/itl_driver.hpp (original)
+++ sandbox/itl/boost/validate/driver/itl_driver.hpp 2009-07-15 07:26:38 EDT (Wed, 15 Jul 2009)
@@ -46,6 +46,11 @@
     class itl_driver
     {
     public:
+ itl_driver()
+ {
+ _laws_per_cycle = GentorProfileSgl::it()->laws_per_cycle();
+ }
+
         bool hasValidProfile()const { return _isValid; }
 
         virtual void setProfile() = 0;
@@ -59,9 +64,9 @@
 
             for(int idx=0; hasValidProfile(); idx++)
             {
- if(idx>0 && idx % 100 == 0)
- reportFrequencies();
                 validateType();
+ if(idx>0 && idx % _laws_per_cycle == 0)
+ reportFrequencies();
             }
         }
 
@@ -81,12 +86,23 @@
         {
             std::cout << "------------------------------------------------------------------------------" << std::endl;
             int valid_count = 1;
+ double avg_evaluation_time = 0.0;
+ long instance_count = 0;
             FORALL(ValidationCounterT, it, _frequencies)
             {
- printf("%3d %-66s%8d\n", valid_count, it->KEY_VALUE.c_str(), it->CONT_VALUE);
+ long law_validation_count = it->CONT_VALUE.count();
+ double avg_law_evaluation_time =
+ it->CONT_VALUE.time()/(law_validation_count);
+ printf("%3d %-58s%9d%7.0lf\n",
+ valid_count, it->KEY_VALUE.c_str(), law_validation_count, avg_law_evaluation_time);
+
+ avg_evaluation_time += avg_law_evaluation_time;
+ instance_count += law_validation_count;
                 valid_count++;
             }
             std::cout << "------------------------------------------------------------------------------" << std::endl;
+ printf(" %-60s%7d%7.0lf\n", " ", instance_count, avg_evaluation_time/_frequencies.size());
+
             int violation_count = 1;
             FORALL(ViolationMapT, it, _violations)
             {
@@ -124,7 +140,10 @@
         }
 
     protected:
- void setValid(bool truth) { _isValid = truth; }
+ void setValid(bool truth)
+ {
+ _isValid = truth;
+ }
 
         void setRootTypeNames()
         {
@@ -178,11 +197,15 @@
         ChoiceT _neutronizerChoice;
 
     private:
- algebra_validater* _validater;
+ algebra_validater* _validater;
         ValidationCounterT _frequencies;
         ViolationCounterT _violationsCount;
         ViolationMapT _violations;
         bool _isValid;
+
+ int _laws_per_cycle; // After _laws_per_cycle times a cycle is
+ // done and times and frequencies of law
+ // validations are reported for all instances.
     };
 
 

Modified: sandbox/itl/boost/validate/driver/signed_quantifier_driver.hpp
==============================================================================
--- sandbox/itl/boost/validate/driver/signed_quantifier_driver.hpp (original)
+++ sandbox/itl/boost/validate/driver/signed_quantifier_driver.hpp 2009-07-15 07:26:38 EDT (Wed, 15 Jul 2009)
@@ -41,8 +41,8 @@
 
             _domainChoice.setSize(DomainType::DomainTypes_size);
             _domainChoice.setMaxWeights(100);
- _domainChoice[DomainType::Int] = 100;
- _domainChoice[DomainType::Double] = 0;
+ _domainChoice[DomainType::Int] = 0;
+ _domainChoice[DomainType::Double] = 100;
             setDomainTypeNames();
             _domainChoice.init();
 
@@ -103,30 +103,30 @@
             //-----------------------------------------------------------------
             //case RootType::itl_map: {
             // switch(neutronizerChoice) {
- // case NeutronHandlerType::partial_absorber: return new signed_quantifier_validater<itl::map<int,int,partial_absorber> >;
- // case NeutronHandlerType::partial_enricher: return new signed_quantifier_validater<itl::map<int,int,partial_enricher> >;
- // case NeutronHandlerType::total_absorber: return new signed_quantifier_validater<itl::map<int,int,total_absorber > >;
- // case NeutronHandlerType::total_enricher: return new signed_quantifier_validater<itl::map<int,int,total_enricher > >;
+ // case NeutronHandlerType::partial_absorber: return new signed_quantifier_validater<itl::map<double,int,partial_absorber> >;
+ // case NeutronHandlerType::partial_enricher: return new signed_quantifier_validater<itl::map<double,int,partial_enricher> >;
+ // case NeutronHandlerType::total_absorber: return new signed_quantifier_validater<itl::map<double,int,total_absorber > >;
+ // case NeutronHandlerType::total_enricher: return new signed_quantifier_validater<itl::map<double,int,total_enricher > >;
             // default: return choiceError(ITL_LOCATION("\nRootType::itl_map: neutronizerChoice:\n"), neutronizerChoice, _neutronizerChoice);
             // }//switch neutronizerChoice
             //}//case itl_map
             //-----------------------------------------------------------------
             case RootType::interval_map: {
                 switch(neutronizerChoice) {
- case NeutronHandlerType::partial_absorber: return new signed_quantifier_validater<interval_map<int,int,partial_absorber> >;
- case NeutronHandlerType::partial_enricher: return new signed_quantifier_validater<interval_map<int,int,partial_enricher> >;
- case NeutronHandlerType::total_absorber: return new signed_quantifier_validater<interval_map<int,int,total_absorber > >;
- case NeutronHandlerType::total_enricher: return new signed_quantifier_validater<interval_map<int,int,total_enricher > >;
+ case NeutronHandlerType::partial_absorber: return new signed_quantifier_validater<interval_map<double,int,partial_absorber> >;
+ case NeutronHandlerType::partial_enricher: return new signed_quantifier_validater<interval_map<double,int,partial_enricher> >;
+ case NeutronHandlerType::total_absorber: return new signed_quantifier_validater<interval_map<double,int,total_absorber > >;
+ case NeutronHandlerType::total_enricher: return new signed_quantifier_validater<interval_map<double,int,total_enricher > >;
                 default: return choiceError(ITL_LOCATION("\nRootType::interval_map: neutronizerChoice:\n"), neutronizerChoice, _neutronizerChoice);
                 }//switch neutronizerChoice
             }//case interval_map
             //-----------------------------------------------------------------
             case RootType::split_interval_map: {
                 switch(neutronizerChoice) {
- case NeutronHandlerType::partial_absorber: return new signed_quantifier_validater<split_interval_map<int,int,partial_absorber> >;
- case NeutronHandlerType::partial_enricher: return new signed_quantifier_validater<split_interval_map<int,int,partial_enricher> >;
- case NeutronHandlerType::total_absorber: return new signed_quantifier_validater<split_interval_map<int,int,total_absorber > >;
- case NeutronHandlerType::total_enricher: return new signed_quantifier_validater<split_interval_map<int,int,total_enricher > >;
+ case NeutronHandlerType::partial_absorber: return new signed_quantifier_validater<split_interval_map<double,int,partial_absorber> >;
+ case NeutronHandlerType::partial_enricher: return new signed_quantifier_validater<split_interval_map<double,int,partial_enricher> >;
+ case NeutronHandlerType::total_absorber: return new signed_quantifier_validater<split_interval_map<double,int,total_absorber > >;
+ case NeutronHandlerType::total_enricher: return new signed_quantifier_validater<split_interval_map<double,int,total_enricher > >;
                 default: return choiceError(ITL_LOCATION("\nRootType::split_interval_map: neutronizerChoice:\n"), neutronizerChoice, _neutronizerChoice);
                 }//switch neutronizerChoice
             }//case split_interval_map

Modified: sandbox/itl/boost/validate/gentor/gentorprofile.hpp
==============================================================================
--- sandbox/itl/boost/validate/gentor/gentorprofile.hpp (original)
+++ sandbox/itl/boost/validate/gentor/gentorprofile.hpp 2009-07-15 07:26:38 EDT (Wed, 15 Jul 2009)
@@ -18,7 +18,11 @@
     class GentorProfile
     {
     public:
- GentorProfile();
+ GentorProfile();
+
+ void set_defaults();
+ void set_debug_defaults();
+ void set_release_defaults();
 
         void set_range_int(int lwb, int upb)
         { _range_int = interval<int>::rightopen(lwb, upb); }
@@ -36,6 +40,9 @@
         { _maxIntervalLength = val; }
         void set_range_element_ContainerSize(int lwb, int upb)
         { _range_element_ContainerSize = interval<int>::rightopen(lwb, upb); }
+ void set_repeat_count(int repeat) { _repeat_count = repeat; }
+ void set_trials_count(int trials) { _trials_count = trials; }
+ void set_laws_per_cycle(int count){ _laws_per_cycle = count; }
 
         interval<int> range_int() { return _range_int; }
         interval<nat> range_nat() { return _range_nat; }
@@ -46,6 +53,9 @@
         int maxIntervalLength() { return _maxIntervalLength; }
         interval<int> range_element_ContainerSize()
                                                     { return _range_element_ContainerSize; }
+ int repeat_count() { return _repeat_count; }
+ int trials_count() { return _trials_count; }
+ int laws_per_cycle() { return _laws_per_cycle; }
 
     private:
         interval<int> _range_int;
@@ -58,8 +68,12 @@
         int _maxIntervalLength;
 
         interval<int> _range_element_ContainerSize;
+ int _repeat_count;
+ int _trials_count;
+ int _laws_per_cycle;
     };
 
+
     class GentorProfileSgl // SINGLETON PATTERN
     {
     // Singleton pattern part -----------------------------------------------------
@@ -67,8 +81,8 @@
         static GentorProfileSgl* it(); // function to call the unique instance
 
     protected:
- GentorProfileSgl(); // default constructor is not callable from outside
- // preventing illegal instances
+ GentorProfileSgl(); // default constructor is not callable from outside
+ // preventing illegal instances
 
     // specific interface ---------------------------------------------------------
     public:
@@ -81,6 +95,9 @@
         void set_maxIntervalLength(int val) { m_profile.set_maxIntervalLength(val); }
         void set_range_element_ContainerSize(int lwb, int upb)
                                                        { m_profile.set_range_element_ContainerSize(lwb, upb); }
+ void set_repeat_count(int repeat) { m_profile.set_repeat_count(repeat); }
+ void set_trials_count(int trials) { m_profile.set_trials_count(trials); }
+ void set_laws_per_cycle(int count) { m_profile.set_laws_per_cycle(count); }
 
         interval<int> range_int() { return m_profile.range_int(); }
         interval<nat> range_nat() { return m_profile.range_nat(); }
@@ -90,6 +107,9 @@
         interval<double> range_interval_double() { return m_profile.range_interval_double();}
         int maxIntervalLength() { return m_profile.maxIntervalLength(); }
         interval<int> range_element_ContainerSize(){ return m_profile.range_element_ContainerSize(); }
+ int repeat_count() { return m_profile.repeat_count(); }
+ int trials_count() { return m_profile.trials_count(); }
+ int laws_per_cycle() { return m_profile.laws_per_cycle(); }
 
 
     private:

Modified: sandbox/itl/boost/validate/validater/itl_set_validater.hpp
==============================================================================
--- sandbox/itl/boost/validate/validater/itl_set_validater.hpp (original)
+++ sandbox/itl/boost/validate/validater/itl_set_validater.hpp 2009-07-15 07:26:38 EDT (Wed, 15 Jul 2009)
@@ -46,7 +46,10 @@
         Laws_size
     };
 
- itl_set_validater() {setProfile();}
+ itl_set_validater()
+ {
+ setProfile();
+ }
 
     void setProfile()
     {
@@ -122,7 +125,6 @@
         collector += _violations;
     }
 
-
 private:
     ChoiceT _lawChoice;
     LawValidaterI* _validater;

Modified: sandbox/itl/boost/validate/validater/law_validater.hpp
==============================================================================
--- sandbox/itl/boost/validate/validater/law_validater.hpp (original)
+++ sandbox/itl/boost/validate/validater/law_validater.hpp 2009-07-15 07:26:38 EDT (Wed, 15 Jul 2009)
@@ -11,17 +11,20 @@
 
 #include <iostream>
 #include <stdio.h>
+#include <boost/date_time/posix_time/posix_time.hpp>
+
 #include <boost/validate/loki_xt/Tuple.h>
 #include <boost/itl/set.hpp>
 #include <boost/itl/map.hpp>
 #include <boost/validate/gentor/randomgentor.hpp>
 
+#include <boost/validate/validation_counts.hpp>
 #include <boost/validate/laws/monoid.hpp>
 #include <boost/validate/laws/law_violations.hpp>
 
 namespace boost{namespace itl
 {
- typedef itl::map<std::string, int> ValidationCounterT;
+ typedef itl::map<std::string, validation_counts> ValidationCounterT;
     typedef itl::map<std::string, int> ViolationCounterT;
     typedef itl::map<std::string, PolyLawViolations> ViolationMapT;
 
@@ -50,19 +53,30 @@
 
     public:
 #ifdef _DEBUG
- static const int default_trials_count = 20;
+ static const int default_trials_count = 10;
+ static const int default_repeat_count = 20;
 #else
- static const int default_trials_count = 250;
+ static const int default_trials_count = 20;
+ static const int default_repeat_count = 10;
 #endif
- LawValidater(){ setTrialsCount(default_trials_count); }
+ LawValidater()
+ {
+ _repeat_count = GentorProfileSgl::it()->repeat_count();
+ _trials_count = GentorProfileSgl::it()->trials_count();
+ }
+
+ void settrials_count(int trials)
+ {
+ _trials_count = trials;
+ _silent_trials_count = std::max(1, _trials_count / 10);
+ }
 
- void setTrialsCount(int trials)
+ void set_repeat_count(int repeats)
         {
- _trialsCount = trials;
- _silentTrialsCount = std::max(1, _trialsCount / 10);
+ _repeat_count = std::max(1, repeats);
         }
 
- void setSilentTrialsCount(int trials) { _trialsCount = trials; }
+ void set_silent_trials_count(int trials) { _trials_count = trials; }
 
         void init();
         void run();
@@ -89,8 +103,9 @@
         input_gentor _gentor;
         LawT _law;
 
- int _trialsCount;
- int _silentTrialsCount;
+ int _trials_count;
+ int _silent_trials_count;
+ int _repeat_count;
 
         LawViolationsT _lawViolations;
         ValidationCounterT _frequencies;
@@ -107,6 +122,8 @@
         _violations.clear();
     }
 
+ // Runs law_instance_count * repeat_count validations on the law LawT
+ // law_instance_count: Number of instances that are validated for LawT
     template <class LawT, template<typename>class GentorT>
     void LawValidater<LawT, GentorT>::run()
     {
@@ -117,17 +134,32 @@
 
         // Input values that are to be generated on every iteration
         input_tuple values;
+ posix_time::ptime start, stop;
+ double validation_time = 0.0; //microseconds
 
- for(int idx=0; idx<_trialsCount; idx++)
+ for(int idx=0; idx<_trials_count; idx++)
         {
- // Apply the function SomeVale to each component of the input tuple
+ // Apply the function SomeValue to each component of the input tuple
             _gentor.template map_template<GentorT, SomeValue>(values);
             _law.setInstance(values);
 
- if(!_law.holds())
+ bool law_is_violated = false;
+ start = posix_time::ptime(posix_time::microsec_clock::local_time());
+ // In order to measure small time intervals, evaluation must be repeated.
+ for(int repeat=0; repeat<_repeat_count; repeat++)
+ law_is_violated = !_law.holds();
+
+ stop = posix_time::ptime(posix_time::microsec_clock::local_time());
+ validation_time += static_cast<double>((stop - start).total_microseconds());
+
+ if(law_is_violated)
                 _lawViolations.insert(_law);
+
         }
 
+ // Average time for one law evaluation in micro seconds
+ double avg_validation_time = validation_time/(_trials_count * _repeat_count);
+
         if(!_lawViolations.empty())
         {
             reportViolations();
@@ -146,7 +178,9 @@
         else
         {
             //reportSuccess();
- _frequencies.insert(ValidationCounterT::value_type(lawType(), 1));
+ _frequencies +=
+ ValidationCounterT::value_type(lawType(),
+ validation_counts(avg_validation_time));
         }
 
     }
@@ -178,7 +212,7 @@
     template <class LawT, template<typename>class GentorT>
     void LawValidater<LawT, GentorT>::reportSuccess()const
     {
- std::cout << "Law successfully validated for " << _trialsCount << " cases" << std::endl;
+ std::cout << "Law successfully validated for " << _trials_count << " cases" << std::endl;
     }
 
 }} // namespace itl boost

Modified: sandbox/itl/libs/validate/src/gentor/gentorprofile.cpp
==============================================================================
--- sandbox/itl/libs/validate/src/gentor/gentorprofile.cpp (original)
+++ sandbox/itl/libs/validate/src/gentor/gentorprofile.cpp 2009-07-15 07:26:38 EDT (Wed, 15 Jul 2009)
@@ -24,9 +24,57 @@
 GentorProfileSgl::GentorProfileSgl(){}
 
 
+void GentorProfile::set_defaults()
+{
+#ifdef _DEBUG
+ set_debug_defaults();
+#else
+ set_release_defaults();
+#endif
+}
+
+void GentorProfile::set_debug_defaults()
+{
+ set_range_int(-5, 5);
+ set_range_nat(0, 16);
+ set_range_double(0.0, 1.0);
+ set_range_ContainerSize(0,4);
+
+ set_range_interval_int(-5, 5);
+ set_range_interval_double(-5.0, 5.0);
+ set_maxIntervalLength(5);
+
+ set_range_element_ContainerSize(0,4);
+
+ set_repeat_count(1);
+ set_trials_count(20);
+ set_laws_per_cycle(100);
+}
+
+void GentorProfile::set_release_defaults()
+{
+ set_range_int(-5, 5);
+ set_range_nat(0, 16);
+ set_range_double(0.0, 1.0);
+ set_range_ContainerSize(0,20);
+
+ set_range_interval_int(-20, 20);
+ set_range_interval_double(-20.0, 20.0);
+ set_maxIntervalLength(10);
+
+ set_range_element_ContainerSize(0,20);
+
+ set_repeat_count(1);
+ set_trials_count(20);
+ set_laws_per_cycle(100);
+}
+
+
+
 
 GentorProfile::GentorProfile()
 {
+ set_defaults();
     //---------------------------------
     //standard values
     //set_range_int(-10, 10);
@@ -41,26 +89,30 @@
 
     //---------------------------------
     //small values
- set_range_int(-5, 5);
- set_range_nat(0, 16);
- set_range_double(0.0, 1.0);
- set_range_ContainerSize(0,4);
-
- set_range_interval_int(-5, 5);
- set_maxIntervalLength(5);
- set_range_element_ContainerSize(0,4);
-
- //---------------------------------
- //current values
     //set_range_int(-5, 5);
     //set_range_nat(0, 16);
     //set_range_double(0.0, 1.0);
- //set_range_ContainerSize(0,40);
+ //set_range_ContainerSize(0,4);
 
- //set_range_interval_int(-20, 20);
- //set_maxIntervalLength(20);
+ //set_range_interval_int(-5, 5);
+ //set_maxIntervalLength(5);
+ //set_range_element_ContainerSize(0,4);
 
- //set_range_element_ContainerSize(0,10);
+ //---------------------------------
+ //current values
+ set_range_int(-5, 5);
+ set_range_nat(0, 16);
+ set_range_double(0.0, 1.0);
+ set_range_ContainerSize(0,20);
+
+ set_range_interval_int(-20, 20);
+ set_range_interval_double(-20.0, 20.0);
+ set_maxIntervalLength(10);
+
+ set_range_element_ContainerSize(0,20);
+ set_repeat_count(1);
+ set_trials_count(50);
+ set_laws_per_cycle(100);
 
     //--------------------------------------------------------------------------
     // values for novial_tree test


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk