A set of benchmarks to compare a new prototype MiniZinc implementation
1/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */ 2 3/* 4 * Main authors: 5 * Guido Tack <guido.tack@monash.edu> 6 * Graeme Gange <graeme.gange@monash.edu> 7 */ 8 9/* This Source Code Form is subject to the terms of the Mozilla Public 10 * License, v. 2.0. If a copy of the MPL was not distributed with this 11 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 12 13#ifndef __MINIZINC_READER_HH__ 14#define __MINIZINC_READER_HH__ 15 16#include <minizinc/ast.hh> 17#include <minizinc/exception.hh> 18#include <minizinc/solver_config.hh> 19 20#include <iostream> 21#include <memory> 22#include <string> 23#include <vector> 24 25namespace MiniZinc { 26// Class MznReader handles option handling and model parsing. 27// Essentiially the first half of the MznSolver object. 28class MznReader { 29private: 30 /// Solver configurations 31 SolverConfigs solver_configs; 32 33 std::string executable_name; 34 std::ostream& os; 35 std::ostream& log; 36 37public: 38 enum OptionStatus { OPTION_OK, OPTION_ERROR, OPTION_FINISH }; 39 // Search paths 40 std::vector<std::string> filenames; 41 std::vector<std::string> datafiles; 42 std::vector<std::string> includePaths; 43 44 std::string std_lib_dir; 45 std::string globals_dir; 46 47 /// global options 48 bool flag_verbose = false; 49 bool flag_statistics = false; 50 /* 51 bool flag_compiler_verbose=false; 52 bool flag_compiler_statistics=false; 53 int flag_overall_time_limit=0; 54 */ 55 56 bool flag_ignoreStdlib = false; 57 bool flag_typecheck = true; 58 bool flag_werror = false; 59 bool flag_only_range_domains = false; 60 bool flag_allow_unbounded_vars = false; 61 bool flag_stdinInput = false; 62 63 // Timer starttime; 64 65public: 66 MznReader(std::ostream& os = std::cout, std::ostream& log = std::cerr); 67 ~MznReader(); 68 69 Model* read(const std::string& modelString = std::string(), 70 const std::string& modelName = std::string("stdin")); 71 OptionStatus processOptions(std::vector<std::string>& argv); 72 bool get_flag_verbose() { return flag_verbose; } 73 void printUsage(); 74 75private: 76 bool processOption(int& i, std::vector<std::string>& argv); 77 78 void printHelp(const std::string& selectedSolver = std::string()); 79 void printStatistics(); 80 81 bool get_flag_statistics() { return flag_statistics; } 82}; 83 84} // namespace MiniZinc 85 86#endif