Merge pull request #63731 from icfpc-dniwe/icfpc2019

LP and optimization packages
This commit is contained in:
Nikolay Amiantov 2019-06-24 16:24:53 +03:00 committed by GitHub
commit 153b4c2ed2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 139 additions and 3 deletions

View file

@ -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 ];
};
}

View file

@ -72,6 +72,11 @@ stdenv.mkDerivation rec {
done
'';
passthru = {
libArch = "x86-64_linux";
libSuffix = "${version}0";
};
meta = with stdenv.lib; {
description = "Optimization solver for mathematical programming";
homepage = "https://www.ibm.com/be-en/marketplace/ibm-ilog-cplex";

View file

@ -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;

View file

@ -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 ];
};
}

View file

@ -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 ];
};
}

View file

@ -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

View file

@ -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 { };