this repo has no description
at develop 1.4 kB view raw
1/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */ 2 3/* 4 * Main authors: 5 * Gleb Belov <gleb.belov@monash.edu> 6 */ 7 8/* This Source Code Form is subject to the terms of the Mozilla Public 9 * License, v. 2.0. If a copy of the MPL was not distributed with this 10 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 11 12/* This (main) file coordinates flattening and solving. 13 * The corresponding modules are flexibly plugged in 14 * as derived classes, prospectively from DLLs. 15 * A flattening module should provide MinZinc::GetFlattener() 16 * A solving module should provide an object of a class derived from SolverFactory. 17 * Need to get more flexible for multi-pass & multi-solving stuff TODO 18 */ 19 20#include <minizinc/solver.hh> 21 22#include <iostream> 23 24using namespace std; 25using namespace MiniZinc; 26 27int main(int argc, const char** argv) { 28 std::vector<std::string> args; 29 for (int i = 1; i < argc; ++i) { 30 args.emplace_back(argv[i]); 31 } 32 33 try { 34 MznSolver slv(args); 35 auto result = slv.run(); 36 std::cout << result.second; 37 } catch (const LocationException& e) { 38 std::cerr << std::endl; 39 std::cerr << e.loc() << ":" << std::endl; 40 std::cerr << e.what() << ": " << e.msg() << std::endl; 41 } catch (const Exception& e) { 42 std::cerr << std::endl; 43 std::string what = e.what(); 44 std::cerr << what << (what.empty() ? "" : ": ") << e.msg() << std::endl; 45 } 46 return 0; 47}