From 64ddf12558a7e2b3b3ca36aff23a4d05dd9d43f2 Mon Sep 17 00:00:00 2001 From: dehnert Date: Mon, 9 Jan 2017 16:27:44 +0100 Subject: [PATCH] fixed two issues in jit builder: a) respect environment variable (instead of c++); b) casting integer variables to doubles when evaluating label expressions to avoid integer division --- src/storm-dft-cli/storm-dyftee.cpp | 4 ++-- .../builder/jit/ExplicitJitJaniModelBuilder.cpp | 12 +++++++++--- src/storm/settings/SettingsManager.cpp | 1 + 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/storm-dft-cli/storm-dyftee.cpp b/src/storm-dft-cli/storm-dyftee.cpp index 6864e98c6..fdc4a4d5e 100644 --- a/src/storm-dft-cli/storm-dyftee.cpp +++ b/src/storm-dft-cli/storm-dyftee.cpp @@ -48,7 +48,7 @@ void analyzeDFT(std::string filename, std::string property, bool symred, bool al storm::parser::DFTGalileoParser parser; storm::storage::DFT dft = parser.parseDFT(filename); - std::vector> formulas = storm::parseFormulasForExplicit(property); + std::vector> formulas = storm::extractFormulasFromProperties(storm::parsePropertiesForExplicit(property)); STORM_LOG_ASSERT(formulas.size() == 1, "Wrong number of formulas."); storm::modelchecker::DFTModelChecker modelChecker; @@ -156,7 +156,7 @@ int main(const int argc, const char** argv) { storm::expressions::Expression targetExpression = exprManager->integer(1) == topfailedVar.getExpressionVariable().getExpression(); auto evtlFormula = std::make_shared(targetExpression); - auto tbFormula = std::make_shared(std::make_shared(true), evtlFormula, 0.0, 10.0); + auto tbFormula = std::make_shared(std::make_shared(true), evtlFormula, storm::logic::TimeBound(false, exprManager->integer(0)), storm::logic::TimeBound(false, exprManager->integer(10)), storm::logic::TimeBoundType::Time); auto tbUntil = std::make_shared(tbFormula); auto evFormula = std::make_shared(evtlFormula, storm::logic::FormulaContext::Time); diff --git a/src/storm/builder/jit/ExplicitJitJaniModelBuilder.cpp b/src/storm/builder/jit/ExplicitJitJaniModelBuilder.cpp index b3edd7e73..7a55f0c8a 100644 --- a/src/storm/builder/jit/ExplicitJitJaniModelBuilder.cpp +++ b/src/storm/builder/jit/ExplicitJitJaniModelBuilder.cpp @@ -50,7 +50,13 @@ namespace storm { if (settings.isCompilerSet()) { compiler = settings.getCompiler(); } else { - compiler = "c++"; + const char* cxxEnv = std::getenv("CXX"); + if (cxxEnv != nullptr) { + compiler = std::string(cxxEnv); + } + if (compiler.empty()) { + compiler = "c++"; + } } if (settings.isCompilerFlagsSet()) { compilerFlags = settings.getCompilerFlags(); @@ -1509,7 +1515,7 @@ namespace storm { if (this->options.isBuildAllLabelsSet() || this->options.getLabelNames().find(variable.getName()) != this->options.getLabelNames().end()) { cpptempl::data_map label; label["name"] = variable.getName(); - label["predicate"] = expressionTranslator.translate(shiftVariablesWrtLowerBound(model.getLabelExpression(variable.asBooleanVariable(), parallelAutomata)), storm::expressions::ToCppTranslationOptions(variablePrefixes, variableToName)); + label["predicate"] = expressionTranslator.translate(shiftVariablesWrtLowerBound(model.getLabelExpression(variable.asBooleanVariable(), parallelAutomata)), storm::expressions::ToCppTranslationOptions(variablePrefixes, variableToName, storm::expressions::ToCppTranslationMode::CastDouble)); labels.push_back(label); } } @@ -1518,7 +1524,7 @@ namespace storm { for (auto const& expression : this->options.getExpressionLabels()) { cpptempl::data_map label; label["name"] = expression.toString(); - label["predicate"] = expressionTranslator.translate(shiftVariablesWrtLowerBound(expression), storm::expressions::ToCppTranslationOptions(variablePrefixes, variableToName)); + label["predicate"] = expressionTranslator.translate(shiftVariablesWrtLowerBound(expression), storm::expressions::ToCppTranslationOptions(variablePrefixes, variableToName, storm::expressions::ToCppTranslationMode::CastDouble)); labels.push_back(label); } diff --git a/src/storm/settings/SettingsManager.cpp b/src/storm/settings/SettingsManager.cpp index 7dc541a2a..b5db92f3d 100644 --- a/src/storm/settings/SettingsManager.cpp +++ b/src/storm/settings/SettingsManager.cpp @@ -349,6 +349,7 @@ namespace storm { void SettingsManager::setOptionArguments(std::string const& optionName, std::shared_ptr