Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aspcud solver: (minor) issue with default criteria? #5605

Open
erikmd opened this issue Jul 18, 2023 · 1 comment
Open

aspcud solver: (minor) issue with default criteria? #5605

erikmd opened this issue Jul 18, 2023 · 1 comment

Comments

@erikmd
Copy link

erikmd commented Jul 18, 2023

A question that arose after a small code review

Shouldn't this line

-count[avoid-version:,true],\

be replaced with
-sum(solution,avoid-version),\
?

because the former one seems to be mccs-specific.

And likewise, -count[missing-depexts:,true]";-sum(solution,missing-depexts).

Details

module Aspcud_def = struct

let default_criteria =
{
crit_default = "-count(removed),\
-sum(solution,avoid-version),\
-sum(request,version-lag),\
-count(down),\
-sum(solution,version-lag),\
-count(changed),\
-sum(solution,missing-depexts)";
crit_upgrade = "-count(down),\
-count(removed),\
-sum(solution,avoid-version),\
-sum(solution,version-lag),\
-sum(solution,missing-depexts),\
-count(new)";
crit_fixup = "-count(changed),\
-count[avoid-version:,true],\
-notuptodate(solution),\
-sum(solution,version-lag),\
-count[missing-depexts:,true]";
crit_best_effort_prefix = Some "+sum(solution,opam-query),";
}
end
module Aspcud = External(Aspcud_def)

module Mccs_def = struct

let default_criteria = {
crit_default = "-removed,\
-count[avoid-version:,true],\
-count[version-lag:,true],\
-changed,\
-count[version-lag:,false],\
-count[missing-depexts:,true],\
-new";
crit_upgrade = "-removed,\
-count[avoid-version:,true],\
-count[version-lag:,false],\
-count[missing-depexts:,true],\
-new";
crit_fixup = "-changed,\
-count[avoid-version:,true],\
-count[version-lag:,false],\
-count[missing-depexts:,true]";
crit_best_effort_prefix = Some "+count[opam-query:,false],";
}
end
module Mccs = External(Mccs_def)

Off-topic context

I noticed this after experiencing timeouts with the default solver (reproducible with opam install irmin-git in some 4.12.1 switch), and diving into opam's /src/solver/ code.

Fortunately, aspcud does work, and makes it possible to obtain a solution in ~20s (unlike builtin-mccs+glpk).

# opam config report
# opam-version         2.1.5 
# self-upgrade         no
# system               arch=x86_64 os=linux os-distribution=debian os-version=11
# solver               builtin-mccs+glpk
# install-criteria     -removed,-count[avoid-version,changed],-count[version-lag,request],-count[version-lag,changed],-count[missing-depexts,changed],-changed
# upgrade-criteria     -removed,-count[avoid-version,changed],-count[version-lag,solution],-count[missing-depexts,changed],-new
# jobs                 7
# repositories         3 (http) (default repo at 45615409)
# pinned               0
# current-switch       /home/erik/forge/git/learn-ocaml
# ocaml:native         true
# ocaml:native-tools   true
# ocaml:native-dynlink true
# ocaml:stubsdir       /home/erik/forge/git/learn-ocaml/_opam/lib/ocaml/stublibs:/home/erik/forge/git/learn-ocaml/_opam/lib/ocaml
# ocaml:preinstalled   false
# ocaml:compiler       4.12.1
@kit-ty-kate
Copy link
Member

Thanks for the report, the aspcud solver backend is an old piece of code stemming from opam 1.2 that isn't used anymore so I'm guessing nobody really noticed it. It indeed doesn't look right so feel free to open a PR to change this if you want.

#5510 should fix your original issue with mccs though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants