diff -Nru ocaml-mccs-1.1+13/debian/changelog ocaml-mccs-1.1+16/debian/changelog --- ocaml-mccs-1.1+13/debian/changelog 2023-07-17 14:10:59.000000000 +0000 +++ ocaml-mccs-1.1+16/debian/changelog 2023-07-24 17:07:07.000000000 +0000 @@ -1,14 +1,17 @@ -ocaml-mccs (1.1+13-2build2) mantic; urgency=medium +ocaml-mccs (1.1+16-1build1) mantic; urgency=medium * Rebuild against new OCAML ABI. - -- Gianfranco Costamagna Mon, 17 Jul 2023 16:10:59 +0200 + -- Gianfranco Costamagna Mon, 24 Jul 2023 19:07:07 +0200 -ocaml-mccs (1.1+13-2build1) mantic; urgency=medium +ocaml-mccs (1.1+16-1) unstable; urgency=medium - * Rebuild against new OCAML ABI. + * Team upload + * New upstream release + * Include ocamlvars.mk in debian/rules + * Bump Standards-Version to 4.6.2 - -- Gianfranco Costamagna Mon, 17 Jul 2023 10:34:00 +0200 + -- Stéphane Glondu Sat, 22 Jul 2023 10:28:39 +0200 ocaml-mccs (1.1+13-2) unstable; urgency=medium diff -Nru ocaml-mccs-1.1+13/debian/control ocaml-mccs-1.1+16/debian/control --- ocaml-mccs-1.1+13/debian/control 2023-07-15 14:07:13.000000000 +0000 +++ ocaml-mccs-1.1+16/debian/control 2023-07-22 08:28:39.000000000 +0000 @@ -6,11 +6,11 @@ Build-Depends: debhelper-compat (= 13), dh-ocaml (>= 1.2), - ocaml-nox (>= 4.3.0~), + ocaml, ocaml-dune, libcudf-ocaml-dev, libglpk-dev -Standards-Version: 4.6.0 +Standards-Version: 4.6.2 Rules-Requires-Root: no Homepage: https://github.com/AltGr/ocaml-mccs/ Vcs-Git: https://salsa.debian.org/ocaml-team/ocaml-mccs.git diff -Nru ocaml-mccs-1.1+13/debian/patches/0001-lp_solver.cpp-Fix-typos.patch ocaml-mccs-1.1+16/debian/patches/0001-lp_solver.cpp-Fix-typos.patch --- ocaml-mccs-1.1+13/debian/patches/0001-lp_solver.cpp-Fix-typos.patch 2023-07-15 14:07:13.000000000 +0000 +++ ocaml-mccs-1.1+16/debian/patches/0001-lp_solver.cpp-Fix-typos.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ -From: Nicolas Braud-Santoni -Date: Mon, 22 Nov 2021 17:13:42 +0100 -Subject: lp_solver.cpp: Fix typos - -Origin: vendor -Forwarded: https://github.com/AltGr/ocaml-mccs/pull/26 -Last-Update: 2020-01-30 -Applied-Upstream: no ---- - src/lp_solver.cpp | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/lp_solver.cpp b/src/lp_solver.cpp -index c6666f0..55d9c9f 100644 ---- a/src/lp_solver.cpp -+++ b/src/lp_solver.cpp -@@ -75,10 +75,10 @@ int lp_solver::init_solver(CUDFVersionedPackageList *all_versioned_packages, int - if ((solution == (CUDFcoefficient *)NULL) || - (lb == (CUDFcoefficient *)NULL) || - (ub == (CUDFcoefficient *)NULL)) { -- fprintf(stderr, "lp_solver: intialize: not enough memory.\n"); -+ fprintf(stderr, "lp_solver: initialize: not enough memory.\n"); - exit(-1); - } else if (ctlpfile == (FILE *)NULL) { -- fprintf(stderr, "lp_solver: intialize: can not open %s.\n", ctlpfilename); -+ fprintf(stderr, "lp_solver: initialize: can not open %s.\n", ctlpfilename); - exit(-1); - } else - return 0; diff -Nru ocaml-mccs-1.1+13/debian/patches/series ocaml-mccs-1.1+16/debian/patches/series --- ocaml-mccs-1.1+13/debian/patches/series 2023-07-15 14:07:13.000000000 +0000 +++ ocaml-mccs-1.1+16/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -0001-lp_solver.cpp-Fix-typos.patch diff -Nru ocaml-mccs-1.1+13/debian/rules ocaml-mccs-1.1+16/debian/rules --- ocaml-mccs-1.1+13/debian/rules 2023-07-15 14:07:13.000000000 +0000 +++ ocaml-mccs-1.1+16/debian/rules 2023-07-22 08:28:39.000000000 +0000 @@ -1,6 +1,8 @@ #!/usr/bin/make -f # -*- makefile -*- +include /usr/share/ocaml/ocamlvars.mk + %: dh $@ --with ocaml --buildsystem ocaml_dune diff -Nru ocaml-mccs-1.1+13/.github/workflows/main.yml ocaml-mccs-1.1+16/.github/workflows/main.yml --- ocaml-mccs-1.1+13/.github/workflows/main.yml 1970-01-01 00:00:00.000000000 +0000 +++ ocaml-mccs-1.1+16/.github/workflows/main.yml 2023-07-05 09:17:53.000000000 +0000 @@ -0,0 +1,40 @@ +name: OCaml MCCS + +on: + pull_request: + push: + +jobs: + build: + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - macos-latest + - windows-latest + ocaml-compiler: + - 4.12.x + - 4.13.x + - 4.14.x + - 5.00.x + exclude: + - os: windows-latest + ocaml-compiler: 5.00.x + - os: macos-latest + ocaml-compiler: 4.08.x + + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Use OCaml ${{ matrix.ocaml-compiler }} + uses: ocaml/setup-ocaml@v2 + with: + ocaml-compiler: ${{ matrix.ocaml-compiler }} + + - run: opam install . --deps-only --with-test + - run: opam exec -- dune build + - run: opam exec -- dune runtest diff -Nru ocaml-mccs-1.1+13/mccs.opam ocaml-mccs-1.1+16/mccs.opam --- ocaml-mccs-1.1+13/mccs.opam 2021-04-16 13:58:45.000000000 +0000 +++ ocaml-mccs-1.1+16/mccs.opam 2023-07-05 09:17:53.000000000 +0000 @@ -1,14 +1,14 @@ opam-version: "2.0" -version: "1.1+13" +version: "1.1+16" maintainer: "Louis Gesbert " authors: [ "Claude Michel " "Louis Gesbert " ] -homepage: "http://www.i3s.unice.fr/~cpjm/misc/" -bug-reports: "https://github.com/AltGr/ocaml-mccs/issues" -license: "LGPL-2.1 with OCaml linking exception, BSD-3-clause, GPL-3.0" -dev-repo: "git+https://github.com/AltGr/ocaml-mccs.git" +homepage: "https://www.i3s.unice.fr/~cpjm/misc/" +bug-reports: "https://github.com/ocaml-opam/ocaml-mccs/issues" +license: ["LGPL-2.1-only WITH OCaml-LGPL-linking-exception" "BSD-3-clause" "GPL-3.0-only"] +dev-repo: "git+https://github.com/ocaml-opam/ocaml-mccs.git" build: [ ["dune" "build" "-p" name "-j" jobs] ["sh" "-c" "dune build @settests --auto-promote || true"] {with-test} diff -Nru ocaml-mccs-1.1+13/src/abstract_combiner.h ocaml-mccs-1.1+16/src/abstract_combiner.h --- ocaml-mccs-1.1+13/src/abstract_combiner.h 2021-04-16 13:58:45.000000000 +0000 +++ ocaml-mccs-1.1+16/src/abstract_combiner.h 2023-07-05 09:17:53.000000000 +0000 @@ -9,8 +9,8 @@ #ifndef __ABSTRACT_COMBINER_H #define __ABSTRACT_COMBINER_H -#include -#include +#include "cudf.h" +#include "abstract_criteria.h" // An anstract combiner class abstract_combiner { diff -Nru ocaml-mccs-1.1+13/src/abstract_criteria.h ocaml-mccs-1.1+16/src/abstract_criteria.h --- ocaml-mccs-1.1+13/src/abstract_criteria.h 2021-04-16 13:58:45.000000000 +0000 +++ ocaml-mccs-1.1+16/src/abstract_criteria.h 2023-07-05 09:17:53.000000000 +0000 @@ -10,9 +10,9 @@ #ifndef _ABSTRACT_CRITERIA_H_ #define _ABSTRACT_CRITERIA_H_ -#include -#include -#include +#include "cudf.h" +#include "cudf_types.h" +#include "abstract_solver.h" // Abstract criteria class class abstract_criteria { diff -Nru ocaml-mccs-1.1+13/src/abstract_solver.h ocaml-mccs-1.1+16/src/abstract_solver.h --- ocaml-mccs-1.1+13/src/abstract_solver.h 2021-04-16 13:58:45.000000000 +0000 +++ ocaml-mccs-1.1+16/src/abstract_solver.h 2023-07-05 09:17:53.000000000 +0000 @@ -11,8 +11,8 @@ #ifndef _ABSTRACT_SOLVER_H #define _ABSTRACT_SOLVER_H -#include -#include +#include "cudf.h" +#include "cudf_types.h" // provide an abstraction of the underlying solvers @@ -92,6 +92,8 @@ virtual int solve() { return 0; }; virtual int solve(int timeout) { return 0; }; + virtual void set_mip_gap(double) = 0; + // ****************************************************************** // abort should, if possible, do something which causes solve to // terminate. diff -Nru ocaml-mccs-1.1+13/src/changed_criteria.cpp ocaml-mccs-1.1+16/src/changed_criteria.cpp --- ocaml-mccs-1.1+13/src/changed_criteria.cpp 2021-04-16 13:58:45.000000000 +0000 +++ ocaml-mccs-1.1+16/src/changed_criteria.cpp 2023-07-05 09:17:53.000000000 +0000 @@ -6,7 +6,7 @@ /*******************************************************/ -#include +#include "changed_criteria.h" // Criteria initialization void changed_criteria::initialize(CUDFproblem *problem, abstract_solver *solver) { diff -Nru ocaml-mccs-1.1+13/src/changed_criteria.h ocaml-mccs-1.1+16/src/changed_criteria.h --- ocaml-mccs-1.1+13/src/changed_criteria.h 2021-04-16 13:58:45.000000000 +0000 +++ ocaml-mccs-1.1+16/src/changed_criteria.h 2023-07-05 09:17:53.000000000 +0000 @@ -9,7 +9,7 @@ #ifndef _CHANGED_CRITERIA_H_ #define _CHANGED_CRITERIA_H_ -#include +#include "abstract_criteria.h" // A concrete class for the changed criteria // i.e. number of virtual packages whose set of diff -Nru ocaml-mccs-1.1+13/src/combiner.h ocaml-mccs-1.1+16/src/combiner.h --- ocaml-mccs-1.1+13/src/combiner.h 2021-04-16 13:58:45.000000000 +0000 +++ ocaml-mccs-1.1+16/src/combiner.h 2023-07-05 09:17:53.000000000 +0000 @@ -9,17 +9,17 @@ #ifndef __COMBINER_H #define __COMBINER_H -#include -#include -#include +#include "cudf.h" +#include "abstract_criteria.h" +#include "abstract_combiner.h" -/* #include */ -#include -/* #include - * #include - * #include - * #include - * #include - * #include */ +/* #include "lexicographic_combiner.h" */ +#include "lexagregate_combiner.h" +/* #include "agregate_combiner.h" + * #include "lexsemiagregate_combiner.h" + * #include "leximin_combiner.h" + * #include "leximax_combiner.h" + * #include "lexleximin_combiner.h" + * #include "lexleximax_combiner.h" */ #endif diff -Nru ocaml-mccs-1.1+13/src/constraint_generation.cpp ocaml-mccs-1.1+16/src/constraint_generation.cpp --- ocaml-mccs-1.1+13/src/constraint_generation.cpp 2021-04-16 13:58:45.000000000 +0000 +++ ocaml-mccs-1.1+16/src/constraint_generation.cpp 2023-07-05 09:17:53.000000000 +0000 @@ -7,7 +7,7 @@ // translate a CUDF problem in a MILP problem -#include +#include "constraint_generation.h" bool generate_desagregate_constraints = false; bool generate_agregate_constraints = true; diff -Nru ocaml-mccs-1.1+13/src/constraint_generation.h ocaml-mccs-1.1+16/src/constraint_generation.h --- ocaml-mccs-1.1+13/src/constraint_generation.h 2021-04-16 13:58:45.000000000 +0000 +++ ocaml-mccs-1.1+16/src/constraint_generation.h 2023-07-05 09:17:53.000000000 +0000 @@ -10,11 +10,11 @@ #ifndef _CONSTRAINT_GENERATION_H_ #define _CONSTRAINT_GENERATION_H_ -#include -#include -#include -#include -#include +#include "cudf.h" +#include "abstract_solver.h" +#include "criteria.h" +#include "combiner.h" +#include "cudf_reductions.h" extern bool generate_desagregate_constraints; extern bool generate_agregate_constraints; diff -Nru ocaml-mccs-1.1+13/src/context_flags.ml ocaml-mccs-1.1+16/src/context_flags.ml --- ocaml-mccs-1.1+13/src/context_flags.ml 2021-04-16 13:58:45.000000000 +0000 +++ ocaml-mccs-1.1+16/src/context_flags.ml 2023-07-05 09:17:53.000000000 +0000 @@ -24,8 +24,10 @@ let cxxflags = let flags = + (if (Sys.win32 && Config.ccomp_type = "msvc") + then ["\"/EHsc\""] + else ["-Wall -Wextra -Wno-unused-parameter"]) @ (ifc (Config.system = "macosx") ["-x"; "c++"]) @ - (ifc (Sys.win32 && Config.ccomp_type = "msvc") ["\"/EHsc\""]) @ (ifc useGLPK ["-DUSEGLPK"]) @ (ifc useCOIN ["-DUSECOIN"]) @ (ifc useCLP ["-DUSECLP"]) @ @@ -37,6 +39,7 @@ let clibs = let flags = (ifc (Config.ccomp_type = "cc") ["-lstdc++"]) @ + (ifc (Config.system = "cygwin") ["-lgcc_s"]) @ (ifc useCOIN ["-lCoinUtils"]) @ (ifc useCLP ["-lOsiClp"]) @ (ifc useCBC ["-lOsiCbc";"-lCbc"]) @ diff -Nru ocaml-mccs-1.1+13/src/count_criteria.cpp ocaml-mccs-1.1+16/src/count_criteria.cpp --- ocaml-mccs-1.1+13/src/count_criteria.cpp 2021-04-16 13:58:45.000000000 +0000 +++ ocaml-mccs-1.1+16/src/count_criteria.cpp 2023-07-05 09:17:53.000000000 +0000 @@ -7,7 +7,7 @@ // Count a property quantity -#include +#include "count_criteria.h" // Check property availability void count_criteria::check_property(CUDFproblem *problem) { diff -Nru ocaml-mccs-1.1+13/src/count_criteria.h ocaml-mccs-1.1+16/src/count_criteria.h --- ocaml-mccs-1.1+13/src/count_criteria.h 2021-04-16 13:58:45.000000000 +0000 +++ ocaml-mccs-1.1+16/src/count_criteria.h 2023-07-05 09:17:53.000000000 +0000 @@ -10,7 +10,7 @@ #ifndef _COUNT_CRITERIA_H_ #define _COUNT_CRITERIA_H_ -#include +#include "abstract_criteria.h" typedef enum {REQUEST,NEW,CHANGED,SOLUTION} Count_scope; diff -Nru ocaml-mccs-1.1+13/src/criteria.h ocaml-mccs-1.1+16/src/criteria.h --- ocaml-mccs-1.1+13/src/criteria.h 2021-04-16 13:58:45.000000000 +0000 +++ ocaml-mccs-1.1+16/src/criteria.h 2023-07-05 09:17:53.000000000 +0000 @@ -10,21 +10,21 @@ #ifndef _CRITERIA_H_ #define _CRITERIA_H_ -#include -#include -#include - -#include -#include -#include -#include -//#include +#include "cudf.h" +#include "abstract_solver.h" +#include "abstract_criteria.h" + +#include "removed_criteria.h" +#include "changed_criteria.h" +#include "notuptodate_criteria.h" +#include "new_criteria.h" +//#include "nunsat_criteria.h" -#include -//#include +#include "count_criteria.h" +//#include "unaligned_criteria.h" -#include -//#include +#include "lexagregate_combiner.h" +//#include "agregate_combiner.h" #endif diff -Nru ocaml-mccs-1.1+13/src/cudf.h ocaml-mccs-1.1+16/src/cudf.h --- ocaml-mccs-1.1+13/src/cudf.h 2021-04-16 13:58:45.000000000 +0000 +++ ocaml-mccs-1.1+16/src/cudf.h 2023-07-05 09:17:53.000000000 +0000 @@ -18,9 +18,9 @@ #define __USE_MINGW_ANSI_STDIO 1 #endif -#include -#include -#include +#include +#include +#include #include #include #include diff -Nru ocaml-mccs-1.1+13/src/cudf_reductions.cpp ocaml-mccs-1.1+16/src/cudf_reductions.cpp --- ocaml-mccs-1.1+13/src/cudf_reductions.cpp 2021-04-16 13:58:45.000000000 +0000 +++ ocaml-mccs-1.1+16/src/cudf_reductions.cpp 2023-07-05 09:17:53.000000000 +0000 @@ -6,7 +6,7 @@ /*******************************************************/ -#include +#include "cudf_reductions.h" #include vector process_properties; // set of property to process diff -Nru ocaml-mccs-1.1+13/src/cudf_reductions.h ocaml-mccs-1.1+16/src/cudf_reductions.h --- ocaml-mccs-1.1+13/src/cudf_reductions.h 2021-04-16 13:58:45.000000000 +0000 +++ ocaml-mccs-1.1+16/src/cudf_reductions.h 2023-07-05 09:17:53.000000000 +0000 @@ -15,8 +15,8 @@ #ifndef __CUDF_REDUCTIONS #define __CUDF_REDUCTIONS -#include -#include +#include "cudf.h" +#include "cudf_types.h" extern vector process_properties; // set of property to process diff -Nru ocaml-mccs-1.1+13/src/cudf_tools.cpp ocaml-mccs-1.1+16/src/cudf_tools.cpp --- ocaml-mccs-1.1+13/src/cudf_tools.cpp 2021-04-16 13:58:45.000000000 +0000 +++ ocaml-mccs-1.1+16/src/cudf_tools.cpp 2023-07-05 09:17:53.000000000 +0000 @@ -6,8 +6,8 @@ /*******************************************************/ -#include -#include +#include "cudf.h" +#include "cudf_types.h" // Handling verbosity level int verbosity = 0; diff -Nru ocaml-mccs-1.1+13/src/dune ocaml-mccs-1.1+16/src/dune --- ocaml-mccs-1.1+13/src/dune 2021-04-16 13:58:45.000000000 +0000 +++ ocaml-mccs-1.1+16/src/dune 2023-07-05 09:17:53.000000000 +0000 @@ -7,8 +7,6 @@ (modules :standard \ context_flags) (cxx_flags :standard - -I - . (:include cxxflags.sexp)) (c_library_flags :standard diff -Nru ocaml-mccs-1.1+13/src/glpk_solver.cpp ocaml-mccs-1.1+16/src/glpk_solver.cpp --- ocaml-mccs-1.1+13/src/glpk_solver.cpp 2021-04-16 13:58:45.000000000 +0000 +++ ocaml-mccs-1.1+16/src/glpk_solver.cpp 2023-07-05 09:17:53.000000000 +0000 @@ -12,9 +12,9 @@ #else #include #endif -#include -#include -#include +#include +#include "glpk_solver.h" +#include #define OUTPUT_MODEL 0 @@ -67,6 +67,10 @@ return; } +void glpk_solver::set_mip_gap(double mip_gap) { + this->mip_gap = mip_gap; +} + // solve the current lp problem int glpk_solver::solve(int timeout) { int status = 0, nb_objectives = objectives.size(); @@ -85,6 +89,7 @@ this->mip_params.presolve = GLP_ON; this->mip_params.binarize = GLP_ON; this->mip_params.tm_lim = timeout; + this->mip_params.mip_gap = this->mip_gap; this->mip_params.msg_lev = (verbosity > 1) ? GLP_MSG_ON : GLP_MSG_OFF; // one of GLP_MSG_OFF GLP_MSG_ERR GLP_MSG_ON GLP_MSG_ALL @@ -129,8 +134,10 @@ close(save_stdout); } switch (status) { + case GLP_EMIPGAP: case 0: { switch (glp_mip_status(lp)) { + case GLP_FEAS: case GLP_OPT: return 1; case GLP_NOFEAS: return 0; default: return -1; diff -Nru ocaml-mccs-1.1+13/src/glpk_solver.h ocaml-mccs-1.1+16/src/glpk_solver.h --- ocaml-mccs-1.1+13/src/glpk_solver.h 2021-04-16 13:58:45.000000000 +0000 +++ ocaml-mccs-1.1+16/src/glpk_solver.h 2023-07-05 09:17:53.000000000 +0000 @@ -10,8 +10,8 @@ #ifndef _GLPK_SOLVER_H #define _GLPK_SOLVER_H -#include -#include +#include "abstract_solver.h" +#include "scoeff_solver.h" #include "config.h" class glpk_solver: public abstract_solver, public scoeff_solver { @@ -24,6 +24,8 @@ // Allocate some columns for integer variables int set_intvar_range(int rank, CUDFcoefficient lower, CUDFcoefficient upper); + void set_mip_gap(double); + // Write the lp on a file // int writelp(const char *filename); @@ -97,6 +99,7 @@ private: glp_iocp mip_params; bool aborted; + double mip_gap; }; diff -Nru ocaml-mccs-1.1+13/src/lexagregate_combiner.cpp ocaml-mccs-1.1+16/src/lexagregate_combiner.cpp --- ocaml-mccs-1.1+13/src/lexagregate_combiner.cpp 2021-04-16 13:58:45.000000000 +0000 +++ ocaml-mccs-1.1+16/src/lexagregate_combiner.cpp 2023-07-05 09:17:53.000000000 +0000 @@ -6,8 +6,8 @@ /*******************************************************/ -#include -#include +#include +#include "lexagregate_combiner.h" // Compute the number of columns required to handle the combiner int lexagregate_combiner::column_allocation(int first_rank) { diff -Nru ocaml-mccs-1.1+13/src/lexagregate_combiner.h ocaml-mccs-1.1+16/src/lexagregate_combiner.h --- ocaml-mccs-1.1+13/src/lexagregate_combiner.h 2021-04-16 13:58:45.000000000 +0000 +++ ocaml-mccs-1.1+16/src/lexagregate_combiner.h 2023-07-05 09:17:53.000000000 +0000 @@ -10,7 +10,7 @@ #ifndef __LEXAGREGATE_COMBINER_H #define __LEXAGREGATE_COMBINER_H -#include +#include "abstract_combiner.h" // Concrete class to agregate a set of criteria i.e. handle it as sum \lambda_i c_i // Note: such an agregate could be seen either as a combiner or a criteria diff -Nru ocaml-mccs-1.1+13/src/lp_solver.cpp ocaml-mccs-1.1+16/src/lp_solver.cpp --- ocaml-mccs-1.1+13/src/lp_solver.cpp 2021-04-16 13:58:45.000000000 +0000 +++ ocaml-mccs-1.1+16/src/lp_solver.cpp 2023-07-05 09:17:53.000000000 +0000 @@ -5,9 +5,8 @@ /*******************************************************/ -#include -#include -#include +#include +#include #include #ifdef _WIN32 #include @@ -15,6 +14,8 @@ #include #endif +#include "lp_solver.h" + #define CLEAN_FILES 1 #ifdef _WIN32 #define TMP_FILES_PATH temp_files_path @@ -75,10 +76,10 @@ if ((solution == (CUDFcoefficient *)NULL) || (lb == (CUDFcoefficient *)NULL) || (ub == (CUDFcoefficient *)NULL)) { - fprintf(stderr, "lp_solver: intialize: not enough memory.\n"); + fprintf(stderr, "lp_solver: initialize: not enough memory.\n"); exit(-1); } else if (ctlpfile == (FILE *)NULL) { - fprintf(stderr, "lp_solver: intialize: can not open %s.\n", ctlpfilename); + fprintf(stderr, "lp_solver: initialize: cannot open %s.\n", ctlpfilename); exit(-1); } else return 0; @@ -87,11 +88,13 @@ // write the problem into a file int lp_solver::writelp(const char *filename) { return 0; } +void lp_solver::set_mip_gap(double mip_gap) {} // TODO ? + // solve the current problem int lp_solver::solve() { int status = 0; int rank, iobjval; - char command[1024]; + char command[2048]; FILE *fsol = (FILE *)NULL; CUDFcoefficient objvals[20]; unsigned int nb_objectives = objectives.size(); diff -Nru ocaml-mccs-1.1+13/src/lp_solver.h ocaml-mccs-1.1+16/src/lp_solver.h --- ocaml-mccs-1.1+13/src/lp_solver.h 2021-04-16 13:58:45.000000000 +0000 +++ ocaml-mccs-1.1+16/src/lp_solver.h 2023-07-05 09:17:53.000000000 +0000 @@ -10,8 +10,8 @@ #ifndef _LP_SOLVER_H #define _LP_SOLVER_H -#include -#include +#include "abstract_solver.h" +#include "scoeff_solver.h" class lp_solver: public abstract_solver, public scoeff_solver { public: @@ -20,6 +20,8 @@ // Write the lp on a file int writelp(const char *filename); + void set_mip_gap(double); + // Solve the problem int solve(); int solve(int timeout); diff -Nru ocaml-mccs-1.1+13/src/mccscudf.cpp ocaml-mccs-1.1+16/src/mccscudf.cpp --- ocaml-mccs-1.1+13/src/mccscudf.cpp 2021-04-16 13:58:45.000000000 +0000 +++ ocaml-mccs-1.1+16/src/mccscudf.cpp 2023-07-05 09:17:53.000000000 +0000 @@ -5,16 +5,16 @@ /*******************************************************/ -#include -#include -#include -#include -#include -#include +#include "cudf.h" +#include "abstract_solver.h" +#include "constraint_generation.h" +#include "criteria.h" +#include "combiner.h" +#include "cudf_reductions.h" #include -#include +#include #include -#include +#include "mccscudf.h" // underlying solver declaration // allows using solvers withour having to include the whole solver classes @@ -35,7 +35,7 @@ #endif #ifdef USECOIN - #include + #include "osi_solver.h" #ifdef USECLP #include #endif @@ -285,12 +285,12 @@ return process_criteria(crit_descr, pos, first_level, criteria_with_property); } -Solver_return call_mccs(Solver solver_arg, char *criteria_arg, int timeout, CUDFproblem* the_problem) { +Solver_return call_mccs(Solver solver_arg, char *criteria_arg, int timeout, double mip_gap, CUDFproblem* the_problem) { abstract_solver *solver; - return call_mccs(solver_arg, criteria_arg, timeout, the_problem, &solver); + return call_mccs(solver_arg, criteria_arg, timeout, mip_gap, the_problem, &solver); } -Solver_return call_mccs(Solver solver_arg, char *criteria_arg, int timeout, CUDFproblem* the_problem, abstract_solver **solver_ptr) { +Solver_return call_mccs(Solver solver_arg, char *criteria_arg, int timeout, double mip_gap, CUDFproblem* the_problem, abstract_solver **solver_ptr) { CUDFproblem *problem = the_problem; vector criteria_with_property; CriteriaList *criteria = get_criteria(criteria_arg, false, &criteria_with_property); @@ -377,6 +377,7 @@ if (verbosity > 0) PRINT_OUT("========\nConstraint generation error.\n"); no_solution = true; } + solver->set_mip_gap(mip_gap); if (! no_solution) { int s = (timeout > 0) ? solver->solve(timeout) : solver->solve(); if (s <= 0) { diff -Nru ocaml-mccs-1.1+13/src/mccscudf.h ocaml-mccs-1.1+16/src/mccscudf.h --- ocaml-mccs-1.1+13/src/mccscudf.h 2021-04-16 13:58:45.000000000 +0000 +++ ocaml-mccs-1.1+16/src/mccscudf.h 2023-07-05 09:17:53.000000000 +0000 @@ -16,8 +16,8 @@ abstract_solver * solution; // May be NULL with success == 1 for unsatisfiable problems } Solver_return; -Solver_return call_mccs(Solver solver_arg, char *criteria_arg, int timeout, CUDFproblem* the_problem); -Solver_return call_mccs(Solver solver_arg, char *criteria_arg, int timeout, CUDFproblem* the_problem, abstract_solver **solver); +Solver_return call_mccs(Solver solver_arg, char *criteria_arg, int timeout, double mip_gap, CUDFproblem* the_problem); +Solver_return call_mccs(Solver solver_arg, char *criteria_arg, int timeout, double mip_gap, CUDFproblem* the_problem, abstract_solver **solver); int has_backend(Solver_backend backend); diff -Nru ocaml-mccs-1.1+13/src/mccs.ml ocaml-mccs-1.1+16/src/mccs.ml --- ocaml-mccs-1.1+13/src/mccs.ml 2021-04-16 13:58:45.000000000 +0000 +++ ocaml-mccs-1.1+16/src/mccs.ml 2023-07-05 09:17:53.000000000 +0000 @@ -60,7 +60,7 @@ = "set_problem_request" external call_solver: - solver_backend -> string -> int -> problem -> Cudf.package list option + solver_backend -> string -> int -> float -> problem -> Cudf.package list option = "call_solver" external backends_list: @@ -75,15 +75,16 @@ pb let resolve_cudf - ?(verbose=false) ?timeout ?(solver=default_solver) + ?(verbose=false) ?(verbosity=0) ?timeout ?(mip_gap=0.0) + ?(solver=default_solver) criteria (preamble, _, _ as cudf) = let timeout = match timeout with | None -> 0 | Some f -> int_of_float (1000. *. f) in - set_verbosity (if verbose then 1 else 0); + set_verbosity (max (if verbose then 1 else 0) verbosity); let pb = problem_of_cudf cudf in - match call_solver solver criteria timeout pb with + match call_solver solver criteria timeout mip_gap pb with | None -> None | Some sol -> let univ = Cudf.load_universe sol in diff -Nru ocaml-mccs-1.1+13/src/mccs.mli ocaml-mccs-1.1+16/src/mccs.mli --- ocaml-mccs-1.1+13/src/mccs.mli 2021-04-16 13:58:45.000000000 +0000 +++ ocaml-mccs-1.1+16/src/mccs.mli 2023-07-05 09:17:53.000000000 +0000 @@ -19,7 +19,8 @@ (** Resolve the given problem. The timeout is in seconds, default is to never time out. *) val resolve_cudf: - ?verbose:bool -> ?timeout:float -> ?solver:solver_backend -> + ?verbose:bool -> ?verbosity:int -> ?timeout:float -> ?mip_gap:float -> + ?solver:solver_backend -> string -> Cudf.cudf -> Cudf.solution option (** Deprecated, corresponds to the default solver backend selection only *) diff -Nru ocaml-mccs-1.1+13/src/mccs_stubs.cpp ocaml-mccs-1.1+16/src/mccs_stubs.cpp --- ocaml-mccs-1.1+13/src/mccs_stubs.cpp 2021-04-16 13:58:45.000000000 +0000 +++ ocaml-mccs-1.1+16/src/mccs_stubs.cpp 2023-07-05 09:17:53.000000000 +0000 @@ -3,6 +3,7 @@ #endif #define CAML_NAME_SPACE +#include #include #include #include @@ -12,15 +13,15 @@ #include #include #include -#include -#include -#include -#include +#include "cudf.h" +#include "abstract_solver.h" +#include "cudf_reductions.h" +#include "mccscudf.h" #ifdef USEGLPK -#include +#include "glpk_solver.h" #endif #ifdef USECOIN -#include +#include "osi_solver.h" #endif #if OCAML_VERSION < 41200 @@ -499,7 +500,10 @@ custom_hash_default, custom_serialize_default, custom_deserialize_default, - custom_compare_ext_default + custom_compare_ext_default, +#if OCAML_VERSION >= 40800 + 0, +#endif }; extern "C" value set_verbosity(value v) @@ -653,11 +657,11 @@ #endif // Allow C-c to interrupt the solver -Solver_return call_mccs_protected(Solver solver, char *criteria, int timeout, CUDFproblem* cpb) { +Solver_return call_mccs_protected(Solver solver, char *criteria, int timeout, double mip_gap, CUDFproblem* cpb) { Solver_return ret = { 0, "", cpb, NULL }; try { install_sigint_handler(); - ret = call_mccs(solver, criteria, timeout, cpb, &mccs_current_solver); + ret = call_mccs(solver, criteria, timeout, mip_gap, cpb, &mccs_current_solver); mccs_current_solver = NULL; restore_sigint_handler(); } catch (...) { @@ -668,9 +672,9 @@ } extern "C" value call_solver -(value ml_solver_backend, value ml_criteria, value ml_timeout, value ml_problem) +(value ml_solver_backend, value ml_criteria, value ml_timeout, value mip_gap, value ml_problem) { - CAMLparam3(ml_criteria, ml_timeout, ml_problem); + CAMLparam4(ml_criteria, ml_timeout, mip_gap, ml_problem); CAMLlocal2(results, pkg); problem * pb = Problem_pt(ml_problem); CUDFproblem * cpb = pb->pb_cudf_problem; @@ -685,7 +689,7 @@ strcat(criteria, "]"); // caml_release_runtime_system (); - ret = call_mccs_protected(solver, criteria, Int_val(ml_timeout), cpb); + ret = call_mccs_protected(solver, criteria, Int_val(ml_timeout), Double_val(mip_gap), cpb); // caml_acquire_runtime_system (); delete[] criteria; switch (ret.success) { diff -Nru ocaml-mccs-1.1+13/src/new_criteria.cpp ocaml-mccs-1.1+16/src/new_criteria.cpp --- ocaml-mccs-1.1+13/src/new_criteria.cpp 2021-04-16 13:58:45.000000000 +0000 +++ ocaml-mccs-1.1+16/src/new_criteria.cpp 2023-07-05 09:17:53.000000000 +0000 @@ -6,7 +6,7 @@ /*******************************************************/ -#include +#include "new_criteria.h" // Criteria initialization void new_criteria::initialize(CUDFproblem *problem, abstract_solver *solver) { diff -Nru ocaml-mccs-1.1+13/src/new_criteria.h ocaml-mccs-1.1+16/src/new_criteria.h --- ocaml-mccs-1.1+13/src/new_criteria.h 2021-04-16 13:58:45.000000000 +0000 +++ ocaml-mccs-1.1+16/src/new_criteria.h 2023-07-05 09:17:53.000000000 +0000 @@ -9,7 +9,7 @@ #ifndef _NEW_CRITERIA_H_ #define _NEW_CRITERIA_H_ -#include +#include "abstract_criteria.h" // A concrete class for the new criteria // i.e. number of virtual packages that were diff -Nru ocaml-mccs-1.1+13/src/notuptodate_criteria.cpp ocaml-mccs-1.1+16/src/notuptodate_criteria.cpp --- ocaml-mccs-1.1+13/src/notuptodate_criteria.cpp 2021-04-16 13:58:45.000000000 +0000 +++ ocaml-mccs-1.1+16/src/notuptodate_criteria.cpp 2023-07-05 09:17:53.000000000 +0000 @@ -6,7 +6,7 @@ /*******************************************************/ -#include +#include "notuptodate_criteria.h" // Implementation of the not up to date criteria diff -Nru ocaml-mccs-1.1+13/src/notuptodate_criteria.h ocaml-mccs-1.1+16/src/notuptodate_criteria.h --- ocaml-mccs-1.1+13/src/notuptodate_criteria.h 2021-04-16 13:58:45.000000000 +0000 +++ ocaml-mccs-1.1+16/src/notuptodate_criteria.h 2023-07-05 09:17:53.000000000 +0000 @@ -9,7 +9,7 @@ #ifndef _NOTUPTODATE_CRITERIA_H_ #define _NOTUPTODATE_CRITERIA_H_ -#include +#include "abstract_criteria.h" // A concrete class for the notuptodate criteria // i.e. number of virtual packages that are not installed diff -Nru ocaml-mccs-1.1+13/src/osi_solver.h ocaml-mccs-1.1+16/src/osi_solver.h --- ocaml-mccs-1.1+13/src/osi_solver.h 2021-04-16 13:58:45.000000000 +0000 +++ ocaml-mccs-1.1+16/src/osi_solver.h 2023-07-05 09:17:53.000000000 +0000 @@ -12,7 +12,7 @@ #ifndef _OSI_SOLVER_H #define _OSI_SOLVER_H -#include +#include "abstract_solver.h" #include #include @@ -21,8 +21,8 @@ #else #include #endif -#include -#include +#include +#include template class osi_solver: public abstract_solver { diff -Nru ocaml-mccs-1.1+13/src/removed_criteria.cpp ocaml-mccs-1.1+16/src/removed_criteria.cpp --- ocaml-mccs-1.1+13/src/removed_criteria.cpp 2021-04-16 13:58:45.000000000 +0000 +++ ocaml-mccs-1.1+16/src/removed_criteria.cpp 2023-07-05 09:17:53.000000000 +0000 @@ -6,8 +6,8 @@ /*******************************************************/ -#include -#include +#include "removed_criteria.h" +#include "constraint_generation.h" // Criteria initialization void removed_criteria::initialize(CUDFproblem *problem, abstract_solver *solver) { diff -Nru ocaml-mccs-1.1+13/src/removed_criteria.h ocaml-mccs-1.1+16/src/removed_criteria.h --- ocaml-mccs-1.1+13/src/removed_criteria.h 2021-04-16 13:58:45.000000000 +0000 +++ ocaml-mccs-1.1+16/src/removed_criteria.h 2023-07-05 09:17:53.000000000 +0000 @@ -9,7 +9,7 @@ #ifndef _REMOVED_CRITERIA_H_ #define _REMOVED_CRITERIA_H_ -#include +#include "abstract_criteria.h" // A concrete criteria class for the removed criteria // i.e. number of virtual packages that were installed in the initial diff -Nru ocaml-mccs-1.1+13/src/scoeff_solver.h ocaml-mccs-1.1+16/src/scoeff_solver.h --- ocaml-mccs-1.1+13/src/scoeff_solver.h 2021-04-16 13:58:45.000000000 +0000 +++ ocaml-mccs-1.1+16/src/scoeff_solver.h 2023-07-05 09:17:53.000000000 +0000 @@ -10,7 +10,7 @@ #ifndef _SCOEFF_SOLVER_H #define _SCOEFF_SOLVER_H -#include +#include "cudf.h" // Template to allow coefficient saving // mainly used to save objective coefficients