[Fawkes Git] branch/bschaepers/asp-aspect: ASP-Aspect: Add enumerator for the found models.

Bjoern Schaepers bjoern.schaepers at rwth-aachen.de
Fri Dec 2 16:46:43 CET 2016


Changes have been pushed for the project "Fawkes Robotics Software Framework".

Gitweb: http://git.fawkesrobotics.org/fawkes.git
Trac:   http://trac.fawkesrobotics.org

The branch, bschaepers/asp-aspect has been updated
        to  0d313da6eb1e98340392de6ae0e415807c95290a (commit)
      from  0c578f53763afea4bf9ef222b054f1b5cfa0a8e3 (commit)

http://git.fawkesrobotics.org/fawkes.git/bschaepers/asp-aspect

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- *Log* ---------------------------------------------------------------
commit 0d313da6eb1e98340392de6ae0e415807c95290a
Author:     Bjoern Schaepers <bjoern.schaepers at rwth-aachen.de>
AuthorDate: Fri Dec 2 16:46:20 2016 +0100
Commit:     Bjoern Schaepers <bjoern.schaepers at rwth-aachen.de>
CommitDate: Fri Dec 2 16:46:20 2016 +0100

    ASP-Aspect: Add enumerator for the found models.

http://git.fawkesrobotics.org/fawkes.git/commit/0d313da
http://trac.fawkesrobotics.org/changeset/0d313da

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


- *Summary* -----------------------------------------------------------
 src/plugins/asp/aspect/clingo_access.cpp |    8 +++++++-
 src/plugins/asp/aspect/clingo_access.h   |    1 +
 2 files changed, 8 insertions(+), 1 deletions(-)


- *Diffs* -------------------------------------------------------------

- *commit* 0d313da6eb1e98340392de6ae0e415807c95290a - - - - - - - - - -
Author:  Bjoern Schaepers <bjoern.schaepers at rwth-aachen.de>
Date:    Fri Dec 2 16:46:20 2016 +0100
Subject: ASP-Aspect: Add enumerator for the found models.

 src/plugins/asp/aspect/clingo_access.cpp |    8 +++++++-
 src/plugins/asp/aspect/clingo_access.h   |    1 +
 2 files changed, 8 insertions(+), 1 deletions(-)

_Diff for modified files_:
diff --git a/src/plugins/asp/aspect/clingo_access.cpp b/src/plugins/asp/aspect/clingo_access.cpp
index 7cd4cc7..23fdd09 100644
--- a/src/plugins/asp/aspect/clingo_access.cpp
+++ b/src/plugins/asp/aspect/clingo_access.cpp
@@ -56,6 +56,10 @@ namespace fawkes {
  * @property ClingoAccess::OldSymbols
  * @brief The symbols found in the before last model.
  *
+ * @property ClingoAccess::ModelCounter
+ * @brief Counts how many models we have computed for one solving process.
+ *
+ *
  * @property ClingoAccess::Solving
  * @brief Whether the control is in the solving process.
  *
@@ -89,7 +93,7 @@ ClingoAccess::newModel(const Clingo::Model& model)
 
 	if ( Debug )
 	{
-		Log->log_info(LogComponent.c_str(), "New model found.");
+		Log->log_info(LogComponent.c_str(), "New model found: #%d", ++ModelCounter);
 
 		/* To save (de-)allocations just move found symbols at the end of the vector and move the end iterator to the
 		 * front. After this everything in [begin, end) is in oldSymbols but not in symbols. */
@@ -287,6 +291,7 @@ ClingoAccess::startSolving(void)
 		Log->log_info(LogComponent.c_str(), "Start async solving.");
 	} //if ( Debug )
 	Solving = true;
+	ModelCounter = 0;
 	Control->solve_async([this](const Clingo::Model& model) { return newModel(model); },
 		[this](const Clingo::SolveResult& result) { solvingFinished(result); return; });
 	return true;
@@ -311,6 +316,7 @@ ClingoAccess::startSolvingBlocking(void)
 		Log->log_info(LogComponent.c_str(), "Start sync solving.");
 	} //if ( Debug )
 	Solving = true;
+	ModelCounter = 0;
 	const auto result(Control->solve([this,&locker](const Clingo::Model& model) {
 		locker.unlock();
 		const auto ret = newModel(model);
diff --git a/src/plugins/asp/aspect/clingo_access.h b/src/plugins/asp/aspect/clingo_access.h
index 9b3c7e8..0651d7b 100644
--- a/src/plugins/asp/aspect/clingo_access.h
+++ b/src/plugins/asp/aspect/clingo_access.h
@@ -47,6 +47,7 @@ class ClingoAccess
 	mutable Mutex ControlMutex;
 	Clingo::Control *Control;
 	Clingo::SymbolVector ModelSymbols, OldSymbols;
+	unsigned int ModelCounter;
 
 	std::atomic_bool Solving;
 	mutable Mutex CallbackMutex;




-- 
Fawkes Robotics Framework                 http://www.fawkesrobotics.org


More information about the fawkes-commits mailing list