[rules-users] planner environmentMode - no reproducibility

Michiel Vermandel mvermand at yahoo.com
Mon Feb 18 07:26:23 EST 2013


>With HashSet/Map, that order changes because Object.hashCode() returns different ints, placing elements in different HashSet buckets, which results into a different order.

Does this mean that in an implementation without "Combination of Simulated Annealing with time spend termination", maps and sets, the list of planning entities should have the same hashcodes every time? Or should they be sorted in the same order if sorted by hashcode?


I have a very, very simple example, on construction phase, not a single map or set, and still sequential runs do not result in the same solution...
What more can I check?

Thanks

 
-----------------
http://www.codessentials.com - Your essential software, for free!
Follow us at http://twitter.com/#!/Codessentials


________________________________
 From: Geoffrey De Smet <ge0ffrey.spam at gmail.com>
To: Rules Users List <rules-users at lists.jboss.org> 
Sent: Tuesday, February 12, 2013 8:16 PM
Subject: Re: [rules-users] planner environmentMode - no reproducibility
 



Op 12-02-13 20:04, Michiel Vermandel schreef:

Hi Geoffrey,
>
>Thanks for your response.
>Indeed I use Simulated Annealing with maximumSecondsSpend. So
        that explains the randomness of the LocalSearchPhase.
>Sorry for not remembering.
>
>Can you tell me please some more on "Use of HashSet in your
        Solution class"?
>Do you mean a planning fact as a HashSet?
>
no, just entities and values, no worries :)

I have some HashMap fields in my Solution (which I also pass in the cloneSolution method) but non of these fields are planning variables/entity.
>
That's fine.

The entity collection is best not a HashSet/Map, because FIRST_FIT
    (as well as some entity selectors) will take the original order of
    the entities to do things.
With HashSet/Map, that order changes because Object.hashCode()
    returns different ints, placing elements in different HashSet
    buckets, which results into a different order.


>Regards,
>Michiel
>
> 
>-----------------
>http://www.codessentials.com - Your essential software, for
          free!
>Follow us at http://twitter.com/#!/Codessentials
>
>
>________________________________
> From: Geoffrey De Smet <ge0ffrey.spam at gmail.com>
>To: Rules Users List <rules-users at lists.jboss.org> 
>Sent: Tuesday, February 12, 2013 12:29 PM
>Subject: Re: [rules-users] planner environmentMode
> 
>
>Common causes:
>- Use of HashSet in your Solution class.
>- Combination of Simulated Annealing with time spend
                termination (clearly documented in manual)
>
>
>Op 12-02-13 12:08, Michiel Vermandel schreef:
>
>Hi,
>>
>>
>>Using Planner 5.5.0-Final, currently my environmentMode is set to DEBUG.
>>As I read here (http://docs.jboss.org/drools/release/5.5.0.Final/drools-planner-docs/html_single/#d0e3120) this mode should produce a reproducible result.
>>Though, even with o nly the construction phase
                      enabled, I get different results from sequential
                      runs on the same machine with the same code.
>>Of course full solution (with LocalSearch) results
                      in different outcome too.
>>
>>How is this possible?
>>
>>Thanks
>>
>>
>>
>>-----------------
>>http://www.codessentials.com - Your essential software, for free!
>>Follow us at http://twitter.com/#!/Codessentials
>>
>>
>>_______________________________________________
rules-users mailing list rules-users at lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
>
>_______________________________________________
>rules-users mailing list
>rules-users at lists.jboss.org
>https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
>
>_______________________________________________
rules-users mailing list rules-users at lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users

_______________________________________________
rules-users mailing list
rules-users at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20130218/093aa5de/attachment-0001.html 


More information about the rules-users mailing list