From: <koc...@us...> - 2010-01-25 14:30:22
|
Revision: 556 http://scstudio.svn.sourceforge.net/scstudio/?rev=556&view=rev Author: kocianon Date: 2010-01-25 12:39:19 +0000 (Mon, 25 Jan 2010) Log Message: ----------- tightening fix, still missing right return stutas, 70% done, fixed errer with time interval (-inf,inf) Modified Paths: -------------- trunk/src/check/time/tightening.cpp trunk/src/check/time/tightening.h trunk/src/check/time/time_pseudocode.h trunk/src/data/time.cpp trunk/src/data/time.h Modified: trunk/src/check/time/tightening.cpp =================================================================== --- trunk/src/check/time/tightening.cpp 2010-01-21 15:26:03 UTC (rev 555) +++ trunk/src/check/time/tightening.cpp 2010-01-25 12:39:19 UTC (rev 556) @@ -57,10 +57,9 @@ DEBUG(m_matrix_to_tight); if(m_con_checker->check_consistency(m_matrix_simple)){ move_forward(); - DEBUG_(m_row,m_col); } - else - std::cerr << "NOOOO" << std::endl; + else // not consistent + m_inconsis_mtxs.push_back(m_matrix_simple); // clean up: push back previous values if(m_row==m_col) { @@ -100,7 +99,11 @@ void MscSolveTCSP::tight() { + //tight IntervalMatrix tmp = m_tightener->tight(m_matrix_simple); + // remember both + m_csp_mtxs.push_back(m_matrix_simple); + m_csp_tighten_mtxs.push_back(tmp); //add results the "Result interval set matrix" for(unsigned g=0;g<m_size;g++) for(unsigned h=0;h<m_size;h++) @@ -122,8 +125,6 @@ insert_interval(); } - - /////////////////////////////////////////////////////////////////// MscTimeIntervalSetD TightenBMsc::get_max_interval(BMscIntervalSetMatrix bmsc_matrix) @@ -241,8 +242,17 @@ BMscPtr BMscTighter::transform(BMscPtr bmsc) { BMscIntervalSetMatrix matrix(bmsc); - matrix = MscSolveTCSP::solve(matrix); - return matrix.get_modified_bmsc(); + MscSolveTCSP solve; + solve.solveTCSP(matrix); + if(solve.get_csp_mtxs().size()!=0) // there was at least one matrix + { + matrix = solve.get_matrix_result(); + return matrix.get_modified_bmsc(); + } + else + { + return matrix.get_modified_bmsc(); + } } // $Id$ Modified: trunk/src/check/time/tightening.h =================================================================== --- trunk/src/check/time/tightening.h 2010-01-21 15:26:03 UTC (rev 555) +++ trunk/src/check/time/tightening.h 2010-01-25 12:39:19 UTC (rev 556) @@ -23,6 +23,7 @@ #include "time_pseudocode.h" #include "check/pseudocode/msc_duplicators.h" #include "data/transformer.h" +#include <vector> struct stat; typedef std::pair<Event*,Event*> EventPair; @@ -43,12 +44,20 @@ IntervalSetMatrix m_matrix_to_tight; // matrix recieved to be tought IntervalSetMatrix m_matrix_result; // matrix with results from tightening - IntervalMatrix m_matrix_simple; // CPS matrix + IntervalMatrix m_matrix_simple; // CSP matrix unsigned m_size; unsigned m_row; // row of processing cell unsigned m_col; // column of processing cell + // array of inconsistent matrices + std::vector<IntervalMatrix> m_inconsis_mtxs; + // csp matrices that were put together + std::vector<IntervalMatrix> m_csp_mtxs; + // tighten version of csp matrices + // m_csp_tighten_mtxs[x]=tight(m_csp_mtxs[x]) + std::vector<IntervalMatrix> m_csp_tighten_mtxs; + /** * \brief Resize matrices and push default values * \param size to resize matrix to @@ -75,30 +84,53 @@ //! tight m_matrix_simple and add result to m_matrix_result void tight(); - //! main function, first to call - void solveTCSP(const IntervalSetMatrix matrix); - protected: + +public: MscSolveTCSP(): m_tightener(new FloydWarshall()), m_con_checker(new FloydWarshall()) { } + ~MscSolveTCSP() { delete m_tightener; delete m_con_checker; } -public: + //! main function, first to call + void solveTCSP(const IntervalSetMatrix matrix); + + static IntervalSetMatrix solve(const IntervalSetMatrix matrix) { MscSolveTCSP tcsp; tcsp.solveTCSP(matrix); return tcsp.m_matrix_result; } + + const std::vector<IntervalMatrix>& get_inconsis_mtxs() + { + return m_inconsis_mtxs; + } + + const std::vector<IntervalMatrix>& get_csp_mtxs() + { + return m_csp_mtxs; + } + + const std::vector<IntervalMatrix>& get_csp_tighten_mtxs() + { + return m_csp_tighten_mtxs; + } + + const IntervalSetMatrix& get_matrix_result() + { + return m_matrix_result; + } }; /** Modified: trunk/src/check/time/time_pseudocode.h =================================================================== --- trunk/src/check/time/time_pseudocode.h 2010-01-21 15:26:03 UTC (rev 555) +++ trunk/src/check/time/time_pseudocode.h 2010-01-25 12:39:19 UTC (rev 556) @@ -121,6 +121,8 @@ { private: BMscPtr m_original_bmsc; + IntervalSetMatrix m_original_matrix; + AllReachableEventPVector m_events; //! Vector of all events: event=matrix[number] std::map<EventP,unsigned> m_event_number; //! the number of event in the matrix @@ -155,6 +157,7 @@ m_event_number[*it]=i; } build_up_matrix(); + m_original_matrix = *this; } /* BMscIntervalSetMatrix(const BMscIntervalSetMatrix& matrix): Modified: trunk/src/data/time.cpp =================================================================== --- trunk/src/data/time.cpp 2010-01-21 15:26:03 UTC (rev 555) +++ trunk/src/data/time.cpp 2010-01-25 12:39:19 UTC (rev 556) @@ -102,12 +102,28 @@ MscIntervalCouple<double>::MscIntervalCouple(const bool& b,const double& d): m_closed(b) ,m_value(d) - { - if(m_value==std::numeric_limits<double>::infinity() || m_value==-std::numeric_limits<double>::infinity()) - m_closed=false; - std::cerr << "MUHAHAHAHAHAHAHAH" << std::endl; - } +{ + // -inf,inf has to have _close value false to be valid --> REWRITTING! + if(m_value==std::numeric_limits<double>::infinity() || m_value==-std::numeric_limits<double>::infinity()) + m_closed=false; +} + +template <> +MscIntervalCouple<DecScaled>::MscIntervalCouple(const bool& b,const DecScaled& d): + m_closed(b) + ,m_value(d) +{ +} +/* + +template class SCMSC_EXPORT MscTimeInterval<double>; +template class SCMSC_EXPORT MscTimeInterval<DecScaled>; +*/ template class SCMSC_EXPORT MscIntervalCouple<double>; +template class SCMSC_EXPORT MscTimeIntervalSet<double>; +template class SCMSC_EXPORT MscTimeIntervalSet<DecScaled>; + + // template class SCMSC_EXPORT MscIntervalCouple<DecScaled>; // $Id$ Modified: trunk/src/data/time.h =================================================================== --- trunk/src/data/time.h 2010-01-21 15:26:03 UTC (rev 555) +++ trunk/src/data/time.h 2010-01-25 12:39:19 UTC (rev 556) @@ -348,12 +348,7 @@ MscIntervalCouple(const std::string&,const bool&); - MscIntervalCouple(const bool& b,const T& d): - m_closed(b) - ,m_value(d) - { - std::cerr << "BLEEEEEE" << std::endl; - } + MscIntervalCouple(const bool& b,const T& d); const bool& get_closed() const { @@ -977,8 +972,6 @@ }; //end of MscTimeInterval class -template class SCMSC_EXPORT MscTimeInterval<double>; -template class SCMSC_EXPORT MscTimeInterval<DecScaled>; /** * \brief List of intervals @@ -1357,10 +1350,7 @@ }; -template class SCMSC_EXPORT MscTimeIntervalSet<double>; -template class SCMSC_EXPORT MscTimeIntervalSet<DecScaled>; - #endif // _TIME_H_ // $Id$ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |