Browse Source

added opt dir override bitvector to multiplier

This is mainly used by the SMG model checker to override row group
optimization directions.
tempestpy_adaptions
Stefan Pranger 4 years ago
parent
commit
7abc84449b
  1. 8
      src/storm/environment/solver/MultiplierEnvironment.cpp
  2. 10
      src/storm/environment/solver/MultiplierEnvironment.h
  3. 10
      src/storm/solver/Multiplier.cpp
  4. 15
      src/storm/solver/Multiplier.h

8
src/storm/environment/solver/MultiplierEnvironment.cpp

@ -30,4 +30,12 @@ namespace storm {
typeSetFromDefault = isSetFromDefault;
}
void MultiplierEnvironment::setOptimizationDirectionOverride(storm::storage::BitVector optDirOverride) {
optimizationDirectionOverride = optDirOverride;
}
boost::optional<storm::storage::BitVector> const& MultiplierEnvironment::getOptimizationDirectionOverride() const {
return optimizationDirectionOverride;
}
}

10
src/storm/environment/solver/MultiplierEnvironment.h

@ -1,8 +1,12 @@
#pragma once
#include <boost/optional.hpp>
#include "storm/environment/solver/SolverEnvironment.h"
#include "storm/solver/SolverSelectionOptions.h"
#include "storm/storage/BitVector.h"
namespace storm {
class MultiplierEnvironment {
@ -15,9 +19,13 @@ namespace storm {
bool const& isTypeSetFromDefault() const;
void setType(storm::solver::MultiplierType value, bool isSetFromDefault = false);
void setOptimizationDirectionOverride(storm::storage::BitVector optimizationDirectionOverride);
boost::optional<storm::storage::BitVector> const& getOptimizationDirectionOverride() const;
private:
storm::solver::MultiplierType type;
bool typeSetFromDefault;
boost::optional<storm::storage::BitVector> optimizationDirectionOverride = boost::none;
};
}

10
src/storm/solver/Multiplier.cpp

@ -74,6 +74,16 @@ namespace storm {
multiplyRow(rowIndex, x2, val2);
}
template<typename ValueType>
void Multiplier<ValueType>::setOptimizationDirectionOverride(storm::storage::BitVector const& optDirOverride) {
optimizationDirectionOverride = optDirOverride;
}
template<typename ValueType>
boost::optional<storm::storage::BitVector> Multiplier<ValueType>::getOptimizationDirectionOverride() const {
return optimizationDirectionOverride;
}
template<typename ValueType>
std::unique_ptr<Multiplier<ValueType>> MultiplierFactory<ValueType>::create(Environment const& env, storm::storage::SparseMatrix<ValueType> const& matrix) {
auto type = env.solver().multiplier().getType();

15
src/storm/solver/Multiplier.h

@ -2,6 +2,9 @@
#include <vector>
#include <memory>
#include <boost/optional.hpp>
#include "storm/storage/BitVector.h"
#include "storm/solver/OptimizationDirection.h"
#include "storm/solver/MultiplicationStyle.h"
@ -134,9 +137,21 @@ namespace storm {
*/
virtual void multiplyRow2(uint64_t const& rowIndex, std::vector<ValueType> const& x1, ValueType& val1, std::vector<ValueType> const& x2, ValueType& val2) const;
/*
* TODO
*/
void setOptimizationDirectionOverride(storm::storage::BitVector const& optimizationDirectionOverride);
/*
* TODO
*/
boost::optional<storm::storage::BitVector> getOptimizationDirectionOverride() const;
protected:
mutable std::unique_ptr<std::vector<ValueType>> cachedVector;
storm::storage::SparseMatrix<ValueType> const& matrix;
boost::optional<storm::storage::BitVector> optimizationDirectionOverride = boost::none;
};
template<typename ValueType>

Loading…
Cancel
Save