#ifndef STORM_UTILITY_SOLVER_H_ #define STORM_UTILITY_SOLVER_H_ #include #include #include #include #include "src/storage/dd/DdType.h" #include "src/solver/SolverSelectionOptions.h" namespace storm { namespace solver { template class SymbolicGameSolver; template class SymbolicLinearEquationSolver; template class SymbolicMinMaxLinearEquationSolver; template class GameSolver; template class LinearEquationSolver; template class MinMaxLinearEquationSolver; class LpSolver; class SmtSolver; template class NativeLinearEquationSolver; enum class NativeLinearEquationSolverSolutionMethod; } namespace storage { template class SparseMatrix; } namespace dd { template class Add; template class Bdd; } namespace expressions { class Variable; class ExpressionManager; } namespace utility { namespace solver { template class SymbolicLinearEquationSolverFactory { public: virtual std::unique_ptr> create(storm::dd::Add const& A, storm::dd::Bdd const& allRows, std::set const& rowMetaVariables, std::set const& columnMetaVariables, std::vector> const& rowColumnMetaVariablePairs) const; }; template class SymbolicMinMaxLinearEquationSolverFactory { public: virtual std::unique_ptr> create(storm::dd::Add const& A, storm::dd::Bdd const& allRows, storm::dd::Bdd const& illegalMask, std::set const& rowMetaVariables, std::set const& columnMetaVariables, std::set const& choiceVariables, std::vector> const& rowColumnMetaVariablePairs) const; }; template class SymbolicGameSolverFactory { public: virtual std::unique_ptr> create(storm::dd::Add const& A, storm::dd::Bdd const& allRows, std::set const& rowMetaVariables, std::set const& columnMetaVariables, std::vector> const& rowColumnMetaVariablePairs, std::set const& player1Variables, std::set const& player2Variables) const; }; template class LinearEquationSolverFactory { public: /*! * Creates a new linear equation solver instance with the given matrix. * * @param matrix The matrix that defines the equation system. * @return A pointer to the newly created solver. */ virtual std::unique_ptr> create(storm::storage::SparseMatrix const& matrix) const; }; template class NativeLinearEquationSolverFactory : public LinearEquationSolverFactory { public: NativeLinearEquationSolverFactory(); NativeLinearEquationSolverFactory(typename storm::solver::NativeLinearEquationSolverSolutionMethod method, ValueType omega); virtual std::unique_ptr> create(storm::storage::SparseMatrix const& matrix) const override; private: typename storm::solver::NativeLinearEquationSolverSolutionMethod method; ValueType omega; }; template class GmmxxLinearEquationSolverFactory : public LinearEquationSolverFactory { public: virtual std::unique_ptr> create(storm::storage::SparseMatrix const& matrix) const override; }; template class MinMaxLinearEquationSolverFactory { public: MinMaxLinearEquationSolverFactory(storm::solver::EquationSolverTypeSelection solverType = storm::solver::EquationSolverTypeSelection::FROMSETTINGS); /*! * Creates a new min/max linear equation solver instance with the given matrix. */ virtual std::unique_ptr> create(storm::storage::SparseMatrix const& matrix, bool trackScheduler = false) const; MinMaxLinearEquationSolverFactory& setSolverType(storm::solver::EquationSolverTypeSelection solverType); MinMaxLinearEquationSolverFactory& setPreferredTechnique(storm::solver::MinMaxTechniqueSelection); protected: /// The type of solver which should be created. storm::solver::EquationSolverType solverType; /// The preferred technique to be used by the solver. /// Notice that we save the selection enum here, which allows different solvers to use different techniques. storm::solver::MinMaxTechniqueSelection prefTech; }; template class GameSolverFactory { public: /*! * Creates a new game solver instance with the given matrices. */ virtual std::unique_ptr> create(storm::storage::SparseMatrix const& player1Matrix, storm::storage::SparseMatrix const& player2Matrix) const; }; class LpSolverFactory { public: /*! * Creates a new linear equation solver instance with the given name. * * @param name The name of the LP solver. * @return A pointer to the newly created solver. */ virtual std::unique_ptr create(std::string const& name) const; virtual std::unique_ptr create(std::string const& name, storm::solver::LpSolverTypeSelection solvType) const; }; class GlpkLpSolverFactory : public LpSolverFactory { public: virtual std::unique_ptr create(std::string const& name) const override; }; class GurobiLpSolverFactory : public LpSolverFactory { public: virtual std::unique_ptr create(std::string const& name) const override; }; std::unique_ptr getLpSolver(std::string const& name, storm::solver::LpSolverTypeSelection solvType = storm::solver::LpSolverTypeSelection::FROMSETTINGS) ; class SmtSolverFactory { public: /*! * Creates a new SMT solver instance. * * @param manager The expression manager responsible for the expressions that will be given to the SMT * solver. * @return A pointer to the newly created solver. */ virtual std::unique_ptr create(storm::expressions::ExpressionManager& manager) const; }; class Z3SmtSolverFactory : public SmtSolverFactory { public: virtual std::unique_ptr create(storm::expressions::ExpressionManager& manager) const; }; class MathsatSmtSolverFactory : public SmtSolverFactory { public: virtual std::unique_ptr create(storm::expressions::ExpressionManager& manager) const; }; std::unique_ptr getSmtSolver(storm::expressions::ExpressionManager& manager); } } } #endif /* STORM_UTILITY_SOLVER_H_ */