1
0
This repository has been archived on 2025-03-06. You can view files and clone it, but cannot push or open issues or pull requests.
Jip J. Dekker f2a1c4e389 Squashed 'software/mza/' content from commit f970a59b17
git-subtree-dir: software/mza
git-subtree-split: f970a59b177c13ca3dd8aaef8cc6681d83b7e813
2021-07-11 16:34:30 +10:00

75 lines
2.2 KiB
C++

/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
* Main authors:
* Guido Tack <guido.tack@monash.edu>
*/
/* 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_MZN_SOLVER_INSTANCE_HH__
#define __MINIZINC_MZN_SOLVER_INSTANCE_HH__
#include <minizinc/solver.hh>
namespace MiniZinc {
class MZNSolverOptions : public SolverInstanceBase::Options {
public:
std::string mzn_solver;
std::vector<std::string> mzn_flags;
int numSols = 1;
bool allSols = false;
std::string parallel;
int mzn_time_limit_ms = 0;
int solver_time_limit_ms = 0;
bool mzn_sigint = false;
bool supports_t = false;
std::vector<MZNFZNSolverFlag> mzn_solver_flags;
};
class MZNSolverInstance : public SolverInstanceBase {
private:
std::string _mzn_solver;
public:
MZNSolverInstance(std::ostream& log, SolverInstanceBase::Options* opt);
~MZNSolverInstance(void);
Status next(void) override { return SolverInstance::ERROR; }
Status solve(void) override;
void processFlatZinc(void) override;
// TODO:
void addConstraint(const std::vector<BytecodeProc>& bs, Constraint* c) override{};
void addVariable(Variable* var, bool isOuput) override{};
Val getSolutionValue(Variable* var) override { return Val(); };
void resetSolver(void) override;
};
class MZN_SolverFactory : public SolverFactory {
protected:
virtual SolverInstanceBase* doCreateSI(std::ostream& log, SolverInstanceBase::Options* opt);
public:
MZN_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<std::string>& argv);
virtual void printHelp(std::ostream& os);
void setAcceptedFlags(SolverInstanceBase::Options* opt,
const std::vector<MZNFZNSolverFlag>& flags);
};
} // namespace MiniZinc
#endif