4 changed files with 201 additions and 48 deletions
-
48src/adapters/HyproAdapter.h
-
40src/storage/geometry/Halfspace.h
-
88src/storage/geometry/Polytope.cpp
-
69src/storage/geometry/Polytope.h
@ -0,0 +1,48 @@ |
|||||
|
#ifndef STORM_ADAPTERS_HYPROADAPTER_H_ |
||||
|
#define STORM_ADAPTERS_HYPROADAPTER_H_ |
||||
|
|
||||
|
// Include config to know whether HyPro is available or not. |
||||
|
#include "storm-config.h" |
||||
|
|
||||
|
#ifdef STORM_HAVE_HYPRO |
||||
|
|
||||
|
#include </Users/tim/hypro/src/lib/datastructures/Halfspace.h> |
||||
|
//#include <lib/types.h> |
||||
|
#include <lib/representations/Polytope/Polytope.h> |
||||
|
|
||||
|
#include "src/adapters/CarlAdapter.h" |
||||
|
#include "src/storage/geometry/HalfSpace.h" |
||||
|
|
||||
|
namespace storm { |
||||
|
namespace adapters { |
||||
|
|
||||
|
|
||||
|
template <typename T> |
||||
|
std::vector<T> fromHypro(hypro::vector_t<T> const& v) { |
||||
|
return std::vector<T>(v.data(), v.data() + v.rows()); |
||||
|
} |
||||
|
|
||||
|
template <typename T> |
||||
|
hypro::vector_t<T> toHypro(std::vector<T> const& v) { |
||||
|
hypro::vector_t<T> res(v.size()); |
||||
|
for ( auto const& value : v){ |
||||
|
res << value; |
||||
|
} |
||||
|
return res; |
||||
|
} |
||||
|
|
||||
|
template <typename T> |
||||
|
hypro::Halfspace<T> toHypro(storm::storage::geometry::Halfspace<T> const& h){ |
||||
|
return hypro::Halfspace<T>(toHypro(h.normalVector()), h.offset()); |
||||
|
} |
||||
|
|
||||
|
template <typename T> |
||||
|
hypro::Halfspace<T> fromHypro(hypro::Halfspace<T> const& h){ |
||||
|
return storm::storage::geometry::Halfspace<T>(fromHypro(h.normal()), h.offset()); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
#endif //STORM_HAVE_HYPRO |
||||
|
|
||||
|
#endif /* STORM_ADAPTERS_HYPROADAPTER_H_ */ |
@ -1,18 +1,94 @@ |
|||||
#ifndef STORM_STORAGE_GEOMETRY_POLYTOPE_H_
|
|
||||
#define STORM_STORAGE_GEOMETRY_POLYTOPE_H_
|
|
||||
|
#include "src/storage/geometry/Polytope.h"
|
||||
|
|
||||
#include <vector>
|
|
||||
#include <memory>
|
|
||||
|
#include "src/utility/macros.h"
|
||||
|
#include "src/adapters/HyproAdapter.h"
|
||||
|
#include "src/exceptions/NotImplementedException.h"
|
||||
|
|
||||
namespace storm { |
namespace storm { |
||||
namespace storage { |
namespace storage { |
||||
namespace geometry { |
namespace geometry { |
||||
|
|
||||
|
template <typename ValueType> |
||||
|
std::shared_ptr<Polytope<ValueType>> Polytope<ValueType>::create(std::vector<storm::storage::geometry::Halfspace<ValueType>> const& halfspaces){ |
||||
|
return create(halfspaces, boost::none, false); |
||||
|
} |
||||
|
|
||||
|
template <typename ValueType> |
||||
|
std::shared_ptr<Polytope<ValueType>> Polytope<ValueType>::create(std::vector<Point> const& points){ |
||||
|
return create(boost::none, points, false); |
||||
|
} |
||||
|
|
||||
|
template <typename ValueType> |
||||
|
std::shared_ptr<Polytope<ValueType>> Polytope<ValueType>::createDownwardClosure(std::vector<Halfspace<ValueType>> const& halfspaces){ |
||||
|
return create(halfspaces, boost::none, false); |
||||
|
} |
||||
|
|
||||
|
template <typename ValueType> |
||||
|
std::shared_ptr<Polytope<ValueType>> Polytope<ValueType>::createDownwardClosure(std::vector<Point> const& points){ |
||||
|
return create(boost::none, points, true); |
||||
} |
} |
||||
|
|
||||
|
template <typename ValueType> |
||||
|
std::shared_ptr<Polytope<ValueType>> Polytope<ValueType>::create(boost::optional<std::vector<Halfspace<ValueType>>> const& halfspaces, |
||||
|
boost::optional<std::vector<Point>> const& points, |
||||
|
bool downwardClosure) { |
||||
|
|
||||
|
#ifdef STORM_HAVE_HYPRO
|
||||
|
std::cout << "HyPro available!!" << std::endl; |
||||
|
// return std::make_shared(HyproPolytope<ValueType>(halfspaces, points, downwardClosure));
|
||||
|
#endif
|
||||
|
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "No polytope implementation specified."); |
||||
|
return nullptr; |
||||
|
} |
||||
|
|
||||
|
template <typename ValueType> |
||||
|
std::vector<typename Polytope<ValueType>::Point> Polytope<ValueType>::getVertices(){ |
||||
|
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Functionality not implemented."); |
||||
|
} |
||||
|
|
||||
|
template <typename ValueType> |
||||
|
std::vector<Halfspace<ValueType>> Polytope<ValueType>::getHalfspaces(){ |
||||
|
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Functionality not implemented."); |
||||
|
} |
||||
|
|
||||
|
template <typename ValueType> |
||||
|
bool Polytope<ValueType>::contains(Point const& point) const{ |
||||
|
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Functionality not implemented."); |
||||
|
} |
||||
|
|
||||
|
template <typename ValueType> |
||||
|
std::shared_ptr<Polytope<ValueType>> Polytope<ValueType>::intersect(std::shared_ptr<Polytope<ValueType>> const& rhs) const{ |
||||
|
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Functionality not implemented."); |
||||
|
} |
||||
|
template <typename ValueType> |
||||
|
std::shared_ptr<Polytope<ValueType>> Polytope<ValueType>::intersect(Halfspace<ValueType> const& rhs) const{ |
||||
|
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Functionality not implemented."); |
||||
|
} |
||||
|
|
||||
|
template <typename ValueType> |
||||
|
std::shared_ptr<Polytope<ValueType>> Polytope<ValueType>::convexUnion(std::shared_ptr<Polytope<ValueType>> const& rhs) const{ |
||||
|
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Functionality not implemented."); |
||||
|
} |
||||
|
template <typename ValueType> |
||||
|
std::shared_ptr<Polytope<ValueType>> Polytope<ValueType>::convexUnion(Point const& rhs) const{ |
||||
|
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Functionality not implemented."); |
||||
|
} |
||||
|
|
||||
|
template <typename ValueType> |
||||
|
std::shared_ptr<Polytope<ValueType>> Polytope<ValueType>::bloat(Point const& point1, Point const& point2) const{ |
||||
|
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Functionality not implemented."); |
||||
} |
} |
||||
} |
|
||||
|
|
||||
#endif /* STORM_STORAGE_GEOMETRY_POLYTOPE_H_ */
|
|
||||
|
|
||||
|
template <typename ValueType> |
||||
|
std::string Polytope<ValueType>::toString() const{ |
||||
|
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Functionality not implemented."); |
||||
|
} |
||||
|
|
||||
|
template class Polytope<double>; |
||||
|
#ifdef STORM_HAVE_CARL
|
||||
|
template class Polytope<storm::RationalNumber>; |
||||
|
#endif
|
||||
|
} |
||||
|
} |
||||
|
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue