Browse Source

Number of non-const states and transitions

Former-commit-id: 67e7dced61
tempestpy_adaptions
TimQu 9 years ago
parent
commit
d6f65465d2
  1. 3
      src/cli/entrypoints.h
  2. 25
      src/storage/SparseMatrix.cpp
  3. 10
      src/storage/SparseMatrix.h

3
src/cli/entrypoints.h

@ -156,7 +156,8 @@ namespace storm {
storm::settings::generalSettings().getConstantDefinitionString() << ";" <<
modelProgramPair.model->getNumberOfStates() << ";" <<
modelProgramPair.model->getNumberOfTransitions() << ";" << std::endl;
std::cout << "Num of states with nonconstant transitions; Num of nonconstant transitions" << std::endl;
std::cout << "NUM_PARS" << modelProgramPair.model->as<storm::models::sparse::Model<ValueType>>().getTransitionMatrix().getNonconstantRowGroupCont() << ";" << modelProgramPair.model->as<storm::models::sparse::Model<ValueType>>().getTransitionMatrix().getNonconstantRowGroupCont() << std::endl;
// Preprocess the model if needed.
BRANCH_ON_MODELTYPE(modelProgramPair.model, modelProgramPair.model, ValueType, LibraryType, preprocessModel, formulas);

25
src/storage/SparseMatrix.cpp

@ -1143,6 +1143,31 @@ namespace storm {
return sum;
}
template<typename ValueType>
typename SparseMatrix<ValueType>::index_type SparseMatrix<ValueType>::getNonconstantEntryCount() const {
index_type nonConstEntries = 0;
for( auto const& entry : *this){
if(!storm::utility::isConstant(entry.getValue())){
++nonConstEntries;
}
}
return nonConstEntries;
}
template<typename ValueType>
typename SparseMatrix<ValueType>::index_type SparseMatrix<ValueType>::getNonconstantRowGroupCount() const {
index_type nonConstRowGroups = 0;
for (index_type rowGroup=0; rowGroup < this->getRowGroupIndices().size(); ++rowGroup) {
for( auto const& entry : this->getRowGroup(rowGroup)){
if(!storm::utility::isConstant(entry.getValue())){
++nonConstRowGroups;
break;
}
}
}
return nonConstRowGroups;
}
template<typename ValueType>
bool SparseMatrix<ValueType>::isProbabilistic() const {
storm::utility::ConstantsComparator<ValueType> comparator;

10
src/storage/SparseMatrix.h

@ -770,6 +770,16 @@ namespace storm {
*/
value_type getRowSum(index_type row) const;
/*!
* Returns the number of non-constant entries
*/
index_type getNonconstantEntryCount() const;
/*!
* Returns the number of rowGroups that contain a non-constant value
*/
index_type getNonconstantRowGroupCount() const;
/*!
* Checks for each row whether it sums to one.
*/

Loading…
Cancel
Save