Browse Source
Helper functions for parametric stuff
Helper functions for parametric stuff
Former-commit-id: 288e4de3da
tempestpy_adaptions
TimQu
9 years ago
4 changed files with 113 additions and 2 deletions
-
19src/utility/constants.cpp
-
3src/utility/constants.h
-
39src/utility/parametric.cpp
-
54src/utility/parametric.h
@ -0,0 +1,39 @@ |
|||
/*
|
|||
* File: parametric.cpp |
|||
* Author: Tim Quatmann |
|||
* |
|||
* Created by Tim Quatmann on 08/03/16. |
|||
*/ |
|||
|
|||
#include <string>
|
|||
|
|||
#include "src/utility/parametric.h"
|
|||
#include "src/utility/constants.h"
|
|||
#include "src/utility/macros.h"
|
|||
#include "src/settings/SettingsManager.h"
|
|||
#include "src/exceptions/IllegalArgumentException.h"
|
|||
#include "src/exceptions/NotImplementedException.h"
|
|||
|
|||
#ifdef STORM_HAVE_CARL
|
|||
#include<carl/numbers/numbers.h>
|
|||
#include<carl/core/VariablePool.h>
|
|||
#endif
|
|||
|
|||
namespace storm { |
|||
namespace utility{ |
|||
namespace parametric { |
|||
|
|||
#ifdef STORM_HAVE_CARL
|
|||
template<> |
|||
typename CoefficientType<storm::RationalFunction>::type evaluate<storm::RationalFunction>(storm::RationalFunction const& function, std::map<typename VariableType<storm::RationalFunction>::type, typename CoefficientType<storm::RationalFunction>::type> const& valuation){ |
|||
return function.evaluate(valuation); |
|||
} |
|||
|
|||
template<> |
|||
typename CoefficientType<storm::RationalFunction>::type getConstantPart<storm::RationalFunction>(storm::RationalFunction const& function){ |
|||
return function.constantPart(); |
|||
} |
|||
#endif
|
|||
} |
|||
} |
|||
} |
@ -0,0 +1,54 @@ |
|||
// |
|||
// parametric.h |
|||
// |
|||
// Created by Tim Quatmann on 08/03/16. |
|||
// |
|||
// |
|||
|
|||
#ifndef STORM_UTILITY_PARAMETRIC_H |
|||
#define STORM_UTILITY_PARAMETRIC_H |
|||
|
|||
#include "src/adapters/CarlAdapter.h" |
|||
|
|||
|
|||
namespace storm { |
|||
namespace utility { |
|||
namespace parametric { |
|||
|
|||
/*! |
|||
* Access the type of variables from a given function type |
|||
*/ |
|||
template<typename FunctionType> |
|||
struct VariableType { typedef void type; }; |
|||
/*! |
|||
* Acess the type of coefficients from a given function type |
|||
*/ |
|||
template<typename FunctionType> |
|||
struct CoefficientType { typedef void type; }; |
|||
|
|||
#ifdef STORM_HAVE_CARL |
|||
template<> |
|||
struct VariableType<storm::RationalFunction> { typedef storm::Variable type; }; |
|||
template<> |
|||
struct CoefficientType<storm::RationalFunction> { typedef storm::RationalNumber type; }; |
|||
#endif |
|||
|
|||
/*! |
|||
* Evaluates the given function wrt. the given valuation |
|||
*/ |
|||
template<typename FunctionType> |
|||
typename CoefficientType<FunctionType>::type evaluate(FunctionType const& function, std::map<typename VariableType<FunctionType>::type, typename CoefficientType<FunctionType>::type> const& valuation); |
|||
|
|||
/*! |
|||
* Retrieves the constant part of the given function. |
|||
*/ |
|||
template<typename FunctionType> |
|||
typename CoefficientType<FunctionType>::type getConstantPart(FunctionType const& function); |
|||
|
|||
} |
|||
|
|||
} |
|||
} |
|||
|
|||
|
|||
#endif /* STORM_UTILITY_PARAMETRIC_H */ |
Write
Preview
Loading…
Cancel
Save
Reference in new issue