6

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?

false
  • 10,264
  • 13
  • 101
  • 209
Grzegorz Adam Kowalski
  • 5,243
  • 3
  • 29
  • 40
  • 3
    Consider to use [`library(clpz)`](https://github.com/triska/clpz) which is the successor to `library(clpfd)`. It runs on SICStus. On SWI, there are many problems with the constraint-mechanism - in particular in the context of global constraints. – false Nov 30 '18 at 13:48
  • @false, I would consider it, but I don't have so much money to buy commercial licence. :-( – Grzegorz Adam Kowalski Dec 01 '18 at 17:05
  • 1
    Start with the evaluation license which is for free! – false Dec 01 '18 at 23:16
  • Post some of your code, so people who have (already) have access to SICStus and SWI (and possibly other systems) can work with it! – repeat Feb 05 '19 at 05:14
  • FYI, SICStus has a specialized `multi_cumulative/3` constraint. – repeat Feb 05 '19 at 05:21

1 Answers1

1

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
peter.cyc
  • 1,763
  • 1
  • 12
  • 19