Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Optimizing CLPFD performance (cumulative, global_cardinality)

I've written some predicates to solve large scheduling problem and they work well but I'd like them to have some better performance. I've run profile/1 and what I see is that CLPFD-related predicates take 99% of the time. Especially garbage_collect - it takes 37% of the execution time.

Now, what can I do? My code isn't especially complex, it uses a lot of cumulative/2 and some global_cardinality/2, nothing special above that. I've tried some different options for labeling/1 (ff, ffc, bisect), but there is no difference (bisect makes things worse, actually). I've tried raising memory limits with set_prolog_stack/2 (global limit, local limit, global min_free, local min_free).

Is there anything more I can do?

Are there any alternative imlpementations of cumulative/2 or global_cardinality/2 which could have better performance?

like image 825
Grzegorz Adam Kowalski Avatar asked Nov 26 '18 21:11

Grzegorz Adam Kowalski


1 Answers

Without any code and just the problem domain, all I can suggest is consider adding redundant constraints to further cut down search space.

  • User considerations concerning properties of valid solutions can suggest redundant constraints
  • More generic approaches ex. dual Thesis paper
  • Another approach is to identify symmetry in solutions that are not desired then add constraints that remove such symmetry. I.e.
    • one can be "easily" deduced from another
    • they are "similar" in some way e.g. cost
like image 66
peter.cyc Avatar answered Sep 21 '22 17:09

peter.cyc