Optimizing CLPFD performance (cumulative, global_cardinality)












4















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?










share|improve this question




















  • 3





    Consider to use library(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 1 '18 at 17:05






  • 1





    Start with the evaluation license which is for free!

    – false
    Dec 1 '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 5 at 5:14













  • FYI, SICStus has a specialized multi_cumulative/3 constraint.

    – repeat
    Feb 5 at 5:21
















4















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?










share|improve this question




















  • 3





    Consider to use library(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 1 '18 at 17:05






  • 1





    Start with the evaluation license which is for free!

    – false
    Dec 1 '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 5 at 5:14













  • FYI, SICStus has a specialized multi_cumulative/3 constraint.

    – repeat
    Feb 5 at 5:21














4












4








4








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?










share|improve this question
















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?







prolog swi-prolog clpfd






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 30 '18 at 13:27









false

10.8k772146




10.8k772146










asked Nov 26 '18 at 21:12









Grzegorz Adam KowalskiGrzegorz Adam Kowalski

3,70411631




3,70411631








  • 3





    Consider to use library(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 1 '18 at 17:05






  • 1





    Start with the evaluation license which is for free!

    – false
    Dec 1 '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 5 at 5:14













  • FYI, SICStus has a specialized multi_cumulative/3 constraint.

    – repeat
    Feb 5 at 5:21














  • 3





    Consider to use library(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 1 '18 at 17:05






  • 1





    Start with the evaluation license which is for free!

    – false
    Dec 1 '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 5 at 5:14













  • FYI, SICStus has a specialized multi_cumulative/3 constraint.

    – repeat
    Feb 5 at 5:21








3




3





Consider to use library(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





Consider to use library(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 1 '18 at 17:05





@false, I would consider it, but I don't have so much money to buy commercial licence. :-(

– Grzegorz Adam Kowalski
Dec 1 '18 at 17:05




1




1





Start with the evaluation license which is for free!

– false
Dec 1 '18 at 23:16





Start with the evaluation license which is for free!

– false
Dec 1 '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 5 at 5:14







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 5 at 5:14















FYI, SICStus has a specialized multi_cumulative/3 constraint.

– repeat
Feb 5 at 5:21





FYI, SICStus has a specialized multi_cumulative/3 constraint.

– repeat
Feb 5 at 5:21












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53489138%2foptimizing-clpfd-performance-cumulative-global-cardinality%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53489138%2foptimizing-clpfd-performance-cumulative-global-cardinality%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

Calculate evaluation metrics using cross_val_predict sklearn

Insert data from modal to MySQL (multiple modal on website)