diff --git a/pkgs/applications/science/logic/fast-downward/default.nix b/pkgs/applications/science/logic/fast-downward/default.nix new file mode 100644 index 000000000000..21ce6be3e6c1 --- /dev/null +++ b/pkgs/applications/science/logic/fast-downward/default.nix @@ -0,0 +1,55 @@ +{ stdenv, lib, fetchhg, cmake, which, python3, osi, cplex }: + +stdenv.mkDerivation rec { + name = "fast-downward-2019-05-13"; + + src = fetchhg { + url = "http://hg.fast-downward.org/"; + rev = "090f5df5d84a"; + sha256 = "14pcjz0jfzx5269axg66iq8js7lm2w3cnqrrhhwmz833prjp945g"; + }; + + nativeBuildInputs = [ cmake which ]; + buildInputs = [ python3 python3.pkgs.wrapPython osi ]; + + cmakeFlags = + lib.optional osi.withCplex [ "-DDOWNWARD_CPLEX_ROOT=${cplex}/cplex" ]; + + enableParallelBuilding = true; + + postPatch = '' + cd src + # Needed because the package tries to be too smart. + export CC="$(which $CC)" + export CXX="$(which $CXX)" + ''; + + installPhase = '' + install -Dm755 bin/downward $out/libexec/fast-downward/downward + cp -r ../translate $out/libexec/fast-downward/ + install -Dm755 ../../fast-downward.py $out/bin/fast-downward + mkdir -p $out/${python3.sitePackages} + cp -r ../../driver $out/${python3.sitePackages} + + wrapPythonProgramsIn $out/bin "$out $pythonPath" + wrapPythonProgramsIn $out/libexec/fast-downward/translate "$out $pythonPath" + # Because fast-downward calls `python translate.py` we need to return wrapped scripts back. + for i in $out/libexec/fast-downward/translate/.*-wrapped; do + name="$(basename "$i")" + name1="''${name#.}" + name2="''${name1%-wrapped}" + dir="$(dirname "$i")" + dest="$dir/$name2" + echo "Moving $i to $dest" + mv "$i" "$dest" + done + ''; + + meta = with stdenv.lib; { + description = "A domain-independent planning system"; + homepage = "http://www.fast-downward.org/"; + license = licenses.gpl3Plus; + platforms = platforms.linux; + maintainers = with maintainers; [ abbradar ]; + }; +} diff --git a/pkgs/applications/science/math/cplex/default.nix b/pkgs/applications/science/math/cplex/default.nix index dc0e9ea1aa5d..a14839d3eccc 100644 --- a/pkgs/applications/science/math/cplex/default.nix +++ b/pkgs/applications/science/math/cplex/default.nix @@ -71,6 +71,11 @@ stdenv.mkDerivation rec { fi done ''; + + passthru = { + libArch = "x86-64_linux"; + libSuffix = "${version}0"; + }; meta = with stdenv.lib; { description = "Optimization solver for mathematical programming"; diff --git a/pkgs/applications/science/math/gurobi/default.nix b/pkgs/applications/science/math/gurobi/default.nix index be14d1411285..ee9bdcc6f1b0 100644 --- a/pkgs/applications/science/math/gurobi/default.nix +++ b/pkgs/applications/science/math/gurobi/default.nix @@ -1,8 +1,10 @@ -{ stdenv, fetchurl, autoPatchelfHook, python }: +{ stdenv, lib, fetchurl, autoPatchelfHook, python }: -stdenv.mkDerivation rec { +let + majorVersion = "8.1"; +in stdenv.mkDerivation rec { name = "gurobi-${version}"; - version = "8.1.0"; + version = "${majorVersion}.0"; src = with stdenv.lib; fetchurl { url = "http://packages.gurobi.com/${versions.majorMinor version}/gurobi${version}_linux64.tar.gz"; @@ -44,6 +46,8 @@ stdenv.mkDerivation rec { ln -s $out/lib/gurobi-javadoc.jar $out/share/java/ ''; + passthru.libSuffix = lib.replaceStrings ["."] [""] majorVersion; + meta = with stdenv.lib; { description = "Optimization solver for mathematical programming"; homepage = https://www.gurobi.com; diff --git a/pkgs/development/libraries/science/math/osi/default.nix b/pkgs/development/libraries/science/math/osi/default.nix new file mode 100644 index 000000000000..1cc80e78a100 --- /dev/null +++ b/pkgs/development/libraries/science/math/osi/default.nix @@ -0,0 +1,42 @@ +{ stdenv, lib, fetchurl, gfortran, pkgconfig +, blas, zlib, bzip2 +, withGurobi ? false, gurobi +, withCplex ? false, cplex }: + +stdenv.mkDerivation rec { + pname = "osi"; + version = "0.108.4"; + + src = fetchurl { + url = "https://www.coin-or.org/download/source/Osi/Osi-${version}.tgz"; + sha256 = "13bwhdh01g37vp3kjwl9nvij5s5ikh5f7zgrqgwrqfyk35q2x9s5"; + }; + + buildInputs = + [ blas zlib bzip2 ] + ++ lib.optional withGurobi gurobi + ++ lib.optional withCplex cplex; + nativeBuildInputs = [ gfortran pkgconfig ]; + configureFlags = + lib.optionals withGurobi [ "--with-gurobi-incdir=${gurobi}/include" "--with-gurobi-lib=-lgurobi${gurobi.libSuffix}" ] + ++ lib.optionals withCplex [ "--with-cplex-incdir=${cplex}/cplex/include/ilcplex" "--with-cplex-lib=-lcplex${cplex.libSuffix}" ]; + + NIX_LDFLAGS = + lib.optional withCplex "-L${cplex}/cplex/bin/${cplex.libArch}"; + + # Compile errors + NIX_CFLAGS_COMPILE = [ "-Wno-cast-qual" ]; + hardeningDisable = [ "format" ]; + + enableParallelBuilding = true; + + passthru = { inherit withGurobi withCplex; }; + + meta = with stdenv.lib; { + description = "An abstract base class to a generic linear programming (LP) solver"; + homepage = "https://github.com/coin-or/Osi"; + license = licenses.epl10; + platforms = platforms.unix; + maintainers = with maintainers; [ abbradar ]; + }; +} diff --git a/pkgs/development/python-modules/mlrose/default.nix b/pkgs/development/python-modules/mlrose/default.nix new file mode 100644 index 000000000000..f7d43115a1b5 --- /dev/null +++ b/pkgs/development/python-modules/mlrose/default.nix @@ -0,0 +1,24 @@ +{ stdenv, buildPythonPackage, fetchPypi, scikitlearn }: + +buildPythonPackage rec { + pname = "mlrose"; + version = "1.2.0"; + + src = fetchPypi { + inherit pname version; + sha256 = "0vsvqrf1wbbj8i198rqd87hf8rlq7fmv8mmibv8f9rhj0w8729p5"; + }; + + propagatedBuildInputs = [ scikitlearn ]; + + postPatch = '' + sed -i 's,sklearn,scikit-learn,g' setup.py + ''; + + meta = with stdenv.lib; { + description = "Machine Learning, Randomized Optimization and SEarch"; + homepage = "https://github.com/gkhayes/mlrose"; + license = licenses.bsd3; + maintainers = with maintainers; [ abbradar ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index fc1d8208ab82..79a31ca1d368 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -22566,6 +22566,8 @@ in nauty = callPackage ../applications/science/math/nauty {}; + osi = callPackage ../development/libraries/science/math/osi { }; + or-tools = callPackage ../development/libraries/science/math/or-tools { pythonProtobuf = pythonPackages.protobuf; }; @@ -22818,6 +22820,8 @@ in else smlnj; }; + fast-downward = callPackage ../applications/science/logic/fast-downward { }; + twelf = callPackage ../applications/science/logic/twelf { smlnj = if stdenv.isDarwin then smlnjBootstrap diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 9bef1b877096..5400438d7dc1 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -2242,6 +2242,8 @@ in { misaka = callPackage ../development/python-modules/misaka {}; + mlrose = callPackage ../development/python-modules/mlrose { }; + mt-940 = callPackage ../development/python-modules/mt-940 { }; mwlib = callPackage ../development/python-modules/mwlib { };