What's the better what to add constrains in OptaPlanner









up vote
0
down vote

favorite












I am building an OptaPlan solution for an optimization problem.



I have an List<Integer> called weights
These are the only planning variable in my model, all others are shadow.



I want to make sure that sum of weights (weights[0] + weights[1] + weights[2]... = 1000) , While variables other than weights (shadow) will make sure whats the best solution (Using SimpleScore).



Using a simple EasyScoreCalculator might produce a huge set to search for my problem. I believe penalizing score every time for weights[0] + weights[1] + weights[2]... != 1000 is an un-optimized (slow) method.



Whats the best way to do this.










share|improve this question



























    up vote
    0
    down vote

    favorite












    I am building an OptaPlan solution for an optimization problem.



    I have an List<Integer> called weights
    These are the only planning variable in my model, all others are shadow.



    I want to make sure that sum of weights (weights[0] + weights[1] + weights[2]... = 1000) , While variables other than weights (shadow) will make sure whats the best solution (Using SimpleScore).



    Using a simple EasyScoreCalculator might produce a huge set to search for my problem. I believe penalizing score every time for weights[0] + weights[1] + weights[2]... != 1000 is an un-optimized (slow) method.



    Whats the best way to do this.










    share|improve this question

























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I am building an OptaPlan solution for an optimization problem.



      I have an List<Integer> called weights
      These are the only planning variable in my model, all others are shadow.



      I want to make sure that sum of weights (weights[0] + weights[1] + weights[2]... = 1000) , While variables other than weights (shadow) will make sure whats the best solution (Using SimpleScore).



      Using a simple EasyScoreCalculator might produce a huge set to search for my problem. I believe penalizing score every time for weights[0] + weights[1] + weights[2]... != 1000 is an un-optimized (slow) method.



      Whats the best way to do this.










      share|improve this question















      I am building an OptaPlan solution for an optimization problem.



      I have an List<Integer> called weights
      These are the only planning variable in my model, all others are shadow.



      I want to make sure that sum of weights (weights[0] + weights[1] + weights[2]... = 1000) , While variables other than weights (shadow) will make sure whats the best solution (Using SimpleScore).



      Using a simple EasyScoreCalculator might produce a huge set to search for my problem. I believe penalizing score every time for weights[0] + weights[1] + weights[2]... != 1000 is an un-optimized (slow) method.



      Whats the best way to do this.







      optaplanner






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 10 at 20:15

























      asked Nov 10 at 20:08









      VibeeshanRC

      3,29654085




      3,29654085






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted










          You should penalize the difference between that sum and 1000. So for example, if the weight sum in 920, penalize -80. If the weight it 1019, penalize -19.



          Take a look at the cloud balancing problem, I suspect you'll need to just sum all the weights of the items that have @PlanningVariable Boolean included equal to true.






          share|improve this answer




















            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',
            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%2f53242978%2fwhats-the-better-what-to-add-constrains-in-optaplanner%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            1
            down vote



            accepted










            You should penalize the difference between that sum and 1000. So for example, if the weight sum in 920, penalize -80. If the weight it 1019, penalize -19.



            Take a look at the cloud balancing problem, I suspect you'll need to just sum all the weights of the items that have @PlanningVariable Boolean included equal to true.






            share|improve this answer
























              up vote
              1
              down vote



              accepted










              You should penalize the difference between that sum and 1000. So for example, if the weight sum in 920, penalize -80. If the weight it 1019, penalize -19.



              Take a look at the cloud balancing problem, I suspect you'll need to just sum all the weights of the items that have @PlanningVariable Boolean included equal to true.






              share|improve this answer






















                up vote
                1
                down vote



                accepted







                up vote
                1
                down vote



                accepted






                You should penalize the difference between that sum and 1000. So for example, if the weight sum in 920, penalize -80. If the weight it 1019, penalize -19.



                Take a look at the cloud balancing problem, I suspect you'll need to just sum all the weights of the items that have @PlanningVariable Boolean included equal to true.






                share|improve this answer












                You should penalize the difference between that sum and 1000. So for example, if the weight sum in 920, penalize -80. If the weight it 1019, penalize -19.



                Take a look at the cloud balancing problem, I suspect you'll need to just sum all the weights of the items that have @PlanningVariable Boolean included equal to true.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 13 at 16:44









                Geoffrey De Smet

                14.6k53987




                14.6k53987



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53242978%2fwhats-the-better-what-to-add-constrains-in-optaplanner%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







                    這個網誌中的熱門文章

                    How to read a connectionString WITH PROVIDER in .NET Core?

                    Node.js Script on GitHub Pages or Amazon S3

                    Museum of Modern and Contemporary Art of Trento and Rovereto