- Some renaming (among others unmatched -> mismatched).
- Added checks and tests for doubled or skipped lines as well as lines concerning the same transition.
Next up: Remerge.)
Former-commit-id: 05efcbf91c
if(!fixDeadlocks&&hadDeadlocks)throwstorm::exceptions::WrongFormatException()<<"Some of the nodes had deadlocks. You can use --fixDeadlocks to insert self-loops on the fly.";
if(!fixDeadlocks&&hadDeadlocks)throwstorm::exceptions::WrongFormatException()<<"Some of the nodes had deadlocks. You can use --fixDeadlocks to insert self-loops on the fly.";
}
}
// Finally, build the actual matrix and return it.
returnresultMatrix.build();
// Finally, build the actual matrix, test and return it.
// Since we cannot do the testing if each transition for which there is a reward in the reward file also exists in the transition matrix during parsing, we have to do it afterwards.
if(!fixDeadlocks&&hadDeadlocks&&!isRewardFile)throwstorm::exceptions::WrongFormatException()<<"Some of the nodes had deadlocks. You can use --fixDeadlocks to insert self-loops on the fly.";
if(!fixDeadlocks&&hadDeadlocks&&!isRewardFile)throwstorm::exceptions::WrongFormatException()<<"Some of the nodes had deadlocks. You can use --fixDeadlocks to insert self-loops on the fly.";
// Since we cannot do the testing if each transition for which there is a reward in the reward file also exists in the transition matrix during parsing, we have to do it afterwards.
// If the state has already been read or skipped once there might be a problem with the file (doubled lines, or blocks).
// Note: The value -1 shows that lastState has not yet been set, i.e. this is the first run of the loop (state index (2^64)-1 is a really bad starting index).
if(state<=lastState&&lastState!=-1){
LOG4CPLUS_ERROR(logger,"State "<<state<<" was found but has already been read or skipped previously.");
throwstorm::exceptions::WrongFormatException()<<"State "<<state<<" was found but has already been read or skipped previously.";
}
if(stateCount<=state){
if(stateCount<=state){
LOG4CPLUS_ERROR(logger,"Found reward for a state of an invalid index \""<<state<<"\". The model has only "<<stateCount<<" states.");
LOG4CPLUS_ERROR(logger,"Found reward for a state of an invalid index \""<<state<<"\". The model has only "<<stateCount<<" states.");
throwstorm::exceptions::OutOfRangeException()<<"Found reward for a state of an invalid index \""<<state<<"\"";
throwstorm::exceptions::OutOfRangeException()<<"Found reward for a state of an invalid index \""<<state<<"\"";
}
}
reward=checked_strtod(buf,&buf);
reward=checked_strtod(buf,&buf);
if(reward<0.0){
if(reward<0.0){
LOG4CPLUS_ERROR(logger,"Expected positive reward value but got \""<<reward<<"\".");
LOG4CPLUS_ERROR(logger,"Expected positive reward value but got \""<<reward<<"\".");