/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef __MINIZINC_NL_SOLVER_INSTANCE_HH__ #define __MINIZINC_NL_SOLVER_INSTANCE_HH__ #include #include #include #include #ifdef _WIN32 #undef ERROR #endif namespace MiniZinc { class NLSolverOptions : public SolverInstanceBase::Options { public: std::string nl_solver; std::vector nl_flags; std::vector nl_solver_flags; bool do_hexafloat = false; bool do_keepfile = false; }; class NLSolverInstance : public SolverInstanceBase { private: std::string _fzn_solver; protected: Model* _fzn; Model* _ozn; NLFile nl_file; public: NLSolverInstance(std::ostream& log, SolverInstanceBase::Options* opt); ~NLSolverInstance(void); Status next(void) override { return SolverInstance::Status::ERROR; } Status solve(void) override; void processFlatZinc(void) override; void resetSolver(void) override; // TODO: implement void addConstraint(const std::vector& bs, Constraint* c) override { assert(false); }; void addVariable(Variable* var, bool isOutput) override { assert(false); }; Val getSolutionValue(Variable* var) override { return Val(); }; protected: Expression* getSolutionValue(Id* id); void analyse(const Item* i); }; class NL_SolverFactory : public SolverFactory { protected: virtual SolverInstanceBase* doCreateSI(std::ostream&, SolverInstanceBase::Options* opt); public: NL_SolverFactory(void); virtual SolverInstanceBase::Options* createOptions(void); virtual std::string getDescription(SolverInstanceBase::Options* opt = NULL); virtual std::string getVersion(SolverInstanceBase::Options* opt = NULL); virtual std::string getId(void); virtual bool processOption(SolverInstanceBase::Options* opt, int& i, std::vector& argv); virtual void printHelp(std::ostream& os); // void setAcceptedFlags(SolverInstanceBase::Options* opt, const std::vector& // flags); }; } // namespace MiniZinc #endif