Browse Source
Merge remote-tracking branch 'origin/future' into jani_support
Merge remote-tracking branch 'origin/future' into jani_support
Former-commit-id:main2c2c57e103
[formerly8d725b4d90
] Former-commit-id:918275a8c7
66 changed files with 875 additions and 343 deletions
-
2resources/3rdparty/CMakeLists.txt
-
4src/adapters/AddExpressionAdapter.cpp
-
2src/adapters/AddExpressionAdapter.h
-
4src/adapters/MathsatExpressionAdapter.h
-
4src/adapters/Z3ExpressionAdapter.cpp
-
2src/adapters/Z3ExpressionAdapter.h
-
2src/builder/DdPrismModelBuilder.cpp
-
2src/counterexamples/SMTMinimalCommandSetGenerator.h
-
3src/generator/JaniNextStateGenerator.cpp
-
7src/generator/PrismNextStateGenerator.cpp
-
1src/modelchecker/AbstractModelChecker.cpp
-
32src/parser/ExpressionParser.cpp
-
16src/parser/ExpressionParser.h
-
3src/parser/JaniParser.h
-
20src/parser/PrismParser.cpp
-
6src/parser/PrismParser.h
-
5src/settings/modules/CoreSettings.cpp
-
1src/settings/modules/CoreSettings.h
-
4src/storage/expressions/BinaryNumericalFunctionExpression.cpp
-
39src/storage/expressions/DoubleLiteralExpression.cpp
-
53src/storage/expressions/DoubleLiteralExpression.h
-
6src/storage/expressions/ExpressionManager.cpp
-
9src/storage/expressions/ExpressionManager.h
-
4src/storage/expressions/ExpressionVisitor.h
-
2src/storage/expressions/Expressions.h
-
4src/storage/expressions/LinearCoefficientVisitor.cpp
-
2src/storage/expressions/LinearCoefficientVisitor.h
-
2src/storage/expressions/LinearityCheckVisitor.cpp
-
2src/storage/expressions/LinearityCheckVisitor.h
-
53src/storage/expressions/RationalLiteralExpression.cpp
-
78src/storage/expressions/RationalLiteralExpression.h
-
2src/storage/expressions/SubstitutionVisitor.cpp
-
2src/storage/expressions/SubstitutionVisitor.h
-
2src/storage/expressions/ToExprtkStringVisitor.cpp
-
2src/storage/expressions/ToExprtkStringVisitor.h
-
11src/storage/expressions/ToRationalFunctionVisitor.cpp
-
2src/storage/expressions/ToRationalFunctionVisitor.h
-
31src/storage/expressions/ToRationalNumberVisitor.cpp
-
2src/storage/expressions/ToRationalNumberVisitor.h
-
4src/storage/expressions/UnaryNumericalFunctionExpression.cpp
-
9src/storage/jani/BooleanVariable.cpp
-
5src/storage/jani/BooleanVariable.h
-
4src/storage/jani/BoundedIntegerVariable.cpp
-
2src/storage/jani/BoundedIntegerVariable.h
-
1src/storage/jani/UnboundedIntegerVariable.h
-
16src/storage/prism/BooleanVariable.cpp
-
2src/storage/prism/BooleanVariable.h
-
7src/storage/prism/Constant.cpp
-
14src/storage/prism/IntegerVariable.cpp
-
2src/storage/prism/IntegerVariable.h
-
18src/storage/prism/Module.cpp
-
6src/storage/prism/Module.h
-
269src/storage/prism/Program.cpp
-
34src/storage/prism/Program.h
-
18src/storage/prism/RewardModel.cpp
-
9src/storage/prism/RewardModel.h
-
12src/storage/prism/Variable.cpp
-
23src/storage/prism/Variable.h
-
13src/storm.cpp
-
58src/utility/constants.cpp
-
3src/utility/constants.h
-
2src/utility/storm.cpp
-
4src/utility/storm.h
-
4test/functional/parser/PrismParserTest.cpp
-
10util/osx-package/package.sh
-
103util/osx-package/packager.py
@ -1,39 +0,0 @@ |
|||||
#include "src/storage/expressions/DoubleLiteralExpression.h"
|
|
||||
#include "src/storage/expressions/ExpressionManager.h"
|
|
||||
#include "src/storage/expressions/ExpressionVisitor.h"
|
|
||||
|
|
||||
namespace storm { |
|
||||
namespace expressions { |
|
||||
DoubleLiteralExpression::DoubleLiteralExpression(ExpressionManager const& manager, double value) : BaseExpression(manager, manager.getRationalType()), value(value) { |
|
||||
// Intentionally left empty.
|
|
||||
} |
|
||||
|
|
||||
double DoubleLiteralExpression::evaluateAsDouble(Valuation const* valuation) const { |
|
||||
return this->getValue(); |
|
||||
} |
|
||||
|
|
||||
bool DoubleLiteralExpression::isLiteral() const { |
|
||||
return true; |
|
||||
} |
|
||||
|
|
||||
void DoubleLiteralExpression::gatherVariables(std::set<storm::expressions::Variable>& variables) const { |
|
||||
return; |
|
||||
} |
|
||||
|
|
||||
std::shared_ptr<BaseExpression const> DoubleLiteralExpression::simplify() const { |
|
||||
return this->shared_from_this(); |
|
||||
} |
|
||||
|
|
||||
boost::any DoubleLiteralExpression::accept(ExpressionVisitor& visitor) const { |
|
||||
return visitor.visit(*this); |
|
||||
} |
|
||||
|
|
||||
double DoubleLiteralExpression::getValue() const { |
|
||||
return this->value; |
|
||||
} |
|
||||
|
|
||||
void DoubleLiteralExpression::printToStream(std::ostream& stream) const { |
|
||||
stream << this->getValue(); |
|
||||
} |
|
||||
} |
|
||||
} |
|
@ -1,53 +0,0 @@ |
|||||
#ifndef STORM_STORAGE_EXPRESSIONS_DOUBLELITERALEXPRESSION_H_ |
|
||||
#define STORM_STORAGE_EXPRESSIONS_DOUBLELITERALEXPRESSION_H_ |
|
||||
|
|
||||
#include "src/storage/expressions/BaseExpression.h" |
|
||||
#include "src/utility/OsDetection.h" |
|
||||
|
|
||||
namespace storm { |
|
||||
namespace expressions { |
|
||||
class DoubleLiteralExpression : public BaseExpression { |
|
||||
public: |
|
||||
/*! |
|
||||
* Creates an double literal expression with the given value. |
|
||||
* |
|
||||
* @param manager The manager responsible for this expression. |
|
||||
* @param value The value of the double literal. |
|
||||
*/ |
|
||||
DoubleLiteralExpression(ExpressionManager const& manager, double value); |
|
||||
|
|
||||
// Instantiate constructors and assignments with their default implementations. |
|
||||
DoubleLiteralExpression(DoubleLiteralExpression const& other) = default; |
|
||||
DoubleLiteralExpression& operator=(DoubleLiteralExpression const& other) = delete; |
|
||||
#ifndef WINDOWS |
|
||||
DoubleLiteralExpression(DoubleLiteralExpression&&) = default; |
|
||||
DoubleLiteralExpression& operator=(DoubleLiteralExpression&&) = delete; |
|
||||
#endif |
|
||||
virtual ~DoubleLiteralExpression() = default; |
|
||||
|
|
||||
// Override base class methods. |
|
||||
virtual double evaluateAsDouble(Valuation const* valuation = nullptr) const override; |
|
||||
virtual bool isLiteral() const override; |
|
||||
virtual void gatherVariables(std::set<storm::expressions::Variable>& variables) const override; |
|
||||
virtual std::shared_ptr<BaseExpression const> simplify() const override; |
|
||||
virtual boost::any accept(ExpressionVisitor& visitor) const override; |
|
||||
|
|
||||
/*! |
|
||||
* Retrieves the value of the double literal. |
|
||||
* |
|
||||
* @return The value of the double literal. |
|
||||
*/ |
|
||||
double getValue() const; |
|
||||
|
|
||||
protected: |
|
||||
// Override base class method. |
|
||||
virtual void printToStream(std::ostream& stream) const override; |
|
||||
|
|
||||
private: |
|
||||
// The value of the double literal. |
|
||||
double value; |
|
||||
}; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
#endif /* STORM_STORAGE_EXPRESSIONS_DOUBLELITERALEXPRESSION_H_ */ |
|
@ -0,0 +1,53 @@ |
|||||
|
#include "src/storage/expressions/RationalLiteralExpression.h"
|
||||
|
#include "src/storage/expressions/ExpressionManager.h"
|
||||
|
#include "src/storage/expressions/ExpressionVisitor.h"
|
||||
|
|
||||
|
#include "src/utility/constants.h"
|
||||
|
|
||||
|
namespace storm { |
||||
|
namespace expressions { |
||||
|
RationalLiteralExpression::RationalLiteralExpression(ExpressionManager const& manager, double value) : BaseExpression(manager, manager.getRationalType()), value(storm::utility::convertNumber<storm::RationalNumber>(value)) { |
||||
|
// Intentionally left empty.
|
||||
|
} |
||||
|
|
||||
|
RationalLiteralExpression::RationalLiteralExpression(ExpressionManager const& manager, std::string const& valueAsString) : BaseExpression(manager, manager.getRationalType()), value(storm::utility::convertNumber<storm::RationalNumber>(valueAsString)) { |
||||
|
// Intentionally left empty.
|
||||
|
} |
||||
|
|
||||
|
RationalLiteralExpression::RationalLiteralExpression(ExpressionManager const& manager, storm::RationalNumber const& value) : BaseExpression(manager, manager.getRationalType()), value(value) { |
||||
|
// Intentionally left empty.
|
||||
|
} |
||||
|
|
||||
|
double RationalLiteralExpression::evaluateAsDouble(Valuation const* valuation) const { |
||||
|
return this->getValueAsDouble(); |
||||
|
} |
||||
|
|
||||
|
bool RationalLiteralExpression::isLiteral() const { |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
void RationalLiteralExpression::gatherVariables(std::set<storm::expressions::Variable>& variables) const { |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
std::shared_ptr<BaseExpression const> RationalLiteralExpression::simplify() const { |
||||
|
return this->shared_from_this(); |
||||
|
} |
||||
|
|
||||
|
boost::any RationalLiteralExpression::accept(ExpressionVisitor& visitor) const { |
||||
|
return visitor.visit(*this); |
||||
|
} |
||||
|
|
||||
|
double RationalLiteralExpression::getValueAsDouble() const { |
||||
|
return storm::utility::convertNumber<double>(this->value); |
||||
|
} |
||||
|
|
||||
|
storm::RationalNumber RationalLiteralExpression::getValue() const { |
||||
|
return this->value; |
||||
|
} |
||||
|
|
||||
|
void RationalLiteralExpression::printToStream(std::ostream& stream) const { |
||||
|
stream << this->getValue(); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,78 @@ |
|||||
|
#ifndef STORM_STORAGE_EXPRESSIONS_RationalLiteralExpression_H_ |
||||
|
#define STORM_STORAGE_EXPRESSIONS_RationalLiteralExpression_H_ |
||||
|
|
||||
|
#include "src/storage/expressions/BaseExpression.h" |
||||
|
#include "src/utility/OsDetection.h" |
||||
|
|
||||
|
#include "src/adapters/CarlAdapter.h" |
||||
|
|
||||
|
namespace storm { |
||||
|
namespace expressions { |
||||
|
class RationalLiteralExpression : public BaseExpression { |
||||
|
public: |
||||
|
/*! |
||||
|
* Creates an double literal expression with the given value. |
||||
|
* |
||||
|
* @param manager The manager responsible for this expression. |
||||
|
* @param value The value of the double literal. |
||||
|
*/ |
||||
|
RationalLiteralExpression(ExpressionManager const& manager, double value); |
||||
|
|
||||
|
/*! |
||||
|
* Creates an double literal expression with the value given as a string. |
||||
|
* |
||||
|
* @param manager The manager responsible for this expression. |
||||
|
* @param value The string representation of the value of the literal. |
||||
|
*/ |
||||
|
RationalLiteralExpression(ExpressionManager const& manager, std::string const& valueAsString); |
||||
|
|
||||
|
/*! |
||||
|
* Creates an double literal expression with the rational value. |
||||
|
* |
||||
|
* @param manager The manager responsible for this expression. |
||||
|
* @param value The rational number that is the value of this literal expression. |
||||
|
*/ |
||||
|
RationalLiteralExpression(ExpressionManager const& manager, storm::RationalNumber const& value); |
||||
|
|
||||
|
// Instantiate constructors and assignments with their default implementations. |
||||
|
RationalLiteralExpression(RationalLiteralExpression const& other) = default; |
||||
|
RationalLiteralExpression& operator=(RationalLiteralExpression const& other) = delete; |
||||
|
#ifndef WINDOWS |
||||
|
RationalLiteralExpression(RationalLiteralExpression&&) = default; |
||||
|
RationalLiteralExpression& operator=(RationalLiteralExpression&&) = delete; |
||||
|
#endif |
||||
|
virtual ~RationalLiteralExpression() = default; |
||||
|
|
||||
|
// Override base class methods. |
||||
|
virtual double evaluateAsDouble(Valuation const* valuation = nullptr) const override; |
||||
|
virtual bool isLiteral() const override; |
||||
|
virtual void gatherVariables(std::set<storm::expressions::Variable>& variables) const override; |
||||
|
virtual std::shared_ptr<BaseExpression const> simplify() const override; |
||||
|
virtual boost::any accept(ExpressionVisitor& visitor) const override; |
||||
|
|
||||
|
/*! |
||||
|
* Retrieves the value of the double literal. |
||||
|
* |
||||
|
* @return The value of the double literal. |
||||
|
*/ |
||||
|
double getValueAsDouble() const; |
||||
|
|
||||
|
/*! |
||||
|
* Retrieves the value of the double literal. |
||||
|
* |
||||
|
* @return The value of the double literal. |
||||
|
*/ |
||||
|
storm::RationalNumber getValue() const; |
||||
|
|
||||
|
protected: |
||||
|
// Override base class method. |
||||
|
virtual void printToStream(std::ostream& stream) const override; |
||||
|
|
||||
|
private: |
||||
|
// The value of the literal. |
||||
|
storm::RationalNumber value; |
||||
|
}; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
#endif /* STORM_STORAGE_EXPRESSIONS_RationalLiteralExpression_H_ */ |
@ -0,0 +1,10 @@ |
|||||
|
#!/bin/sh |
||||
|
|
||||
|
DYLIBBUNDLER_DIR=/Users/chris/work/macdylibbundler/ |
||||
|
|
||||
|
mkdir -p $1 |
||||
|
mkdir -p $1/bin |
||||
|
mkdir -p $1/lib |
||||
|
cp $2 $1/bin |
||||
|
$DYLIBBUNDLER_DIR/dylibbundler -cd -od -b -p @executable_path/../lib -x $1/bin/storm -d $1/lib |
||||
|
python packager.py --bin storm --dir $1 |
@ -0,0 +1,103 @@ |
|||||
|
import argparse |
||||
|
import subprocess |
||||
|
import os |
||||
|
from shutil import copyfile |
||||
|
|
||||
|
def get_dependencies(file): |
||||
|
# Call otool -L file to obtain the dependencies. |
||||
|
proc = subprocess.Popen(["otool", "-L", args.binary], stdout=subprocess.PIPE) |
||||
|
result = {} |
||||
|
for line_bytes in proc.stdout: |
||||
|
line = line_bytes.decode("utf-8").strip() |
||||
|
lib = line.split()[0] |
||||
|
if (lib.startswith("@")): |
||||
|
lib = lib.split("/", 1)[1] |
||||
|
(base, file) = os.path.split(lib) |
||||
|
print(base + " // " + file) |
||||
|
|
||||
|
return result |
||||
|
|
||||
|
def create_package(args): |
||||
|
create_package_dirs(args.dir) |
||||
|
copy_binary_to_package_dir(args.bin, args.binary_basename, args.dir) |
||||
|
run_dylibbundler(args.bundler_binary, args.dir, args.binary_basename) |
||||
|
pass |
||||
|
|
||||
|
def parse_arguments(): |
||||
|
parser = argparse.ArgumentParser(description='Package the storm binary on Mac OS.') |
||||
|
parser.add_argument('--bin', dest='bin', help='the binary to package', default='storm') |
||||
|
parser.add_argument('--dir', dest='dir', help='the root directory of the package (will be created if it does not exist)', default='.') |
||||
|
parser.add_argument('--dylibbundler', dest='bundler_binary', help='the binary of the dylibbundler', default='dylibbundler') |
||||
|
args = parser.parse_args() |
||||
|
args.binary_dir = os.path.split(args.bin)[0] |
||||
|
args.binary_basename = os.path.split(args.bin)[1] |
||||
|
return args |
||||
|
|
||||
|
def create_package_dirs(root_dir): |
||||
|
if not os.path.exists(root_dir): |
||||
|
os.makedirs(root_dir) |
||||
|
if not os.path.exists(root_dir + "/bin"): |
||||
|
os.makedirs(root_dir + "/bin") |
||||
|
if not os.path.exists(root_dir + "/lib"): |
||||
|
os.makedirs(root_dir + "/bin") |
||||
|
pass |
||||
|
|
||||
|
def copy_binary_to_package_dir(binary, binary_basename, root_dir): |
||||
|
copyfile(binary, root_dir + "/bin/storm") |
||||
|
pass |
||||
|
|
||||
|
def run_dylibbundler(bundler_binary, root_dir, binary_basename): |
||||
|
command = [bundler_binary, "-cd", "-od", "-b", "-p", "@executable_path/../lib", "-x", root_dir + "/bin/" + binary_basename, "-d", root_dir + "/lib"] |
||||
|
print("executing " + str(command)) |
||||
|
#proc = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE) |
||||
|
pass |
||||
|
|
||||
|
def fix_paths(root_dir, binary_basename): |
||||
|
fix_paths_file(root_dir + "/bin/" + binary_basename) |
||||
|
for file in os.listdir(root_dir + "/lib"): |
||||
|
fix_paths_file(root_dir + "/lib/" + file) |
||||
|
pass |
||||
|
pass |
||||
|
|
||||
|
def fix_paths_file(file): |
||||
|
print("fixing paths for " + file) |
||||
|
fixable_deps = get_fixable_deps(file) |
||||
|
for (path, lib) in fixable_deps: |
||||
|
change_fixable_dep(file, path, lib) |
||||
|
|
||||
|
native_libs = ["libc++.1.dylib", "libSystem.B.dylib"] |
||||
|
|
||||
|
def get_fixable_deps(file): |
||||
|
# Call otool -L file to obtain the dependencies. |
||||
|
proc = subprocess.Popen(["otool", "-L", file], stdin=subprocess.PIPE, stdout=subprocess.PIPE) |
||||
|
result = [] |
||||
|
for line_bytes in proc.stdout: |
||||
|
line = line_bytes.decode("utf-8").strip() |
||||
|
lib = line.split()[0] |
||||
|
if lib.startswith("@rpath/"): |
||||
|
result.append(("@rpath", lib.split("/", 1)[1])) |
||||
|
elif lib.startswith("/"): |
||||
|
path_file = os.path.split(lib) |
||||
|
if path_file[1] not in native_libs: |
||||
|
result.append((path_file[0], path_file[1])) |
||||
|
return result |
||||
|
|
||||
|
def change_fixable_dep(file, path, lib): |
||||
|
# Call install_name_tool to change the fixable dependencies |
||||
|
command = ["install_name_tool", "-change", path + "/" + lib, "@executable_path/../lib/" + lib, file] |
||||
|
print("executing " + str(command)) |
||||
|
proc = subprocess.Popen(command, stdout=subprocess.PIPE) |
||||
|
#print ("after call to install_name_tool") |
||||
|
#proc = subprocess.Popen(["otool", "-L", file], stdout=subprocess.PIPE) |
||||
|
#for line_bytes in proc.stdout: |
||||
|
# line = line_bytes.decode("utf-8").strip() |
||||
|
# print(line) |
||||
|
pass |
||||
|
|
||||
|
if __name__ == "__main__": |
||||
|
args = parse_arguments() |
||||
|
|
||||
|
#create_package(args) |
||||
|
fix_paths(args.dir, args.binary_basename) |
||||
|
|
||||
|
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue