main.cpp
Go to the documentation of this file.
00001 // 
00002 // Copyright (c) 2009, Benjamin Kaufmann
00003 // 
00004 // This file is part of Clasp. See http://www.cs.uni-potsdam.de/clasp/ 
00005 // 
00006 // Clasp is free software; you can redistribute it and/or modify
00007 // it under the terms of the GNU General Public License as published by
00008 // the Free Software Foundation; either version 2 of the License, or
00009 // (at your option) any later version.
00010 // 
00011 // Clasp is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 // GNU General Public License for more details.
00015 // 
00016 // You should have received a copy of the GNU General Public License
00017 // along with Clasp; if not, write to the Free Software
00018 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00019 //
00020 #include "example.h"
00021 #include <clasp/enumerator.h>
00022 #include <clasp/Solver.h>
00023 void printModel(const Clasp::SymbolTable& symTab, const Clasp::Model& model) {
00024         std::cout << "Model " << model.num << ": \n";
00025         // Print each named atom that is true w.r.t the current model.
00026         for (Clasp::SymbolTable::const_iterator it = symTab.begin(); it != symTab.end(); ++it) {
00027                 if (model.isTrue(it->second.lit) && !it->second.name.empty()) {
00028                         std::cout << it->second.name.c_str() << " ";
00029                 }
00030         }
00031         std::cout << std::endl;
00032 }
00033 
00034 #define RUN(x) try { std::cout << "*** Running " << static_cast<const char*>(#x) << " ***" << std::endl; x(); } catch (const std::exception& e) { std::cout << " *** ERROR: " << e.what() << std::endl; }
00035 
00036 int main() {
00037         RUN(example1);
00038         RUN(example2);
00039 #if WITH_THREADS
00040         RUN(example3);
00041 #endif
00042 }


clasp
Author(s): Benjamin Kaufmann
autogenerated on Thu Aug 27 2015 12:41:39