|
From: <chr...@us...> - 2012-02-23 13:44:48
|
Revision: 3562
http://dlvhex.svn.sourceforge.net/dlvhex/?rev=3562&view=rev
Author: chrisr86
Date: 2012-02-23 13:44:37 +0000 (Thu, 23 Feb 2012)
Log Message:
-----------
add simple rule for global learning
Modified Paths:
--------------
dlvhex/branches/dlvhex-refactoring/include/dlvhex2/BaseModelGenerator.h
dlvhex/branches/dlvhex-refactoring/src/BaseModelGenerator.cpp
dlvhex/branches/dlvhex-refactoring/src/GenuinePlainModelGenerator.cpp
Modified: dlvhex/branches/dlvhex-refactoring/include/dlvhex2/BaseModelGenerator.h
===================================================================
--- dlvhex/branches/dlvhex-refactoring/include/dlvhex2/BaseModelGenerator.h 2012-02-23 13:37:53 UTC (rev 3561)
+++ dlvhex/branches/dlvhex-refactoring/include/dlvhex2/BaseModelGenerator.h 2012-02-23 13:44:37 UTC (rev 3562)
@@ -106,7 +106,7 @@
// converts an interpretation into a nogood
Nogood interpretationToNogood(InterpretationConstPtr intr, NogoodContainer& ngContainer);
- void globalConflictAnalysis(ProgramCtx& ctx, const std::vector<ID>& idb, GenuineSolverPtr solver);
+ void globalConflictAnalysis(ProgramCtx& ctx, const std::vector<ID>& idb, GenuineSolverPtr solver, bool componentIsMonotonic);
// ========== ==========
Modified: dlvhex/branches/dlvhex-refactoring/src/BaseModelGenerator.cpp
===================================================================
--- dlvhex/branches/dlvhex-refactoring/src/BaseModelGenerator.cpp 2012-02-23 13:37:53 UTC (rev 3561)
+++ dlvhex/branches/dlvhex-refactoring/src/BaseModelGenerator.cpp 2012-02-23 13:44:37 UTC (rev 3562)
@@ -208,17 +208,20 @@
return ng;
}
-void BaseModelGenerator::globalConflictAnalysis(ProgramCtx& ctx, const std::vector<ID>& idb, GenuineSolverPtr solver){
+void BaseModelGenerator::globalConflictAnalysis(ProgramCtx& ctx, const std::vector<ID>& idb, GenuineSolverPtr solver, bool componentIsMonotonic){
DBGLOG(DBG, "Global conflict analysis");
if (solver->getModelCount() == 0 && ctx.config.getOption("GlobalLearning")){
DBGLOG(DBG, "Contradiction on first model: Component is inconsistent wrt. input");
- Nogood gng;
- if (input != InterpretationConstPtr()){
- gng = interpretationToNogood(restrictInterpretationToPredicates(ctx.registry(), input, getPredicates(ctx.registry(), ctx.edb, idb)), ctx.globalNogoods);
+ if (componentIsMonotonic){
+ DBGLOG(DBG, "Component is monotonic");
+ Nogood gng;
+ if (input != InterpretationConstPtr()){
+ gng = interpretationToNogood(restrictInterpretationToPredicates(ctx.registry(), input, getPredicates(ctx.registry(), ctx.edb, idb)), ctx.globalNogoods);
+ }
+ DBGLOG(DBG, "Generating global nogood " << gng);
+ ctx.globalNogoods.addNogood(gng);
}
- DBGLOG(DBG, "Generating global nogood " << gng);
- ctx.globalNogoods.addNogood(gng);
}
}
Modified: dlvhex/branches/dlvhex-refactoring/src/GenuinePlainModelGenerator.cpp
===================================================================
--- dlvhex/branches/dlvhex-refactoring/src/GenuinePlainModelGenerator.cpp 2012-02-23 13:37:53 UTC (rev 3561)
+++ dlvhex/branches/dlvhex-refactoring/src/GenuinePlainModelGenerator.cpp 2012-02-23 13:44:37 UTC (rev 3562)
@@ -200,7 +200,7 @@
// learn global nogoods
if (modelCandidate == InterpretationPtr()){
- globalConflictAnalysis(factory.ctx, factory.idb, solver);
+ globalConflictAnalysis(factory.ctx, factory.idb, solver, !factory.ci.disjunctiveHeads && !factory.ci.negationInCycles && !factory.ci.innerEatomsNonmonotonic && !factory.ci.outerEatomsNonmonotonic);
}
DBGLOG(DBG, "Statistics:" << std::endl << solver->getStatistics());
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|