[rules-users] This mailing list is closed, use the google group instead

2014-09-22 Thread Geoffrey De Smet

Just a friendly reminder to use the google group instead:
https://groups.google.com/forum/#!forum/drools-usage 
https://groups.google.com/forum/#%21forum/drools-usage
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] [optaplanner] creating dynamic fact classes(planning entity and planning variables) in Optaplanner

2014-07-24 Thread Geoffrey De Smet
(this is indeed a Drools question)
It's a matter of adding Java annotations on those declared fact types.
I don't know if Drools supports that.

It would be nice if we have an example to demonstrate that.
Feel free to open a jira on OptaPlanner that we should create such an 
example.

On 24-07-14 10:15, colorful.world wrote:
 Hi guys,

 Recently, I have successfully implemented drools project with dynamic domain
 attributes(using declare facts type in drl) and dynamic rules(using drl rule
 string) which allows the users to easily add and change the domain classes
 and rules from GUI.

 But, when we come to have auto allocation with this requirement (using
 OptaPlanner), we are having difficulties to achieve this dynamic classes
 feature.

 So, is there a way we can define like planning entities and variables in
 'declare fact type' (or)
 has anyone achieved this kind of mechanism using Optaplanner??

 Thanks in advance for your time and suggestions.





 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/optaplanner-creating-dynamic-fact-classes-planning-entity-and-planning-variables-in-Optaplanner-tp4030473.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] [optaplanner] creating dynamic fact classes(planning entity and planning variables) in Optaplanner

2014-07-24 Thread Geoffrey De Smet


On 24-07-14 11:19, colorful.world wrote:

Hi Geoffrey,

Thanks for reply.
What we use for declaring fact type is just to have class declaration in drl
file. Since this drl string is loaded at runtime, we are able to have
dynamic class structures and drools rules from DB.
So, I am wondering if we can have dynamic Planning Entity and Variables in
Optaplanner.

That might work. See docs Solver configuration by Java API
http://docs.jboss.org/drools/release/latest/optaplanner-docs/html_single/index.html#d0e2636

Please share, if you have another similar ideas to achieve this.



--
View this message in context: 
http://drools.46999.n3.nabble.com/optaplanner-creating-dynamic-fact-classes-planning-entity-and-planning-variables-in-Optaplanner-tp4030473p4030476.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

[rules-users] OptaPlanner mailing list split off

2014-06-26 Thread Geoffrey De Smet
Hi,

The OptaPlanner mailing list has been split off from the Drools mailing 
list,
at the request of several users, to keep the verbosity of this mailing 
lists down.


If you have a question about OptaPlanner, now use these URL's:
- Ask a usage question on StackOverflow:
   http://stackoverflow.com/questions/tagged/optaplanner
- To start a discussion, use the OptaPlanner developer forum:
   https://groups.google.com/forum/#!forum/optaplanner-dev
   (or mail directly to optaplanner-...@googlegroups.com)


For more information, see optaplanner.org:
   http://www.optaplanner.org/community/forum.html
   http://www.optaplanner.org/community/droolsPlannerRenamed.html

With kind regards,
Geoffrey De Smet
OptaPlanner lead

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Coarse Grained Moves

2014-06-25 Thread Geoffrey De Smet
1) There's 2 course grained moves out of the box in 6.1.0.CR1: 
pillarChangeMove and pillarSwapMove.

And in 6.1.0.CR1 they also include subpillars (which is important).
http://docs.jboss.org/drools/release/latest/optaplanner-docs/html_single/index.html#pillarChangeMoveSelector
Start with trying those.

2) Then look into cartesianProduct selection and mimic selection (see docs).
The cartesianProductMoveSelector allows you to combine to existing 
moves into a new one.
The mimic selection allows you to make sure that those 2 moves change 
the same entity (if needed), but a different variable of course.
I am working on nearBySelection for 6.2 to allow it to select 2 entities 
that are somehow nearBy to each other (for example in the same service 
etc).


3) If the above don't help enough, there's always custom moves (see 
docs): total freedom, but the devil is in the details :)


On 24-06-14 01:58, DwProd . wrote:

Hello there,

I'm pretty new to OptaPlanner, and I must say I'm really impressed 
with the maturity of it all. Great software with a great documentation !


I've been working on a variation of the Cloud Balancing example, with 
a few differences, which make it look like the Machine Reassignment 
problem as well :


- Some processes are already placed and are immovable (using a 
Selection Filter checking a boolean property of the planning entity)
- The Computer (the planning variable) is nullable (basically this is 
Multiple Muti-Dimensional Knapsack problem) which means I added a soft 
constraint penalty for processes with a null host.
- Processes can only be of a few classes (which I called services, a 
Problem Fact). Processes of a given service type have a certain amount 
of required cpu and ram.


Taking these elements into account, I do get very good results with 
OptaPlanner. However, the following constraints always put me into a 
score trap :


- For some services, processes work in groups. For instance, if groups 
are of size 3, having 7 processes is not any better than having 6 
processes. If there were already 2 processes (immovable and placed), I 
should only add 4 processes and not 5, even if there are enough 
resources. For this constraint, I have tried using a rule (medium 
constraint) accumulating processes of that service and using the 
modulo operator with the group size.
- Some services are dependant on one another. For instance, I know 
that if I have n1 groups of processes of the service 1, I require 
Math.ceil(2.5*n1) groups of processes of the service 2. I have 
implemented this similarly with a medium constraint...


With any (or both) of these constraints, little to no processes of the 
concerned services are added and I fail to reach a good solution. I 
have tried benchmarking with several local search methods and various 
parameters, but all give the same results...


I feel like the next logical step would be to used the often mentioned 
in the documentation Coarse Grained Moves but I fail to locate any 
simple example. The Nurse Rostering example seems to use that 
technique to some extent but it seems like an overly complicated 
example, is it not.


Thank you very much for reading this far, if you have any question, 
guideline, or just a trick, I'd be absolutely delighted to hear from you !


Cheers,

Woody


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] Coarse Grained Moves

2014-06-25 Thread Geoffrey De Smet


On 25-06-14 12:58, DwProd . wrote:

Thanks a lot for your answer !

1) I don't think pillar based moves are what I'm looking for, except 
if I can select a pillar based on a Problem Fact (its service in my 
case) and then spread the different entities of the pillar on the 
available hosts (basically setting possibly different planning 
variables for the entities of the pillar).


2) cartesianProductMoveSelector seem more like it, but the number of 
moves to combine is somewhat static is it not ? I can't for instance 
specify in a Planning Entity (using a property) that its move should 
be combined with n other moves of processes of the same type ?
That would be nearBySelection... (note: the name might change before I 
implement).
You need to be able to tell optaplanner that processes of the same type 
are near (~related) to each other and should be moved together.

As stated before, I am working on this for 6.2.


3) I feel like my usecase is complicated enough to have to resort to 
that if there is no built in way to handle it... Does this work by 
implementing a MoveListFactory, or a CompositeMove ? I don't think I 
quite get the difference to be honest...
If you write a custom MoveListFactory (or MoveIteratorFactory), you 
could still opt to go with the build-in moves (such as ChangeMove) or 
combinations of those with CompositeMove. However, because those 
build-in moves require reflection stuff (VariableDescriptor etc), it's 
probably easier to just to write a domain-specific Move.

See the examples that have custom moves.


Thanks again for your time,

Cheers,

Woody


2014-06-25 9:37 GMT+02:00 Geoffrey De Smet ge0ffrey.s...@gmail.com 
mailto:ge0ffrey.s...@gmail.com:


1) There's 2 course grained moves out of the box in 6.1.0.CR1:
pillarChangeMove and pillarSwapMove.
And in 6.1.0.CR1 they also include subpillars (which is important).

http://docs.jboss.org/drools/release/latest/optaplanner-docs/html_single/index.html#pillarChangeMoveSelector
Start with trying those.

2) Then look into cartesianProduct selection and mimic selection
(see docs).
The cartesianProductMoveSelector allows you to combine to
existing moves into a new one.
The mimic selection allows you to make sure that those 2 moves
change the same entity (if needed), but a different variable of
course.
I am working on nearBySelection for 6.2 to allow it to select 2
entities that are somehow nearBy to each other (for example in
the same service etc).

3) If the above don't help enough, there's always custom moves
(see docs): total freedom, but the devil is in the details :)


On 24-06-14 01:58, DwProd . wrote:

Hello there,

I'm pretty new to OptaPlanner, and I must say I'm really
impressed with the maturity of it all. Great software with a
great documentation !

I've been working on a variation of the Cloud Balancing example,
with a few differences, which make it look like the Machine
Reassignment problem as well :

- Some processes are already placed and are immovable (using a
Selection Filter checking a boolean property of the planning entity)
- The Computer (the planning variable) is nullable (basically
this is Multiple Muti-Dimensional Knapsack problem) which means I
added a soft constraint penalty for processes with a null host.
- Processes can only be of a few classes (which I called
services, a Problem Fact). Processes of a given service type have
a certain amount of required cpu and ram.

Taking these elements into account, I do get very good results
with OptaPlanner. However, the following constraints always put
me into a score trap :

- For some services, processes work in groups. For instance, if
groups are of size 3, having 7 processes is not any better than
having 6 processes. If there were already 2 processes (immovable
and placed), I should only add 4 processes and not 5, even if
there are enough resources. For this constraint, I have tried
using a rule (medium constraint) accumulating processes of that
service and using the modulo operator with the group size.
- Some services are dependant on one another. For instance, I
know that if I have n1 groups of processes of the service 1, I
require Math.ceil(2.5*n1) groups of processes of the service 2. I
have implemented this similarly with a medium constraint...

With any (or both) of these constraints, little to no processes
of the concerned services are added and I fail to reach a good
solution. I have tried benchmarking with several local search
methods and various parameters, but all give the same results...

I feel like the next logical step would be to used the often
mentioned in the documentation Coarse Grained Moves but I fail
to locate any simple example. The Nurse Rostering example seems
to use that technique to some extent but it seems like an overly

Re: [rules-users] SelectionFilterChangeMove question

2014-06-23 Thread Geoffrey De Smet

On 16-06-14 13:46, dBijkoo wrote:
 i have a class ChangeMoveFilter which implements
 SelectionFilterChangeMoveSelector to sort out moves that break hard
 constraints.

 In the config it looks like this
  constructionHeuristic
  queuedEntityPlacer
  entitySelector id=placerEntitySelector
  cacheTypePHASE/cacheType
  /entitySelector
  changeMoveSelector
  *filterClasssolver.move.ChangeMoveFilter/filterClass*
  entitySelector mimicSelectorRef=placerEntitySelector/
  valueSelector
  cacheTypePHASE/cacheType
  /valueSelector
  /changeMoveSelector
  /queuedEntityPlacer
  /constructionHeuristic

 However I am getting the impression that the overridden accept function is
 called before anything changed in the entity. Because the (only)
 planningvariable of the entity is still null, which would never be able to
 happen in my understanding.

The CH (construction heursistics) start from an uninitialized solution 
(usually),
so all variables start out as null. This means, for example on the cloud 
balancing example:

ChangeMove.getEntity() is NOT null and an instance of Process
((Process) ChangeMove.getEntity()).getComputer() is null
ChangeMove.getToPlanningValue() is NOT null and an instance of Computer

HTH


 Am i missing something or is the filter move called before anything changes
 in the given entity?



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/SelectionFilter-ChangeMove-question-tp4030063.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Optaplanner - Linking time windows of vendors and the depot

2014-06-23 Thread Geoffrey De Smet

On 19-06-14 15:30, alainb wrote:
 Dear All,

 I'm trying to model multiple time windows of the same vendor by multiplying
 the vendors with different time windows and demand. This seems to work.
 However, I can do the same with the depot but it doesn't represent what I
 need.

 I'm using salomon tw example, but i need certain demand to be there in one
 time window of the depot, and other demand at the other time window of the
 depot. In other words, I would need to link demand at a time window of a
 vendor to a specific time window of the depot.

 Does anyone know if there is any possibility to do this? Or can somebody
 suggest me some further steps. I would be really thankful.

Not 100% sure what you mean, but I think this might work:
Change the ArrivalTimeUpdatingVariableListener as follows:
- Introduce a new shadow variable on Vehicle called returnTime.
- If the last Customer (= for which nextCustomer == null) in a chain
gets a new arrivalTime, also adjust the returnTime of the Vehicle of 
that chain,
such that vehicle.returnTime = lastCustomer.departureTime + 
travelTime(lastCustomer, depot)

 Thank you all in advance,

 Kind Regards,
 Alain



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Optaplanner-Linking-time-windows-of-vendors-and-the-depot-tp4030113.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Strange behaviour with maximumSecondsSpend termination in combination with PlanningVariableListener

2014-06-23 Thread Geoffrey De Smet

On 23-06-14 09:32, dBijkoo wrote:
 When i use the maximumSecondsSpend termination variable in the solverconfig
 it doesnt always fully process the methods in the
 PlanningVariableListenerEntity. Most of the time it gives me a solution
 with semi done shadow variables but not always.


 However when i change the termination to require a scoreAttained it always
 gives me a solution with the correct processed shadow variables.

 Any ideas why this might happen?
That's impossible. If it does, it's a bug.
The VariableListeners should always fire if a variable changed.
The terminations are checked between every move scope (and every step 
scope too of course),
and the variable listeners fire in the same move scope as their variable 
are changed,
so again, that's impossible :)

Can you can create a reproducer which uses the latest version (6.1.0.CR1)
and attach it to a jira issue?
   https://issues.jboss.org/browse/PLANNER

A reproducer is a zip with something that I can run easily locally offline
(preferably with as little as complexity as needed and as little data as 
needed).




 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Strange-behaviour-with-maximumSecondsSpend-termination-in-combination-with-PlanningVariableListener-tp4030128.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] unsubscribed from the rules-users mailing list

2014-06-23 Thread Geoffrey De Smet
Hi Wolfgang,

I just haven't gotten around to split off OptaPlanner dev yet,
but it's on my TODO list.
I am just back from holidays, so I won't get to it this week, hopefully 
next week.

On 23-06-14 11:55, Wolfgang Laun wrote:
 Friends,

 this is to let you know that I have done as the subject says.

 I'd like to thank all that have contributed for their continuing
 efforts. As for myself: I think that this is a good moment to retire,
 with my rapidly diminishing capability of understanding what's going
 on in Guvnor, Optaplanner and other newfangled extensions. Hitting the
 delete button on some incoming email has been the one thing I've
 managed to do faithfully, and frequently.

 Thanks again, and it's been *very* nice meeting you.

 Wolfgang
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Drools Planner: Vehicle routing problems

2014-06-12 Thread Geoffrey De Smet

On 11-06-14 09:30, Neb wrote:
 Thanks Geoffrey

 I have managed to get it working by manually changing some values in the
 latitude and longitude elements in the xml file.

 What I am struggling with is generating an xml file with my own data in each
 element.

 do you have any tips on how to create this xml to drive the vehicle routing
 solution.

Learn XStream :)
   http://xstream.codehaus.org/
There are number of nice tutorials there.
XStream is independent of OptaPlanner, but they work together nicely.
Ask any questions related to the XML format on their mailing list (I am 
subscribed there too).

Alternatively, use JAXB (which works nicely with OptaPlanner too).

   I have tried in c# but I cant get the nodes and attributes in the
 right order.

 Many thanks



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Drools-Planner-Vehicle-routing-problems-tp3772797p4029962.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Vehicle routing demo to show score flexibility in OptaPlanner

2014-06-12 Thread Geoffrey De Smet
See
http://docs.jboss.org/drools/release/latest/optaplanner-docs/html_single/index.html#buildFromSource

and
https://github.com/droolsjbpm/optaplanner/tree/master/optaplanner-examples/src/main/java/org/optaplanner/examples/vehiclerouting

On 12-06-14 10:09, Tuomas Kallio wrote:
 Hi,

 I found Vehicle routing demo to show score flexibility in OptaPlanner from
 youtube http://www.youtube.com/watch?v=4hp_Qg1hFgE

 I did not find this example and source codes from Web, can i download source
 somewhere? Thanks in advance!

   



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Vehicle-routing-demo-to-show-score-flexibility-in-OptaPlanner-tp4030010.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Parallel / Distributed Optaplanner

2014-06-10 Thread Geoffrey De Smet
Hi Jonathan,

On 09-06-14 20:52, jonathan.labin wrote:
 I know that this topic has come up before.  At various times there were
 responses indicating that it was being considered at some level within the
 project(s).

 How has that played out?  Was there progress or has the idea been put on the
 back-burner?  Was something discovered that seems to make the idea not worth
 pursuing?
It's still on my mind and in the roadmap:
   https://issues.jboss.org/browse/PLANNER-76
Other issues have currently taken priority (due to customer requests etc).
http://www.optaplanner.org/download/releaseNotes/releaseNotes6.1.html
In 6.1 (CR1 is being build right now), more preparation for this is in 
place: everything is now on the selector architecture.

The technical challenge is still the same: don't break incremental score 
calculation while parallelizing OptaPlanner,
because incremental score calculation is a far bigger speedup than 
anything parallelization can bring to the table.
The technical design that adheres to this is still the same (last 
comment on PLANNER-76):
Use surrogate entity id's, to allow migrating Move's from 1 
workingSolution to another.


 I'm contemplating doing some investigating of my own to attempt to leverage
 additional hardware in a distributed way for our application.  But I didn't
 want to end up re-discovering things or try things that have already proved
 to be a dead end by an effort ongoing within the project.
Any experiments you do would be interesting for me to observe.
Especially if it's user-domain agnostic, I am interested to merge a PR 
adding this functionality.

 Any insight you could share?
Parallelize the method LocalSearchDecider.pickNextStep() :)
Replace the LocalSearchDecider instance in DefaultLocalSearchPhase with 
your own.
Extend LocalSearchPhaseConfig to be able to do that.




 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Parallel-Distributed-Optaplanner-tp4029930.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] No such field org.optaplanner.core.config.heuristic.selector.value.chained.SubChainSelectorConfig.entitySelector

2014-06-06 Thread Geoffrey De Smet

On 06-06-14 14:13, dBijkoo wrote:
 when I use this code:
   subChainChangeMoveSelector
  subChainSelector
  entitySelector
subChainSelector doesn't supports an entitySelector element,
only a valueSelector element.

See 
https://github.com/droolsjbpm/optaplanner/blob/master/optaplanner-core/src/main/java/org/optaplanner/core/config/heuristic/selector/value/chained/SubChainSelectorConfig.java#L38-38

but subChainChangeMoveSelector does supports a entityClass, which is 
probably what you want to do:

subChainChangeMoveSelector
   entityClassmodel.ScheduleBlockPeriod/entityClass
   subChainSelector
 minimumSubChainSize2/minimumSubChainSize
 ...


See 
https://github.com/droolsjbpm/optaplanner/blob/master/optaplanner-core/src/main/java/org/optaplanner/core/config/heuristic/selector/move/generic/chained/SubChainChangeMoveSelectorConfig.java#L36-36


  entityClassmodel.ScheduleBlockPeriod/entityClass

  /entitySelector
  minimumSubChainSize2/minimumSubChainSize
  maximumSubChainSize40/maximumSubChainSize
  /subChainSelector
  valueSelector
  variableNamenextScheduleBlockPeriod/variableName
  /valueSelector

  selectReversingMoveTootrue/selectReversingMoveToo

  /subChainChangeMoveSelector

 I get the following error:
 /com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$UnknownFieldException:
 No such field
 org.optaplanner.core.config.heuristic.selector.value.chained.SubChainSelectorConfig.entitySelector
  Debugging information 
 field   : entitySelector
 class   :
 org.optaplanner.core.config.heuristic.selector.value.chained.SubChainSelectorConfig
 required-type   :
 org.optaplanner.core.config.heuristic.selector.value.chained.SubChainSelectorConfig
 converter-type  :
 com.thoughtworks.xstream.converters.reflection.ReflectionConverter
 line number : 57
 class[1]:
 org.optaplanner.core.config.heuristic.selector.move.generic.chained.SubChainChangeMoveSelectorConfig
 class[2]:
 org.optaplanner.core.config.heuristic.selector.move.composite.CartesianProductMoveSelectorConfig
 class[3]:
 org.optaplanner.core.config.localsearch.LocalSearchSolverPhaseConfig
 class[4]: org.optaplanner.core.config.solver.SolverConfig
 version : 1.4.7
 ---
   at
 com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.handleUnknownField(AbstractReflectionConverter.java:495)
   at
 com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:351)
   at
 com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:257)
   at
 com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
   at
 com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
   at
 com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
   at
 com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshallField(AbstractReflectionConverter.java:474)
   at
 com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:406)
   at
 com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:257)
   at
 com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
   at
 com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
   at
 com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
   at
 com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
   at
 com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:377)
   at
 com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:257)
   at
 com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
   at
 com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
   at
 com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
   at
 com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
   at
 com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:377)
   at
 

Re: [rules-users] No such field org.optaplanner.core.config.heuristic.selector.value.chained.SubChainSelectorConfig.entitySelector

2014-06-06 Thread Geoffrey De Smet

On 06-06-14 16:09, dBijkoo wrote:
 This should be changed here:
 http://docs.jboss.org/drools/release/6.0.1.Final/optaplanner-docs/html_single/index.html#subChainChangeMoveSelector
 and at the subChainSwapMoveSelector chapter to avoid others running into the
 same problem!!
Done, thanks for reporting :)


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] No such field org.optaplanner.core.config.heuristic.selector.value.chained.SubChainSelectorConfig.entitySelector

2014-06-06 Thread Geoffrey De Smet
The docs were wrong.
Docs fixed for 6.1.0.CR1:
   http://github.com/droolsjbpm/optaplanner/commit/496ef134b


On 06-06-14 16:15, Geoffrey De Smet wrote:
 On 06-06-14 14:13, dBijkoo wrote:
 when I use this code:
subChainChangeMoveSelector
   subChainSelector
   entitySelector
 subChainSelector doesn't supports an entitySelector element,
 only a valueSelector element.

 See
 https://github.com/droolsjbpm/optaplanner/blob/master/optaplanner-core/src/main/java/org/optaplanner/core/config/heuristic/selector/value/chained/SubChainSelectorConfig.java#L38-38

 but subChainChangeMoveSelector does supports a entityClass, which is
 probably what you want to do:

 subChainChangeMoveSelector
 entityClassmodel.ScheduleBlockPeriod/entityClass
 subChainSelector
   minimumSubChainSize2/minimumSubChainSize
   ...


 See
 https://github.com/droolsjbpm/optaplanner/blob/master/optaplanner-core/src/main/java/org/optaplanner/core/config/heuristic/selector/move/generic/chained/SubChainChangeMoveSelectorConfig.java#L36-36


   
 entityClassmodel.ScheduleBlockPeriod/entityClass

   /entitySelector
   minimumSubChainSize2/minimumSubChainSize
   maximumSubChainSize40/maximumSubChainSize
   /subChainSelector
   valueSelector
   variableNamenextScheduleBlockPeriod/variableName
   /valueSelector

   selectReversingMoveTootrue/selectReversingMoveToo

   /subChainChangeMoveSelector

 I get the following error:
 /com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$UnknownFieldException:
 No such field
 org.optaplanner.core.config.heuristic.selector.value.chained.SubChainSelectorConfig.entitySelector
  Debugging information 
 field   : entitySelector
 class   :
 org.optaplanner.core.config.heuristic.selector.value.chained.SubChainSelectorConfig
 required-type   :
 org.optaplanner.core.config.heuristic.selector.value.chained.SubChainSelectorConfig
 converter-type  :
 com.thoughtworks.xstream.converters.reflection.ReflectionConverter
 line number : 57
 class[1]:
 org.optaplanner.core.config.heuristic.selector.move.generic.chained.SubChainChangeMoveSelectorConfig
 class[2]:
 org.optaplanner.core.config.heuristic.selector.move.composite.CartesianProductMoveSelectorConfig
 class[3]:
 org.optaplanner.core.config.localsearch.LocalSearchSolverPhaseConfig
 class[4]: org.optaplanner.core.config.solver.SolverConfig
 version : 1.4.7
 ---
  at
 com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.handleUnknownField(AbstractReflectionConverter.java:495)
  at
 com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:351)
  at
 com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:257)
  at
 com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
  at
 com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
  at
 com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
  at
 com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshallField(AbstractReflectionConverter.java:474)
  at
 com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:406)
  at
 com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:257)
  at
 com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
  at
 com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
  at
 com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
  at
 com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
  at
 com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:377)
  at
 com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:257)
  at
 com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
  at
 com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
  at
 com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
  at
 com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50

Re: [rules-users] Drools Planner: Vehicle routing problems

2014-05-30 Thread Geoffrey De Smet
I guess it's a matter of adjusting these 2 files to your needs:

https://github.com/droolsjbpm/optaplanner/blob/master/optaplanner-examples/src/main/java/org/optaplanner/examples/vehiclerouting/swingui/VehicleRoutingWorldPanel.java
https://github.com/droolsjbpm/optaplanner/blob/master/optaplanner-examples/src/main/java/org/optaplanner/examples/vehiclerouting/swingui/VehicleRoutingSchedulePainter.java

Maybe someone else in the community has done similar changes and is 
willing to share the implementation?

On 30-05-14 03:05, Neb wrote:
 Hi ge0ffrey

 In the optoplanner example of the vehicle routing is there a way to change
 the scale of the map?

 as it is set to world and if locations are added within the same town or
 city they are too close on the map.

 also how would this example be altered to show the travel time around the
 route?

 Regards, Neb



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Drools-Planner-Vehicle-routing-problems-tp3772797p4029766.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Slf4j Log4j logger not working with Drools drl while using as a global variable.

2014-05-27 Thread Geoffrey De Smet
Check if the logger isn't null (by adding a System.out in the then part 
of the rule).

If that's the case, then that error message is pretty poor (or even 
incorrect):
java.lang.RuntimeException: cannot invoke method: info
It should clearly talk about a NullPointer instead.
So, if that's the case, create a jira issue.
   https://issues.jboss.org/browse/DROOLS


On 27-05-14 07:09, Soumya.plavaga wrote:
 I am using global slf4j log4j logger as a global variable within our drl and
 inserting that global logger value at runtime into kiesession. While we are
 trying to do logger.info with multiple arguments then it's giving the
 following exception stack trace -

 Exception executing consequence for rule Test Logger 2 in
 test.rules.system: java.lang.RuntimeException: cannot invoke method: info
   at
 org.drools.core.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
   at
 org.drools.core.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1027)
   at org.drools.core.phreak.RuleExecutor.fire(RuleExecutor.java:129)
   at
 org.drools.core.phreak.RuleExecutor.evaluateNetworkAndFire(RuleExecutor.java:71)
   at
 org.drools.core.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:935)
   at
 org.drools.core.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1200)
   at
 org.drools.core.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:952)
   at
 org.drools.core.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:926)
   at
 org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:232)
   at
 test.platform.rules.executor.service.impl.RuleExecutorServiceImplTest.testExecuteRule(RuleExecutorServiceImplTest.java:230)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
   at
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:606)
   at
 org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
   at
 org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
   at
 org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
   at
 org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
   at
 org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
   at
 org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83)
   at
 org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
   at
 org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:232)
   at
 org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:89)
   at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
   at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
   at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
   at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
   at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
   at
 org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
   at
 org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
   at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
   at
 org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:175)
   at
 org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
   at
 org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
   at
 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
   at
 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
   at
 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
   at
 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
 Caused by: java.lang.RuntimeException: cannot invoke method: info
   at
 org.mvel2.optimizers.impl.refl.nodes.MethodAccessor.getValue(MethodAccessor.java:63)
   at
 org.mvel2.optimizers.impl.refl.nodes.VariableAccessor.getValue(VariableAccessor.java:37)
   at org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:108)
   at org.mvel2.MVELRuntime.execute(MVELRuntime.java:86)
   at
 

Re: [rules-users] NullPointerException when calling ScoreDirector.beforeEntityAdded with new Vehicle

2014-05-12 Thread Geoffrey De Smet
Thanks for reporting (for both jira's)

On 12-05-14 09:27, Hagai wrote:
 Link to the opened JIRA:  https://issues.jboss.org/browse/PLANNER-238
 https://issues.jboss.org/browse/PLANNER-238



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/NullPointerException-when-calling-ScoreDirector-beforeEntityAdded-with-new-Vehicle-tp4029434p4029514.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] How to implement immovable planning entities for vehicle routing problem?

2014-05-08 Thread Geoffrey De Smet

On 07-05-14 18:22, Hagai wrote:
 I am implementing a vehiclerouting like solution with OptaPlanner
 6.0.1.Final.
 According to the documentation for continuous planning, the way to 'lock'
 parts of the solution is by declaring a movableEntitySelectionFilter on the
 planning entity: Section 14.3.1. Immovable planning entities.
 However, this does not work well with chained entities where parts of the
 solution is calculated, like in the vehiclerouting example.

 For example, let's assume the following chains, where [Customer A] and
 [Customer C] are immovable:
 [Vehicle 1] - *[Customer A]* - [Customer B]
 [Vehicle 2] - *[Customer C]* - [Customer D]

 Even if we filter immovable entities, a move to set the variable [Vehicle 2]
 as previous standstill to [Customer B] can be selected with the following
 result that changes the immovable entity [Customer C]:
 [Vehicle 1] - *[Customer A]*
 [Vehicle 2] - [Customer B] - *[Customer C]* - [Customer D]

 A workaround is to filter moves with immovable entities as well as moves
 with immovable variables (variables are also entities). However, this can
 only work when immovable entities are placed at the beginning of chines
 before any movable entities.

 Is there a better way to implement immovable planning entities for vehicle
 routing problem?

Can you report this in a jira?
As part of fixing that jira, I 'll add the ability to lock entities in 
the example TSP or VRP (like it's possible in course scheduling).



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/How-to-implement-immovable-planning-entities-for-vehicle-routing-problem-tp4029467.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] NullPointerException when calling ScoreDirector.beforeEntityAdded with new Vehicle

2014-05-06 Thread Geoffrey De Smet
Thanks for reporting.

That's a terminology bug.
The Vehicle isn't both an entity and not an entity...
A) It's an entity because it has @PlanningVariable and a shadow variable.
B) But it's also not an entity because it doesn't have any genuine 
variables,
and therefore ScoreDirector throws that NPE... (which should be a better 
error message too).
I 'll fix this for 6.1, probably by discarding B).

Could you file a jira for this?
   https://issues.jboss.org/browse/PLANNER

Workaround for 6.0.1:
Presuming you're doing this in a ProblemFactChange,
call scoreDirector.beforeProblemFactRemoved() instead of 
beforeEntityRemoved()
= Treat it as a problem fact for that... but treat is as an entity 
for everything else.

hth

On 06-05-14 16:17, Hagai wrote:
 Using OptaPlanner 6.0.1.Final with problem like vehiclerouting.

 In vehiclerouting the Vehicle and Customer are both planning entities. They
 both implements the Standstill interface that is annotated with
 @PlanningEntity and their collections are annotated with
 @PlanningEntityCollectionProperty on the solution class.

 Flowing the code of VehicleRoutingPanel.insertLocationAndCustomer to insert
 a new Vehicle to the solution, my code is failing when the new Vehicle is
 reported to the score director:
 scoreDirector.beforeEntityAdded(newVehicle);

 The exception is NullPointerException at
 org.optaplanner.core.impl.domain.variable.listener.PlanningVariableListenerSupport.beforeEntityAdded(PlanningVariableListenerSupport.java:54)

 It looks like the PlanningVariableListenerSupport.entityVariableListenerMap
 does not have item for the Vehicle entity, there is only one item for the
 Customer entity in this map.

 I get the same problem when calling ScoreDirector.beforeEntityRemoved to
 remove a Vehicle.

 Is this a bug or do I need to handle Vehicle entities differently?



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/NullPointerException-when-calling-ScoreDirector-beforeEntityAdded-with-new-Vehicle-tp4029434.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Integrate jBPM with OptaPlanner

2014-05-02 Thread Geoffrey De Smet

On 01-05-14 16:36, jjn wrote:
 Hi Geoffrey

 I was thinking something like this
 1. Create a data model for a request in jBPM, where there will be a fields -
 id, complexity
 2. Create a process model in jBPM for incoming requests being processed by
 specific actors
 3. Somehow call optaplanner (??)

 Now lets say there are 10 requests
 Optaplanner can be used to assign requests to employees (based on the
 capability of the employee and the complexity of the request), for eg.
 request id 1, request id 3 are done by employee 2.
Sounds like the CloudBalancing example: instead of processes you have 
requests, instead of machines you have employees.
The capacity of the employee should be at least the sum of the demand of 
the requests.

You might also want to add a soft constraints for fairness/load 
balancing (see docs section fairness constraints).

 Now in jBPM, I want request 1 and request 3 to be processed by employee
 2(actor)
I'd use immovable planning entities for that. See this blog:
http://www.optaplanner.org/blog/2013/10/11/WillSkynetControlOurSchedule.html
Basically, you're locking some requests to some employees
and ask OptaPlanner to schedule the rest around that.

 Maybe use a decision table -
 When there is request 1 and request 3, then  assign employee 2 to do a
 particular task
For decision tables, see my latest 2 video's and the dinner party 
example in 6.1.0.Beta3.
Decision tables already work in 6.0.1.Final already too (but there's no 
example there).




 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Integrate-jBPM-with-OptaPlanner-tp4029384p4029398.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] OptaPlanner: Solver.isEveryProblemFactChangeProcessed() return true before the last fact change is processed

2014-05-02 Thread Geoffrey De Smet
Bug fixed:
https://github.com/droolsjbpm/optaplanner/commit/4389730069327837fb375f3b1702911a1ee7e294
   I went for a slightly different solution, to confine the logic as 
much as possible in the BasicPlumbingTermination class.

Thanks for reporting :)

On 01-05-14 10:36, Hagai Shatz wrote:
 I'm working on a scheduling solution for traveling engineers. Similar to 
 vehicle routing but with daily routes and more complex constrains (like 
 dependencies between visits).


 Thanks,
 Hagai Shatz

 On 30 Apr 2014, at 20:31, Geoffrey De Smet ge0ffrey.s...@gmail.com wrote:


 On 30-04-14 15:07, Hagai wrote:
 I do use it from other threads in the following 2 scenarios:

 1. In a thread that monitors a stream of messages with fact changes. Just
 before the thread add a new problem fact change to the solver, the code
 checks if the message is relevant by examining the current solution facts.
 But if there is a pending problem fact change in the queue, this evaluation
 cannot be done and a new problem fact change must be added (even if it will
 not do any change when processed). The idea is to minimize the situations
 where a message does not result in any change to facts and the solver
 restart itself to process the a fact change that does not change anything.

 2. The solver produce many new solutions when starting and after fact
 changes. After some time, less new solutions are found. But when a new
 solution is found, some additional improvements are usually found shortly
 after. To reduce the amount of new best solutions produced by the
 application, a thread is scheduled to read/save/send the best solution after
 a short idle time (no new best solution for X ms). To make sure the best
 solution is valid, the code checks if every problem facts change processed.
 If there are still fact changes to process, the solver will produce another
 best solution shortly with the updated facts.
 Thanks for the feedback: it's very helpful for me to know how it's used
 better.
 Out of interest: What kind of planning problem are you solving?

 I hope this fix is simple to do so I can remove my workaround.
 Yes, I'll fix the problem (I might go for an alternative on the
 peek()'s) on Friday (holiday tomorrow with plans).

 BTW, I'm looking forward to use the new demon mode (instead of a similar
 implementation outside of the solver).
 Grab 6.1.0-SNAPSHOT if you can't wait. Or read the SNAPSHOT docs.
 Feedback/concerns welcome.



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/OptaPlanner-Solver-isEveryProblemFactChangeProcessed-return-true-before-the-last-fact-change-is-procd-tp4029389p4029392.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] halting on sub-optimal solution - OptaPlanner

2014-05-02 Thread Geoffrey De Smet
It might be stuck in a local optima, some things to check:

A) Read the section score trap in the docs, to verify you don't have a 
score trap

B) The default move types (changeMoveSelector and swapMoveSelector) 
aren't strong enough to escape local optima.
B1) Try adding a pillarSwapMoveSelector.
I am adding a pillarChangeMove for 6.1.0.Beta4, and probably also 
support for selecting subpillars.
B2) Take a look at that suboptimal best solution and figure out what 
course-grained move it needs to do to escape the local optima.
Then either creates a custom Move (see docs MoveListFactory)
B3) or compose the build-in ones with cartesianProductMoveSelector and 
mimicSelection.

C) For very small datasets, tabu search's entity size can be too large 
(especially with subchain move selectors and pillar move selectors).
Tabu ratio (see docs) is a way around that.

D) If your dataset is really small, you can always just switch to brute 
force
or the much faster branchAndBound (as of 6.1.0.Beta3).
Note: neither scale to medium/big datasets.

HTH

On 02-05-14 17:06, nkgxgongxi wrote:
 Hi everyone,

 Could anyone help me by providing me some advice on how to make the
 searching more efficient?

 I wrote a program based on OptaPlanner to solve a scheduling problem, and I
 knew the expected optimal solution. My program runs well to keep finding
 better solution, however, when it comes to a solution which is really close
 to the optimal one, the program just halts there. I mean, it keeps
 searching, but can't reach the optimal even after 10hrs of running time.

 I am currently using tabu search and simulate Annealing to control the local
 search, and I have tried several different combinations of parameters, but
 there is no improvement found.

 I will appreciate your help.

 Regards,
 Gong



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/halting-on-sub-optimal-solution-tp4029411.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Integrate jBPM with OptaPlanner

2014-04-30 Thread Geoffrey De Smet
So the JBPM human task assignments are a *task assignment problem* you 
want to solve with OptaPlanner? Kris and I spoke about building some 
out-of-the-box integration/docs for this. But for now you 'll have to do 
the integration yourself. OptaPlanner is being successfully used for 
other task assignment problems 
http://www.optaplanner.org/learn/caseStudies/OptaPlannerCaseStudy_RJV_2013-06-14.pdf 
already.



Duplicates
http://stackoverflow.com/questions/23372089/integrate-jbpm-with-optaplanner

On 29-04-14 20:12, jjn wrote:

Hi, how can I integrate jBPM with OptaPlanner. I have solved a problem using
OptaPlanner, where there are a number of requests which are optimally
assigned to particular employees, based on certain constraints. Now I want
to create a dispatcher in jBPM, where certain employees(actors) can solve
certain requests(process instances). Any idea how I can go about this
problem ?



--
View this message in context: 
http://drools.46999.n3.nabble.com/Integrate-jBPM-with-OptaPlanner-tp4029384.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] OptaPlanner: Solver.isEveryProblemFactChangeProcessed() return true before the last fact change is processed

2014-04-30 Thread Geoffrey De Smet

On 30-04-14 12:17, Hagai wrote:
 Using OptaPlanner 6.0.1.Final and following the documentation for real-time
 planning:
 Alternatively, you can subscribe to the BestSolutionChangedEvent.
 A BestSolutionChangedEvent doesn't guarantee that every ProblemFactChange
 has been
 processed already, so check Solver.isEveryProblemFactChangeProcessed() and
 ignore any
 BestSolutionChangedEvent fired while that method returns false.

 However, Solver.isEveryProblemFactChangeProcessed() return true before the
 last fact change is processed.
 This is documented in the code DefaultSolver.java: *// TODO bug: the last
 ProblemFactChange might already been polled, but not processed yet*

 I believe this can be fixed using the following code in
 DefaultSolver.checkProblemFactChanges:

  ProblemFactChange problemFactChange =
 problemFactChangeQueue*.peek()*;
  while (problemFactChange != null) {
  score = doProblemFactChange(problemFactChange);
  *problemFactChangeQueue.poll();*
  count++;
  problemFactChange = problemFactChangeQueue*.peek()*;
  }

 This way the queue will not be empty until the fact change is processed.

Thanks for reporting.
This is definitely an issue indeed, if 
isEveryProblemFactChangeProcessed() is called from a different thread 
than then solver thread.
The javadoc clearly promises that isEveryProblemFactChangeProcessed() is 
thread-safe.
I 'll take a look into fixing it with your suggestion.

Note: In practice, you 'll usually call 
isEveryProblemFactChangeProcessed() in the bestSolutionChanged() event, 
which is called in the solver thread,
so it's not an issue in that particular case.
For 6.1.0.Beta4, I 've cleaned up the docs to describe that usage 
pattern better:
https://github.com/droolsjbpm/optaplanner/commit/256fa1fe285392f8ad81b1a40816db641a768bb9





 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/OptaPlanner-Solver-isEveryProblemFactChangeProcessed-return-true-before-the-last-fact-change-is-procd-tp4029389.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] OptaPlanner scalability

2014-04-30 Thread Geoffrey De Smet

On 30-04-14 15:04, Rupesh M G wrote:
 Hi,

 I tested Optaplanner successfully for a fleet planning application.
 Upto 1200 trips with around 80 vehicles for 3 days is fine.
 I'm reaching the target of 0 hard constraints in less than 30 minutes.

 But my target is to plan for a month with 12000 trips using 80 vehicles.
 This time it didn't complete even after 12 hours.
 I found the memory ( 500 MB) and CPU (25%) usage is less.
 So tried running 3 solver threads and grouping the vehicles.
 Now CPU usage increases.

 I followed the vehicle routing sample application and the config xml is very 
 similar.
 I used late acceptance (200) and accept count (1000).

 I'm using incremental score calculation; and applied change  swap filters in 
 the config xml.

 Requesting experts for some thoughts on how Optaplanner can scale on similar 
 situations.

See the 2 blog articles by Roman about VRP in this section:
   http://www.optaplanner.org/learn/testimonialsAndCaseStudies.html
He uses geo-fencing to scale.

I don't believe geo-fencing is the best approach,
I am working on nearby selection, which I believe will be better 
(because it still allows any location to go to any other location):
   https://issues.jboss.org/browse/PLANNER-202
Some time ago, I did an experiment with nearby selection on a TSP 
variant with 150 000 locations and it worked well.

Also, the 6.1 beta's have seen some small perf improvements related to 
vehicle routing IIRC.


 Thanks  Regards,
 Rupesh





 DISCLAIMER: The information in this e-mail and any attachment is intended 
 only for the person to whom it is addressed and may contain confidential 
 and/or privileged material. If you have received this e-mail in error, kindly 
 contact the sender and destroy all copies of the original communication. IBS 
 makes no warranty, express or implied, nor guarantees the accuracy, adequacy 
 or completeness of the information contained in this email or any attachment 
 and is not liable for any errors, defects, omissions, viruses or for 
 resultant loss or damage, if any, direct or indirect.

 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] OptaPlanner: Solver.isEveryProblemFactChangeProcessed() return true before the last fact change is processed

2014-04-30 Thread Geoffrey De Smet

On 30-04-14 15:07, Hagai wrote:
 I do use it from other threads in the following 2 scenarios:

 1. In a thread that monitors a stream of messages with fact changes. Just
 before the thread add a new problem fact change to the solver, the code
 checks if the message is relevant by examining the current solution facts.
 But if there is a pending problem fact change in the queue, this evaluation
 cannot be done and a new problem fact change must be added (even if it will
 not do any change when processed). The idea is to minimize the situations
 where a message does not result in any change to facts and the solver
 restart itself to process the a fact change that does not change anything.

 2. The solver produce many new solutions when starting and after fact
 changes. After some time, less new solutions are found. But when a new
 solution is found, some additional improvements are usually found shortly
 after. To reduce the amount of new best solutions produced by the
 application, a thread is scheduled to read/save/send the best solution after
 a short idle time (no new best solution for X ms). To make sure the best
 solution is valid, the code checks if every problem facts change processed.
 If there are still fact changes to process, the solver will produce another
 best solution shortly with the updated facts.

Thanks for the feedback: it's very helpful for me to know how it's used 
better.
Out of interest: What kind of planning problem are you solving?


 I hope this fix is simple to do so I can remove my workaround.

Yes, I'll fix the problem (I might go for an alternative on the 
peek()'s) on Friday (holiday tomorrow with plans).


 BTW, I'm looking forward to use the new demon mode (instead of a similar
 implementation outside of the solver).

Grab 6.1.0-SNAPSHOT if you can't wait. Or read the SNAPSHOT docs.
Feedback/concerns welcome.




 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/OptaPlanner-Solver-isEveryProblemFactChangeProcessed-return-true-before-the-last-fact-change-is-procd-tp4029389p4029392.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Is OptaPlanner the right tool for the job?

2014-03-25 Thread Geoffrey De Smet


On 25-03-14 13:12, Andrzej Raczkowski wrote:

Hello all OptaPlanner geeks! :)
This is my first post on this list. I would be very grateful if 
somebody could give me any advice in this matter (details below).



We need to plan the schedule for repair units consisting of few people 
with some particular skills and equipment.


What we know / What the Client has:
1. tasks - different tasks have different attributes like:
a) priority
b) time needed to fix a problem
c) number of employees needed
d) employees' skills
i) destination coordinates of the task to perform (we can use GIS to 
get road costs)
2. established number of employees working according to work schedule 
and having particular skills

3. established number of vehicles and equipment

What we want - to be able to plan tasks with the assumption that a 
good schedule:

1. will 'keep in mind' all limitations (number of employees and equipment)
2. will plan all tasks in the shortest possible amount of time.

We want to optimize time that it takes to perform all tasks, and time 
would be the only flexible feature here.


Is OptaPlanner the right tool to this kind of problems?


Sounds like a typical vehicle routing problem.

Take a look at these video's:
  https://www.youtube.com/watch?v=4hp_Qg1hFgE
  https://www.youtube.com/watch?v=BxO3UFmtAPg
And the VRP example.

To incoorporate the GIS system, Roman wrote an interesting blog about 
doing that in practice, find links here:

  http://www.optaplanner.org/learn/testimonialsAndCaseStudies.html

hth


Thank you and have a nice day
Andrzej




___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] physical resource allocation problem

2014-03-18 Thread Geoffrey De Smet


On 18-03-14 09:24, Scott Danner wrote:

Hello,

We have a resource allocation problem. Could this be solved with 
OptaPlanner?


Here it is:
There are N projects located in various places that need work done 
with machines (just one machine type for all machine work).
Work can be parallelized, e.g. 6 work days can be done in 6 calendar 
days by one machine or in 3 calendar days by two, or in 4 calendar 
days by 2 machines (one works 4, other 2).

Take a look at these examples:

Cloud Balancing
  https://www.youtube.com/watch?v=xhCtuM-Hiic
use as less machines as possible

Project Job Scheduling
  https://www.youtube.com/watch?v=_2zweB9JD7c
in case the work has dependencies on other work items

Vehicle routing with Time Windows
  https://www.youtube.com/watch?v=BxO3UFmtAPg
When a work gets assigned to a machine, use shadow variables to capture 
when the work will be done.

See docs about variable listeners



How to best allocate machines to projects?
Looking at planned project work, how many machines are needed for each 
calendar day? How many machines should we buy, and how many to rent, 
and when?



Details

For each project, the work can  must be done only in some selected 
calendar periods.

Machine locations are always known.

Machine costs:
* moving from location A to location B (per km). Moving also takes 
time, and a machine can be moved a maximum amount of km per day.

* operating (per day)
* staying in a project location (per day)
* staying in a hangar (per day)
* being rented for one day from location L (total cost = transport 
from rent location to project location and back, and daily rent)

* being purchased


These are all just constraints, I don't see any special stuff there.
To make them easy to write, the domain classes will need a (shadow) 
variable that says when a work starts.



A machine also needs an operator, but for now that can be considered a 
single unit.


Ideally, also take into accounting weather for each project location. 
Weather might be known with 2 weeks in advance. Just re-plan by 
blocking the rainy days for some projects?

Yes, see docs on repeated planning.


Thanks,
Scott


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] Creating selection filter for PlanningEntity with 4 planning variables

2014-03-18 Thread Geoffrey De Smet

On 18-03-14 11:24, maciekpob wrote:
 Hello again,

 o) I completed the changes that you suggested last year concerning the issue
 that I am encountering with opta planner with our application.
   
 Note that I have at most one or two planning entities in the Solution (in
 my test case).

 Setting cacheType=PHASE on UnionMoveSelector level or cacheType=STEP
 on UnionMoveSelector level results in:

 java.lang.IllegalStateException: The selector
 (Union([ChangeMoveSelector(Filtering(FromSolutionEntitySelector(CloudPlacement)),
 FromSolutionPropertyValueSelector(offeredCPU)),
 ChangeMoveSelector(FromSolutionEntitySelector(CloudPlacement),
 FromSolutionPropertyValueSelector(offeredDisk)),
 ChangeMoveSelector(FromSolutionEntitySelector(CloudPlacement),
 FromSolutionPropertyValueSelector(offeredMemory)),
 ChangeMoveSelector(FromSolutionEntitySelector(CloudPlacement),
 FromSolutionPropertyValueSelector(offeredVolume))]))'s non-last
 childMoveSelector
 (ChangeMoveSelector(Filtering(FromSolutionEntitySelector(CloudPlacement)),
 FromSolutionPropertyValueSelector(offeredCPU))) has neverEnding (true) with
 randomSelection (false).
So the union needs to do original selection, but one of his childs is 
neverEndering.
That's never  a good thing.

 Setting cacheType=PHASE for each change move selector results in:

 Caused by: java.lang.IllegalStateException: The selector
 (Caching(ChangeMoveSelector(Filtering(FromSolutionEntitySelector(CloudPlacement)),
 FromSolutionPropertyValueSelector(offeredCPU
that's the caching PHASE one wrapping the child.
   has a childMoveSelector
 (ChangeMoveSelector(Filtering(FromSolutionEntitySelector(CloudPlacement)),
 FromSolutionPropertyValueSelector(offeredCPU))) with neverEnding (true).
Hmm, why is this child neverEnding?
Is the entitySelector or valueSelector explicitly set to selectionOrder 
RANDOM?

This would make no sense:
changeMoveSelector
cacheTypePHASE/cacheType
valueSelector
selectionOrderRANDOM/selectionOrder!-- What's the point of 
making it RANDOM if it's wrapped in a move cacheType PHASE? --
...
/valueSelector
/changeMoveSelector


this would make more sense to shuffle on the phase level:

changeMoveSelector
cacheTypePHASE/cacheType
selectionOrderSHUFFLED/selectionOrder
valueSelector
...
/valueSelector
/changeMoveSelector


 o) Number of moves:

 I obtained the number of evaluated moves from solver and I obtain a
 number above 7 000 000.

 I also added logs to the MoveFilter that I implement. Different values
 are being proposed.

   
 But, the MoveFilter is repeatedly invoked (20 times) with the same set of
 planning values.

 Since this set broke constraints the MoveFilter returns false each time.

 Then bailing out error occurs:

  

 o) Change Move Filter configuration

 My planning entity CloudPlacement has four planning variables as
 indicated in the included config file.

 I tried the modifications you suggested over this basic version.

 Could you please check that the configuration is correct?
 2014.03.14_Config_file.xml
 http://drools.46999.n3.nabble.com/file/n4028776/2014.03.14_Config_file.xml

   

 Regards





 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Creating-selection-filter-for-PlanningEntity-with-4-planning-variables-tp4026575p4028776.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Non Spatial Map Reduce

2014-03-12 Thread Geoffrey De Smet
It can. Good point.
That's multi-threading or multi-vm'ing the solver algorithm, not the 
problem itself.
The second to last paragraph briefly mentions that too IIRC.

OptaPlanner will support this (hopefully for 6.2)
without breaking incremental score calculation:
   https://issues.jboss.org/browse/PLANNER-76
The difficulty is not breaking incremental score calculation,
which performance loss is far greater than multi-threading/vm can gain.

On 12-03-14 07:50, john poole wrote:
 I was reading the blog
 http://www.optaplanner.org/blog/2014/03/03/CanMapReduceSolvePlanningProblems.html

 and although the unsuitability of the spatial division of the problem makes
 sense, I'd like to understand why the problem can't be broken up
 differently. i.e. why can't any solution be loaded into n separate solvers
 with 1/nth of the moves, and then send the best solution to all the solvers,
 and repeat?



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Non-Spatial-Map-Reduce-tp4028652.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Upgrade to protobuf 2.5 - Prevents Upgrading to Drools 6.x

2014-03-11 Thread Geoffrey De Smet
I believe Edson had to make code changes in drools-core/compiler itself 
to upgrade it from protobuf v.2.4.1 to v.2.5.0.
That implies that it's impossible to run drools 6 with protobuf 2.4.1.
Both the knowledige-api and kie-api both use the same implementation 
(which is drools-core/compiler).

Any chance of upgrading hadoop?

On 11-03-14 15:50, mikerod wrote:
 Note: I originally tried posting this  as a reply to this
 http://drools.46999.n3.nabble.com/Upgrade-to-protobuf-2-5-and-how-to-work-with-Protobuf-td4023028.html
 , before I realized it was the wrong mailing list.

 _

 It looks like moving from protobuf-java v.2.4.1 to v.2.5.0 has non-passive
 changes that are causing more troubles preventing an upgrade to Drools
 v.6.x.

 Explained here https://code.google.com/p/protobuf/issues/detail?id=493

 Our Drools rules are ran in an environment that must share a classpath with
 Hadoop libs.  These libs are still using protobuf-java v.2.4.1 and cannot
 easily be upgraded.

 The problem comes down to a runtime error:
 ```
 2014-03-11 06:39:25,229 FATAL org.apache.hadoop.mapred.Child: Error running
 child : java.lang.VerifyError: class
 org.drools.compiler.kie.builder.impl.KieModuleCache$KModuleCache overrides
 final method getUnknownFields.()Lcom/google/protobuf/UnknownFieldSet;
at java.lang.ClassLoader.defineClass1(Native Method)
   at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
   at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
   at 
 java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
   at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
   at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
   at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
   at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
   at
 org.drools.compiler.kie.builder.impl.KieBuilderImpl.createCacheBuilder(KieBuilderImpl.java:269)
   at
 org.drools.compiler.kie.builder.impl.KieBuilderImpl.generateKieModuleMetaInfo(KieBuilderImpl.java:224)
   at
 org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildAll(KieBuilderImpl.java:194)
   
   ... application level omitted ...
 ```

 This error makes sense given the changes in protobuf-java v.2.5.

 I do not believe that our use-case of the Drools rules engine involves the
 use of any of the features of the `KieModuleCache` and
 marshalling/unmarshalling libs associated with it.
 However, I do not see any sort of configuration that would avoid this error.

 I tried to simply use the legacy Drools knowledge-api when upgrading to
 Drools v.6.x, but this has failed us since there are several unimplemented
 methods in the `org.drools.impl.adapters.KnowledgeRuntimeAdapter`, such as
 `org.drools.impl.adapters.KnowledgeRuntimeAdapter#getQueryResults`.

 Side note:  I expected the knowledge-api to be fully-functional and
 implemented in Drools v6.x for backwards compatibility and for  tooling
 integration
 http://docs.jboss.org/drools/release/6.0.1.Final/drools-docs/html_single/index.html#KIEModuleIntroductionBuildingIntroductionSection
 .
 However, this does not seem to be the case at this point.

 We are eager to move to Drools v6.x to avoid some performance issues we are
 facing due to performance issues with  eagerly evaluating `AccumulateNode`
 results that are accumulating large collections
 http://drools.46999.n3.nabble.com/Object-size-impact-on-session-insertion-performance-td4028244.html
 .

 Do you have any suggestions?  




 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Upgrade-to-protobuf-2-5-Prevents-Upgrading-to-Drools-6-x-tp4028636.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] OptaPlanner - best strategy for variable number of planning entities?

2014-03-06 Thread Geoffrey De Smet
Check if the solution you give to solver.setPlanningProblem() has all 
planning variables == null.
CH doesn't reïnitialize non-null planning variables by default (see 
@PlanningVariable.reinitilizeFilter)

On 05-03-14 18:02, Nadim wrote:
 ge0ffrey wrote
 Without a construction heuristic, local search waste a lot of time doing
 easy work.
 No CH is like swimming 25 meter with LS.
 CH with LS is like jumping 10 meters into the pool and then swimming the
 remaining 15.
 I've seen cases were it takes minutes for LS to make up for the work of
 CH.
 Oh, I completely agree, that's how it's supposed to theoretically work.
 It's not that I'm not using a construction heuristic; I just can't seem to
 make one actually function.  I've tried FIRST_FIT, FIRST_FIT_DECREASING,
 BEST_FIT, and BEST_FIT_DECREASING.  In each case, it basically does
 absolutely nothing.  With the localsearch turned off, and a construction
 heuristic section of:

 constructionHeuristic
 
 constructionHeuristicTypeBEST_FIT_DECREASING/constructionHeuristicType
 /constructionHeuristic

 I get:

 OptaPlanner solver test...
 2014-03-05 11:54:46,431 [main] INFO  Solving started: time spend (11), score
 (0hard/0soft), new best score (0hard/0soft), random seed (0).
 2014-03-05 11:54:46,435 [main] TRACE Created cachedEntityList with size
 (100) in entitySelector(Sorting(FromSolutionEntitySelector(Item))).
 2014-03-05 11:54:46,436 [main] TRACE Sorted cachedEntityList with size
 (100) in entitySelector(Sorting(FromSolutionEntitySelector(Item))).
 2014-03-05 11:54:46,450 [main] INFO  Phase (0) constructionHeuristic ended:
 step total (0), time spend (32), best score (0hard/0soft).
 2014-03-05 11:54:46,450 [main] INFO  Solving ended: time spend (32), best
 score (0hard/0soft), average calculate count per second (62).

 Still trying to figure out why...



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/OptaPlanner-best-strategy-for-variable-number-of-planning-entities-tp4028470p4028542.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] OptaPlanner - best strategy for variable number of planning entities?

2014-03-06 Thread Geoffrey De Smet

On 06-03-14 03:23, Nadim wrote:
 I solved the construction heuristic problem.  Someone it didn't dawn on me
 right away that primitive types don't work properly as planning variables,
 because they're always initialized, thus the construction heuristic quits
 right away, thinking there's nothing to do.
Good point.
OptaPlanner shouldn't surprise you like that, I 've created an issue:
   https://issues.jboss.org/browse/PLANNER-227

 However, construction heuristic or no, it looks like it's getting stuck on
 local optima most of the time even in brain-dead simple cases (e.g. adding a
 constraint to force exactly one window).  Not sure if I may need to add some
 custom move logic to account for the fact that there are many Boolean
 planning variables (one for each potential session to attend), but that most
 of the potential toggles don't make much sense (generally you'd want to
 either tweak the sessions on the edges of existing windows, or try killing a
 window and growing a different one elsewhere.
to kill an entire window, it probably makes sense to have 
PillarChangeMove's (which aren't implemented yet, only PillarSwapMoves 
are currently available, see docs).



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/OptaPlanner-best-strategy-for-variable-number-of-planning-entities-tp4028470p4028555.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Number of moves in Optaplanner.

2014-03-05 Thread Geoffrey De Smet
Hey,

To debug it, set a breakpoint in LocalSearchDecider.

To get it in code:
solverPhase = ((DefaultSolver) solver).getSolverPhaseList().get(1);
((DefaultLocalSearchSolverPhase) 
solverPhase).getDecider().getMoveSelector();

But getDecider() isn't there... (going to add it now for 6.1).

HTH somewhat at least

On 05-03-14 12:28, maciekpob wrote:
 I'm trying to find answer how many moves OptaPlanner generates in our problem
 to clarify our bug which I was talking in topic below.

 http://drools.46999.n3.nabble.com/Creating-selection-filter-for-PlanningEntity-with-4-planning-variables-td4026575.html

 To be honest I still can't get this MoveSelector.



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Number-of-moves-in-Optaplanner-tp4028409p4028531.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Best Solution found but latest solution does not work

2014-03-04 Thread Geoffrey De Smet
Hi Karan,

Unfortunately, I don't have the time bandwidth to do peer reviews on 
code zips in a community question.
(I do those for BRMS customers only)

But I think you might be suffering from a score corruption, which could 
explain what you're seeing.
To verify that that's the problem, simply enable 
environmentModeFAST_ASSERT/FULL_ASSERT (more info in docs).

On 04-03-14 01:30, moltenice wrote:
 Hi Ge0ffrey, thanks for your quick reply.

 Actually I'm quite sure it's my code, I just used brute force to enable
 completeness on my small problem. I've attached my problem this time just
 using a first fit heuristic.

 If you run my code you will see that the solver hits a 0hard/0soft score
 which is valid, but since it searches for better solutions afterwards it
 seems to replace the best solution with the last solution it received.

 I think the TimetableSlot objects' Lecturer planning variable is modified
 when planner is running and since a new instance isn't made of the objects
 they are just replaced by the latest value (and I'm guessing wherever the
 best solution is stored its instances are replaced too since they refer to
 the same point in memory). I feel I haven't implemented the
 Solution/Planning Entities and variables correctly so do take a look at
 those.

 I think the best way to understand the problem is to just run the main
 method. It should work out of the box as long as libraries are included!

 Thanks a lot and awaiting your reply.

 Karan

 Timetabler.zip
 http://drools.46999.n3.nabble.com/file/n4028475/Timetabler.zip



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Best-Solution-found-but-latest-solution-does-not-work-tp4028442p4028475.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] OptaPlanner - best strategy for variable number of planning entities?

2014-03-04 Thread Geoffrey De Smet

On 03-03-14 23:32, Nadim wrote:
 Hi, I'm new to OptaPlanner, and reading through the planning examples in the
 documentation left me with a question.  One problem I'm trying to model
 involves a variable number of planning entities, which I didn't really see
 addressed by any of the examples; they all seemed to me more focused on
 varying the states of planning variables for a fixed / known number of
 entities.
Yes. Although OptaPlanner has been designed to deal with a variable 
number of entities,
none of the examples do it yet and there are no generic moves for it
- so it's uncharted territory.

 To throw out some specifics...let's say I'm trying to optimize my attendance
 schedule for some convention.  I have a set of problem facts, the various
 events going on at the convention, with each having a time (when the event
 happens), and a worth (how much I'd like to be there for that event).
ok
 And I have a set of planning entities, the various times that I'm present at
 the convention.
Sounds weird to me.
It's sounds like you're assigning the pigeon holes to the pigeons,
instead of assigning the pigeons to the pigeon holes.
   So, I'm trying to model the case where my key constraint is
 the total amount of time I spend at the convention...let's treat that as
 fixed.  I don't care how many separate times I go there, though I will have
 to model constraints like a minimum length per visit (very inefficient to go
 for 10 minutes at a time), and a minimum separation between visits (annoying
 / inefficient to leave, then turn right around and go back, unless I get an
 hour break).
Sounds like the nurse rostering example.

 Again, I didn't see a good way to just say have any number of planning
 entities in the planning entity collection, so long as they meet the
 constraints.  So instead, I modeled the problem as a set of visits,
 calculated as the max possible visits (total conference length / minimum
 visit duration).  Then I defined each visit to have three planning
 variables:  start time, duration, and whether that visit is active.
I wouldn't model it like this.
3 planning variables, probably each with a minute or second accuracy.
The size of search space must be crazy.
Or you're forced to write complex moves to avoid using minutes like 
10:03 if no session starts at that time.

Instead, I 'd model it like this:
For every session, I create:

@PlanningEntity
class SessionAttendance {
Session session;
@PlanningVariable boolean attending;
}

Based on that, your start and end times can be calculated.
Either in the score calculation itself (insertLogicals etc like in nurse 
rostering)
Or with shadow variables (like in vehicle routing and project job 
scheduling)
http://blog.athico.com/2013/06/shadow-variables-planningvariablelisten.html
Shadow variables is probably more efficient.
I'm
 looking forward to 6.1, where it seems there's better support for numeric
 ranges, but for now, just modeled start time as the set of integers
 representing the time range of the convention in minutes.  Finally, I
 constructed a hard score based on the constraints above, and a soft score
 that represents the sum of the worth of the events that occur during the
 visit.

 However, I'm not seeing it work out too well...the engine seems to spend a
 lot of time messing around with one visit, and very little time trying out
 multiple visits with different starts and durations to capture event-rich
 times.  I can certainly play around with parameters and engine
 configuration, but I thought I should first ask if I was fundamentally going
 about modeling the problem the wrong way, as I am very new to the
 OptaPlanner engine.
If you see this behavior, it can be well worth to add additional generic 
moves (such as pillarSwapMove)
and smarter custom moves.
By default it will uses only changeMoveSelector and swapMoveSelector.

Read about score trap in the docs, that might also help there.

In the benchmarker, enable the mutation count statistic and best score 
statistic.
Based on those graphs, it's possible to get a better understanding of 
what's happening.

 Thanks in advance for any thoughts or suggestions!



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/OptaPlanner-best-strategy-for-variable-number-of-planning-entities-tp4028470.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Best Solution found but latest solution does not work

2014-03-04 Thread Geoffrey De Smet
What happens if you don't use custom cloning?
(See section about cloning in docs for more info.)

On 04-03-14 13:18, moltenice wrote:
 Hi ge0ffrey,

 I understand. I forgot mentioning I am using OptaPlanner 6.0.1 Final.

 Your last email proved useful, I encountered some errors which I tried
 fixing, finally coming to this error:
 Exception in thread main java.lang.IllegalStateException: HashCode
 violation: the hashCode of tabu (TimetableSlot@15897e8d) probably changed
 since it was inserted in the tabu Map or Set.
   at
 org.optaplanner.core.impl.localsearch.decider.acceptor.tabu.AbstractTabuAcceptor.adjustTabuList(AbstractTabuAcceptor.java:108)
   at
 org.optaplanner.core.impl.localsearch.decider.acceptor.tabu.AbstractTabuAcceptor.stepEnded(AbstractTabuAcceptor.java:98)
   at
 org.optaplanner.core.impl.localsearch.decider.LocalSearchDecider.stepEnded(LocalSearchDecider.java:159)
   at
 org.optaplanner.core.impl.localsearch.DefaultLocalSearchSolverPhase.stepEnded(DefaultLocalSearchSolverPhase.java:127)
   at
 org.optaplanner.core.impl.localsearch.DefaultLocalSearchSolverPhase.solve(DefaultLocalSearchSolverPhase.java:83)
   at
 org.optaplanner.core.impl.solver.DefaultSolver.runSolverPhases(DefaultSolver.java:190)
   at
 org.optaplanner.core.impl.solver.DefaultSolver.solve(DefaultSolver.java:155)
   at Main.main(Main.java:29)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
   at
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:601)
   at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)

 I have run tests to ensure my Timetable (Solution), TimetableSlot (Planning
 Entity), and Lecturer (Planning Variable) all have working clone(),
 equals(), and hashCode().

 Clone: I always do a deep clone, so Timetable's TimetableSlots and
 TimetableSlot's Lecturer will be re-instantiated. Same for the other
 classes.
 Equals: I always do deep Equals, so even if all objects and sub-objects are
 different it will equal true if all the base objects are equal.
 hashCode: I ensured that a cloned object using my cloned methods will output
 the SAME hashCode.

 My @PlanningEntityCollectionProperty returns non-cloned (so same instances)
 collection of TimetableSlots.

 Hopefully this description of my code can help you spot what I'm doing
 wrong.

 Thank you for your responses so far!

 Karan



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Best-Solution-found-but-latest-solution-does-not-work-tp4028442p4028482.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Best Solution found but latest solution does not work

2014-03-04 Thread Geoffrey De Smet
It's likely you have separate issues:
- score corruption
- bug in your custom cloner (which fails sooner than the score 
corruption, that's why it doesn't show up)

I suggest fixing the score corruption first, while using the build-in 
cloner.
Looks like you're using IncrementalJavaScoreCalculator (so no drools)
because it's not reporting the constraint matches - .
Writing an IncrementalJavaScoreCalculator is hard.
Debugging it, is harder.
There's little advice I can give you to fix it. Look into 
assertionScoreDirectorFactory in the docs.

On 04-03-14 16:22, moltenice wrote:
 Oh, I actually decided to implement my own cloning methods because without
 them FULL_ASSERT gave me the following error:

 14:46:41.601 [main] INFO  o.o.core.impl.solver.DefaultSolver - Solving
 started: time spend (7), score (-1hard/0soft), new best score
 (-1hard/0soft), random seed (0).
 14:46:41.620 [main] INFO  o.o.c.i.c.DefaultConstructionHeuristicSolverPhase
 - Phase (0) constructionHeuristic ended: step total (0), time spend (28),
 best score (-1hard/0soft).
 14:46:41.798 [main] DEBUG o.o.c.i.l.DefaultLocalSearchSolverPhase - Step
 index (0), time spend (207), score (-1hard/0soft), best score
 (-1hard/0soft), accepted/selected move count (1000/1000) for picked step
 (TimetableSlot@44c099ef = Thomas).
 14:46:41.947 [main] DEBUG o.o.c.i.l.DefaultLocalSearchSolverPhase - Step
 index (1), time spend (356), score (-1hard/0soft), best score
 (-1hard/0soft), accepted/selected move count (1000/1889) for picked step
 (TimetableSlot@5289178b = Thomas).
 14:46:42.092 [main] DEBUG o.o.c.i.l.DefaultLocalSearchSolverPhase - Step
 index (2), time spend (501), score (0hard/0soft), new best score
 (0hard/0soft), accepted/selected move count (1000/2869) for picked step
 (TimetableSlot@c7b2b3e = Thomas).
 Exception in thread main java.lang.IllegalStateException: Score
 corruption: the solution's score (0hard/0soft) is not the uncorruptedScore
 (-1hard/0soft).
   at
 org.optaplanner.core.impl.score.director.AbstractScoreDirectorFactory.assertScoreFromScratch(AbstractScoreDirectorFactory.java:75)
   at
 org.optaplanner.core.impl.solver.scope.DefaultSolverScope.assertScoreFromScratch(DefaultSolverScope.java:113)
   at
 org.optaplanner.core.impl.bestsolution.BestSolutionRecaller.stepEnded(BestSolutionRecaller.java:90)
   at
 org.optaplanner.core.impl.phase.AbstractSolverPhase.stepEnded(AbstractSolverPhase.java:93)
   at
 org.optaplanner.core.impl.localsearch.DefaultLocalSearchSolverPhase.stepEnded(DefaultLocalSearchSolverPhase.java:126)
   at
 org.optaplanner.core.impl.localsearch.DefaultLocalSearchSolverPhase.solve(DefaultLocalSearchSolverPhase.java:83)
   at
 org.optaplanner.core.impl.solver.DefaultSolver.runSolverPhases(DefaultSolver.java:190)
   at
 org.optaplanner.core.impl.solver.DefaultSolver.solve(DefaultSolver.java:155)
   at Main.main(Main.java:29)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
   at
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:601)
   at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)


 Also, thanks for pointing me to the doc on cloning, I have tried to
 implement it as follows but now it doesn't seem to be able to update the
 values and just runs without changing original inputted solution until
 timelimit:
 My Solution's clone:
  @Override
  public Timetable planningClone() {
  TimetableSlot[][] clonedTimetableSlotArray = new
 TimetableSlot[Constants.TIME_SLOTS][Constants.NUMBER_OF_STUDENTS];
  for (int i = 0; i  Constants.TIME_SLOTS; i++) {
  for (int j = 0; j  Constants.NUMBER_OF_STUDENTS; j++) {
  try {
  clonedTimetableSlotArray[i][j] = (TimetableSlot)
 this.timetable[i][j].clone();
  } catch (CloneNotSupportedException e) {
  e.printStackTrace();
  }
  }
  }

  Timetable clonedTimetable = new Timetable(clonedTimetableSlotArray);
  clonedTimetable.setScore(this.getScore());
  return clonedTimetable;
  }


 My Solution's Entity Collection:
  @PlanningEntityCollectionProperty
  public CollectionTimetableSlot getListOfTimetableSlots() {
  CollectionTimetableSlot timetableSlotCollection = new
 ArrayListTimetableSlot();

  for (int i = 0; i  Constants.TIME_SLOTS; i++) {
  for (int j = 0; j  Constants.NUMBER_OF_STUDENTS; j++) {
  try {
  timetableSlotCollection.add((TimetableSlot)
 timetable[i][j].clone());
  } catch (CloneNotSupportedException e) {
  e.printStackTrace();
  }
  }
  }

  return 

Re: [rules-users] OptaPlanner - best strategy for variable number of planning entities?

2014-03-04 Thread Geoffrey De Smet
Without a construction heuristic, local search waste a lot of time doing 
easy work.
No CH is like swimming 25 meter with LS.
CH with LS is like jumping 10 meters into the pool and then swimming the 
remaining 15.
I've seen cases were it takes minutes for LS to make up for the work of CH.

 it seems to
 just end right away with an initial solution of all sessions off,
Turn on debug and then trace logging to find out what's going on.


On 05-03-14 08:11, Nadim wrote:
 ge0ffrey wrote
 Sounds weird to me.
 It's sounds like you're assigning the pigeon holes to the pigeons,
 instead of assigning the pigeons to the pigeon holes.
 [...]
 @PlanningEntity
 class SessionAttendance {
  Session session;
  @PlanningVariable boolean attending;
 }

 Based on that, your start and end times can be calculated.
 Either in the score calculation itself (insertLogicals etc like in nurse
 rostering)
 Or with shadow variables (like in vehicle routing and project job
 scheduling)
 http://blog.athico.com/2013/06/shadow-variables-planningvariablelisten.html
 Shadow variables is probably more efficient.
 Exactly why I asked...there's a certain art to framing the problem in a way
 that makes it work well with the engine.  I tried restructuring the problem
 the other way around...I hadn't thought of calculating the windows on the
 fly, but it does make a lot of sense.  The engine now seems to be giving
 much better answers faster.  I'm still just determining the windows directly
 in the score calculation, but now that it looks like it's functioning
 better, I'll explore more efficient approaches like shadow variables or
 using rules-based calculation.

 I still haven't found the construction phase to be of any use...it seems to
 just end right away with an initial solution of all sessions off, but
 maybe I just need to play with the configuration file some.

 Lots to learn, but looks like a powerful and flexible tool framework.
 Thanks again for the suggestion!




 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/OptaPlanner-best-strategy-for-variable-number-of-planning-entities-tp4028470p4028513.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] VCRP - Distance calculation in getMilliDistance

2014-03-03 Thread Geoffrey De Smet
If you have enough memory, you can cache the distance from every 
location to every other location
before Solver.solve() or in Solution.getProblemFacts().

The machineReassignment example has a similar big 2 dimensional grid for 
the cost of every machine to every other machine.
Don't go blindly with LinkedHashMap there - that can be very expensive 
memory wise when scaling out.


On 01-03-14 05:53, muerlings wrote:
 Please, take a look at http://en.wikipedia.org/wiki/Great-circle_distance

 In it, there are formulas based on latitude and longitude for arc length
 calculation. The problem is that they are expensive formulas based on
 trigonometric functions and could heavily impact performance, but they are a
 better aproximation than the cord length.

 mu





 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/rules-users-VCRP-Distance-calculation-in-getMilliDistance-tp4028382p4028433.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Best Solution found but latest solution does not work

2014-03-02 Thread Geoffrey De Smet
Almost nobody uses bruteForce, including the examples...
I 've got 1 integration test for it, NQueensBruteForceTest, (and all 
tests are green upon a release), so it should work though.

What you're describing sounds like a bug:
DefaultBruteForceSolverPhase somehow forces BestSolutionRecaller to use 
the latest workingSolution,
instead of the earlier found bestSolution, as the bestSolution.

But if that bug was real, then NQueensBruteForceTest would fail.
What version of optaplanner are you use?
If you can diagnose with some confidence that this is a bug in 
optaplanner itself, create a jira.

On 02-03-14 19:44, moltenice wrote:
 Hello all,

 I am currently trying to use Optaplanner to create a timetable of
 interviewers, where x students are to be given interviews in a given time
 slot.

 The planning variable is Lecturer class, meaning different lecturers can be
 assigned to different timeslots.

 Through debugging, I can tell that the planner does optimize (I'm currently
 using brute force just to be complete for small problems). But the final
 best solution ALWAYS has the results of the last search the optimizer did,
 and so the 'best' solution information seems to be lost as soon as the
 planner does another search.

 Clearly I'm doing something wrong. Can anybody let me know what the problem
 is?

 Thanks a bunch in advance!

 Karan

 Timetabler.zip
 http://drools.46999.n3.nabble.com/file/n4028442/Timetabler.zip



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Best-Solution-found-but-latest-solution-does-not-work-tp4028442.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Number of moves in Optaplanner.

2014-02-28 Thread Geoffrey De Smet
ScoreDirector.getCalculateCount() will tell you the number of moves that 
have been evaluated (because calculateScore() gets called for every move).

MoveSelector.getSize() will tell you the number of possible moves for 
each step (but only a subset of those are evaluated)

To get either of those, you'll need to cast Solver to it's 
implementation and get hold of the SolverScope.


What do you intent to do with it?


On 28-02-14 11:11, maciekpob wrote:
 Is there a way to get the number of possible moves generated by OptaPlanner?



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Number-of-moves-in-Optaplanner-tp4028409.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Number of moves in Optaplanner.

2014-02-28 Thread Geoffrey De Smet

On 28-02-14 16:57, maciekpob wrote:
 1.Is it possible that one move is evaluated many times?
Depends on Selector cacheType and selectionOrder (random vs shuffled).
See docs, chapter about selectors, cacheType etc.
 2.I can't get MoveSelector neither from DeafultSolver nor from
 DefaultSolverScope. Are you sure if there is any method which allows to
 receive MoveSelector or any class implementing this interface in one of
 these two classes?
MoveSelector is phase specific, so it's on the SolverPhase.


Once again, what are you trying to accomplish?
Distinct move selection?




 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Number-of-moves-in-Optaplanner-tp4028409p4028421.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] VCRP - Distance calculation in getMilliDistance

2014-02-27 Thread Geoffrey De Smet


On 27-02-14 16:55, Marcus Uerlings wrote:

Hi

I´ve download Optaplanner a couple of months ago and found it 
fantastic!! Congrats to Geoffrey!


I´m not a programmer, but a logistic consultant to a non-governmental 
organization (NGO) of recycling products and like to give my cent of 
contribuition if it applies.

Intresting use case :)
I love that fact that NGO's are taking advantage of this software too.

Do note that the examples/docs are aimed at Java programmers (because 
any real-world application requires customization to the actual 
organization that wants to use it), OptaPlanner doesn't try to be a 
generic out-of-the-box VRP solution (but something like that can be 
build downstream upon OptaPlanner).


1. Distance Calculation:

I´ve learned from a person that works with georeference that a good 
aproximation in calculating distances from latitude and longitude is 
to multiply the Euclidean result by 111.1.
This magic number will give the approximate distance in kilometers 
and then the final soft score will show the minimum distance in km 
and not in fuel (although they are related).


=
  public int getMilliDistance(Location location) {
( ... )
  (latitudeDifference * latitudeDifference) + 
(longitudeDifference * longitudeDifference));

  return (int) (distance * 1000.0 * 111.1);
  }
=

2. Heteregenous vehicles

Many times a fleet is made of different vehicles, different sizes, 
capacity and one of the most important,  different mileages (in 
Km/litre or litres/100 km).
How can I put it in vehicle parameters, together with capacity and 
took into account in score calculation?

Doing so, the score would be calculated as minimum(Distance*mileage).

That requires Java programming, but it's not that much work:
- add the fields on the class Vehicle
- add the fields in the xml input
- use the fields in the score DRL


3. Real example
I fed real data into Optaplanner VCRP and plot the results in Googlemaps.
Due to one way streets, the result does not look efficient to the 
drivers of the NGO.
Is there a way to use an internet routing service, like Googlemaps in 
Optaplanner?

If it is possible, can someone help me coding this? :)
Peter Karich was recently planning to combine OptaPlanner with 
Graphhopper (both open source) to accomplish exactly that.
I am not sure if he follows this list, but might be interesting to open 
a conversation with him.


Regards from Brazil
Thank you in advance
Marcus Uerlings
__
*Marcus Uerlings
+11 9 4178-0544*


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] OutOfMemoryError using 6.0.1

2014-02-19 Thread Geoffrey De Smet

A workaround in optaplanner 6.0.1 is probably to enforce RETE_OO
(unfortunately ScoreDirectorFactoryConfig#buildKieBase hard codes that, 
so that's a PITA).


It's fixed in BRMS 6.0.0.GA and optaplanner 6.1.0.Beta1.
optaplanner 6.1.0.Beta1 might be released later this month.

On 19-02-14 13:11, Matteo Mortari wrote:
Ciao, I'm another Drools user also encountering similar OutOfMemory 
errors with v6.0.1; I'm not 100% sure what is your issue specific to, 
but this may be related / of interest to your case: 
https://issues.jboss.org/browse/DROOLS-411


Hope this helps;
Ciao
MM


On Wed, Feb 19, 2014 at 8:20 AM, john poole jdpo...@gmail.com 
mailto:jdpo...@gmail.com wrote:


I've converted some NurseRostering rules, which worked in Drools
5.50, to
OptaPlanner 6.0.1. While it works far better for the time it runs,
it uses
up whatever memory I can give it (9GB) and then eventually crashes
the GUI.

with:
Exception in thread AWT-EventQueue-0 java.lang.OutOfMemoryError: GC
overhead limit exceeded

Is there a way to limit how much memory OptaPlanner uses? Or is it
likely
that I'm just adding fact to the WorkingMemory in a way that wasn't a
problem in 5.5 but is a problem in 6.0?





--
View this message in context:

http://drools.46999.n3.nabble.com/OutOfMemoryError-using-6-0-1-tp4028183.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org mailto:rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users




___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] Multiple planning variables in optaplanner 6.0.1‏

2014-02-17 Thread Geoffrey De Smet

The examination example is the only example which is left on my to 
cleanup list.
It's difficult and convoluted currently.

The curriculum course example is very similar, has 2 planning variables 
on the same planning entity,
and is a much prettier example to learn from.
Here's how you configure it to avoid that Exception:
https://github.com/droolsjbpm/optaplanner/blob/master/optaplanner-examples/src/main/resources/org/optaplanner/examples/curriculumcourse/solver/curriculumCourseSolverConfig.xml

On 10-02-14 23:16, lloydstockman wrote:
 Hi Guys,

 I am trying to get a basic program going using Optaplanner 6.0.1 I have come
 across a problem because I am using two planning variables within a single
 planning entity. I have checked other examples, such as the examination
 example, and it seems fine to have multiple planning variables within a
 single planning entity. I also tried to add another planning variable to the
 cloud balancing example and the same error occurs so I believe there is
 something I need to do to be able to use multiple planning variables in a
 single entity. The error is as follows.

 Exception in thread main java.lang.IllegalArgumentException: The
 selectorConfig (ValueSelectorConfig(null)) has no configured variableName
 (null) for planningEntityClass (class domain.Provisional) and because there
 are multiple in the variableNameSet ([date, morning, technician]), it can
 not be deducted automatically.
  at
 org.optaplanner.core.config.heuristic.selector.SelectorConfig.deduceVariableDescriptor(SelectorConfig.java:108)

 I haven't found anything in the manual to suggest what needs to be done in
 this scenario, or found any posts of the forum regarding this topic. If
 anyone can point me in the right direction I would greatly appreciate it.

 best regards,
   - Lloyd Stockman



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Multiple-planning-variables-in-optaplanner-6-0-1-tp4028047.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] [optaplanner] Nurse rostering questions

2014-02-13 Thread Geoffrey De Smet

On 12-02-14 20:55, Karri Niemelä wrote:

 1) So for example when using toy1.xml there is 140 shifts/assigments.
 This means each nurse(11 of them) will get about 10-15 assignments.
 (= DayOfWeekCover/cover/shift/preferred is 2)

 But what if I want to make sure in contract MinNumAssignments = 20 is met?
 DayOfWeekCover/Cover/shift would need to have minimum/maximum instead of 
 preferred?
Not sure what you're asking.
It already has a rule minimumTotalAssignments and a rule 
maximumTotalAssignments:
https://github.com/droolsjbpm/optaplanner/blob/master/optaplanner-examples/src/main/resources/org/optaplanner/examples/nurserostering/solver/nurseRosteringScoreRules.drl#L92

Adjust those as needed.

 2) So I solve/make shifts for february using nurserostering. Then I want to 
 do march.
 a) How to load old data? (Load feb solution and then advance 30 days?)
and mark the old data as immovable (easiest way is in the example 
implementation indeed to advance the planning window beyond the old data)
 b) What if my march data has employee/contract changes?
Expand the domain model of the example implementation to represent this 
complexity.
Then adjust the score rules so they only apply to the active contract of 
an employee.
It gets interesting when an employee switches contract in the middle of 
a planning window...


 Thanks,
 Karri


 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] [Optaplanner] provisioning / scalability

2014-02-06 Thread Geoffrey De Smet


On 06-02-14 14:17, Mats Norén wrote:

Hi,
I have a use case where multiple users need to run multiple 
simultaneous solvers.

Is there a best practice in scaling out Optaplanner for multitenancy?
Just to be clear I'm not interested in scaling out a single 
optimization run but instead multiple solvers.

So I'm looking for pros and cons for:
- multiple solvers in the same JVM

Provide 1 CPU core per Solver that's running in parallel.
1 Solver saturates 1 CPU core entirely
and it is ussually happy if it has 300mb of free heap space on top of it 
needs as a bare minimum.
If there is no such free heap space, you're basically trading more cpu 
for less memory (due to higher GC activity).


So provide 1 CPU core per Solver that's running in parallel.
If you need to run 8 jobs and have 4 CPU cores, I would probably run 4 
at the same time for half the time.

- multiple JVM:s on a single machine (with multiple solvers)
I see no reason to do that. By using 1 JVM you pool class instances, etc 
so use less memory overall.

- multiple machine setup

Definitely the way to increase Solvers running in parallel.

- virtual machine vs lxc (Docker) vs bare metal

No data on that yet.


I'm also interested in provisioning of rules etc

Let me know what works well for you and what doesn't with multitenancy!


Regards,
Mats



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] OptaPlanner vehicle routing problem with multiple depots

2014-01-22 Thread Geoffrey De Smet

On 22-01-14 14:56, milenko wrote:
 Dear OptaPlanner users,

 I am working for a small company located in Munich and have a software
 problem, which I would like to solve with OptaPlnner.

 In our case, we have multiple technicians which are starting their work each
 day from different locations (e.g. their homes).
 Each technician has to serve customers at different locations.
 Each customers has his own time window for the visit (earliest arrival time,
 wait time, planned start time, planned end time, real end time, …).
 On one hand the route of each technician should be optimized.
 Also the planned customer time window should be met optimally.
 There should not be many empty gaps in the time schedule of single
 technicians.

 For me this looks somehow similar like the vehicle routing problem with time
 window.

 In our case we have the following similarities:

 Customer= Customer
 Vehicle = Technician
 Time windows = Time windows + additional time windows
 Depot = We have many Depots (Starting locations) for each single technician

 I do not know how I could transfer the parameter capacity of the vehicle –
 probably I don’t need it..

 What I tried: I changed the parameters in the xml-input file to change the
 location position of the customers and also the different time windows.
 But I don’t succeed to add additional depots (customers)? Does somebody has
 an idea how to realize that?
There are different input formats:
   data/vrp/import/ = 3 different academic vrp formats
   data/vrp/unsolved/ = xstream format
   data/vrp/solved/ = also xstream format

It should be possible to add it in the xstream format, but it might be 
easier to add it in one of the academic vrp formats.
See docs for a link to more info about the formats.
Click the import button in the examples gui to use them.

Note that:
- it's not tested with multiple depot's yet. But the example was 
designed to work with it. (If it doesn't it's probably easy to fix)
- the GUI hard codes that there's only 1 depot IIRC. Look for usages of 
VehicleRoutingSolution.getDepotList()


hth

 Best regards.
 Milenko



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/OptaPlanner-vehicle-routing-problem-with-multiple-depots-tp4027804.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.

 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] Drools Support in IntelliJ

2014-01-21 Thread Geoffrey De Smet
The intellij drools plugin is available in intellij ultimate only I think.
Then you need to do menu File, menu item Other settings, menu item 
Configure plugins to enable it.

And then when it's enabled, check settings - File type to see if *.drl 
is assigned to the drools drl editor (and not some custom format you 
created yourself in an older intellij version).

Works from intellij 12+ IIRC (but 13 is better ;-).

On 20-01-14 23:33, mreynolds wrote:
 I recently saw this video:

 http://www.screenr.com/w9q8

 There are some pretty advanced features being displayed that makes the
 Eclipse editor pale in comparison. I assumed that there was a Drools plugin
 for this and Googlefu seems to indicate that this is the case. However,
 whenever I open a DRL file IntelliJ says it found a plugin that supports
 that extension, but when I browse the plugin repo it turns up nothing.
 Searching for JBoss revealed a JBPM pluginbut no mention of Drools. This
 isn't an environment issue either as this happens to me on both Linux and
 Windows.

 Does anyone know how to get this plugin? Is there another repository that
 needs to be added?



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Drools-Support-in-IntelliJ-tp4027784.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Planner with a list of planning variables

2014-01-17 Thread Geoffrey De Smet

On 16-01-14 20:58, jonathan.labin wrote:
 Does having PeriodChangeMove and RoomChangeMove undermine the effect of
 having the swap filter?
no, because they move only 1 lecture
 Since a swap can be constructed by a sequence of changes does the filter
 reduce the space or simply remove swapMoves that are silly to enact?
simply remove swapMoves that are silly to enact

It matters how big the ocean (= search space) is,
but it matters far more how you navigate it.



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/rules-users-Planner-with-a-list-of-planning-variables-tp4024088p4027734.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Planner with a list of planning variables

2014-01-15 Thread Geoffrey De Smet

On 15-01-14 21:36, jonathan.labin wrote:
 I have a related question and I'd like to ask it by extending the domain
 described here.

 Say that instead of the solution being one recipe, I am building a
 multiple-course meal of recipes.
 The problem will define the course slots including the maximum number of
 ingredients that can be used and the list of ingredients allowed for the
 slots of that course.
 Not all courses must have a recipe built.  If the constraints of the guests
 can be satisfied with fewer courses, the caterer saves money.

 Each course is one recipe as described here: a list of ingredients
 (in my case i don't particularly care about the order of the ingredients
 within the recipe).  Certainly each recipe does not need to use it's maximum
 number of ingredients.

 In my current implementation, I have a flattened list of assignment Planning
 Entities where each assignment represents an ingredient slot of a course
 mapped ingredient).
 For example if the first course has a maximum of 5 ingredients, the second
 course has a maximum of 10 ingredients, and the third has a maximum of 3
 ingredients, my problem would have a list containing 18 Planning Entities
 all in one list.

 The trouble with this approach is that each slot is a separate entity.  This
 means that assigning the ingredient to each of the 5 possible slots of first
 course is considered a separate solution when in reality it doesn't matter
 which slot of the course the ingredient ends up in.  This makes the search
 space much larger than it needs to be and results in a lot of swapping of
 ingredient assignments within the same course which results in no change in
 score.
The curriculum course example had the same problem:
Lectures (= entities) belonging to the same course are interchangeable.
Therefore, I configured the swapMoveSelector as such:
   swapMoveSelector
filterClassorg.optaplanner.examples.curriculumcourse.solver.move.DifferentCourseSwapMoveFilter/filterClass
   /swapMoveSelector

 Is there a recommended pattern to model this domain efficiently?  Is there a
 modification that I can apply to my current representation of this domain
 which will allow an ingredient assigned to any slot of a course to be
 considered the same?
This cannot (currently) be expressed declaratively on the domain.
We might want to support that in the future (so the filterClass is 
automatically applied on the swapMoveSelector etc),
feel free to create a jira.

 Thanks,

 Jon



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/rules-users-Planner-with-a-list-of-planning-variables-tp4024088p4027704.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] OR-constraint doesn't work [planner]

2014-01-06 Thread Geoffrey De Smet
Duplicates
http://stackoverflow.com/questions/20937673/or-constraint-with-simple-score-calculator-doesnt-work

On 06-01-14 12:29, rob_87 wrote:
 Hey guys,

 I'm trying to build a simple score-calculator with optaplanner.
 Method A_at_Index2_or_Index3 should force A to be at index 2 or index 3.
 Method no_A_at_Index2 forces A not to be at Index 2. So, A only can be
 at index 3 ... but it doesn't.
 Optaplanner says the score is -1, but the score has to be 0. Method
 no_A_at_Index2 works well. A_at_Index2_or_Index3 seems to be wrong.

 Does anyone know what I am doing wrong? Do u have any examples for building
 complex constraints like XOR, AND, ...)?

   @Override
  public SimpleScore calculateScore(NCells nCells) {

  int score = 0;
  if (!(this.A_at_Index2_or_Index3(nCells))){
 score--;
  }

  if (!(this.no_A_at_Index2(nCells))){
 score--;
  }
  return SimpleScore.valueOf(score);
 }


 public boolean A_at_Index2_or_Index3(NCells nCells){

  ListCell cellList = nCells.getCellList();
  ChomskyRule rule1 = cellList.get(2).getRule();
  ChomskyRule rule2 = cellList.get(3).getRule();
  int a_counter = 0;
  if ( rule1 != null  rule1.getLeftSide().equals(A)){
  a_counter++;
  }
  if ( rule2 != null  rule2.getLeftSide().equals(A)){
  a_counter++;
  }

  if (a_counter==0  rule1!=null  rule2!=null){
  return false;
  }
  return true;
 }

 public boolean no_A_at_Index2(NCells nCells){

  ListCell cellList = nCells.getCellList();
  ChomskyRule rule = cellList.get(2).getRule();
  if(rule!=null  rule.getLeftSide().equals(A)){return false;}
  return true;
 }



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/OR-constraint-doesn-t-work-tp4027525.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Drools 6 : unable to login to kie-drools-wb-distribution-wars-6.0.0.Final-jboss-as7.0

2013-12-17 Thread Geoffrey De Smet
Duplicates
http://stackoverflow.com/questions/20633908/unable-to-login-to-kie-drools-wb-distribution-wars-6-0-0-final-jboss-as7-0

On 17-12-13 13:37, anij wrote:
 I download the *kie-drools-wb-distribution-6.0.0.Final.zip* and deployed the
 *kie-drools-wb-distribution-wars-6.0.0.Final-jboss-as7.0.war* in
 *jboss-as-7.1.1.Final* in standalone mode. Now, when I'm tring to login
 using default username : admin password: admin. It's saying Login failed:
 Invalid UserName or Password

 Log is showing this error message.

   17:38:30,683 ERROR
 [org.jboss.security.authentication.JBossCachedAuthenticationManager]
 (http--127.0.0.1-8080-1) Login failure:
 javax.security.auth.login.FailedLoginException: Password Incorrect/Password
 Required
   at
 org.jboss.security.auth.spi.UsernamePasswordLoginModule.login(UsernamePasswordLoginModule.java:270)
 [picketbox-4.0.7.Final.jar:4.0.7.Final]
   at
 org.jboss.security.auth.spi.UsersRolesLoginModule.login(UsersRolesLoginModule.java:155)
 [picketbox-4.0.7.Final.jar:4.0.7.Final]
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native 
 Method)
 [rt.jar:1.7.0_21]
   at
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
 [rt.jar:1.7.0_21]
   at
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 [rt.jar:1.7.0_21]
   at java.lang.reflect.Method.invoke(Method.java:601) 
 [rt.jar:1.7.0_21]
   at 
 javax.security.auth.login.LoginContext.invoke(LoginContext.java:784)
 [rt.jar:1.7.0_21]
   at
 javax.security.auth.login.LoginContext.access$000(LoginContext.java:203)
 [rt.jar:1.7.0_21]
   at 
 javax.security.auth.login.LoginContext$4.run(LoginContext.java:698)
 [rt.jar:1.7.0_21]
   at 
 javax.security.auth.login.LoginContext$4.run(LoginContext.java:696)
 [rt.jar:1.7.0_21]
   at java.security.AccessController.doPrivileged(Native 
 Method)
 [rt.jar:1.7.0_21]
   at
 javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:695)
 [rt.jar:1.7.0_21]
   at 
 javax.security.auth.login.LoginContext.login(LoginContext.java:594)
 [rt.jar:1.7.0_21]
   at
 org.jboss.security.authentication.JBossCachedAuthenticationManager.defaultLogin(JBossCachedAuthenticationManager.java:449)
 [picketbox-infinispan-4.0.7.Final.jar:4.0.7.Final]
   at
 org.jboss.security.authentication.JBossCachedAuthenticationManager.proceedWithJaasLogin(JBossCachedAuthenticationManager.java:383)
 [picketbox-infinispan-4.0.7.Final.jar:4.0.7.Final]
   at
 org.jboss.security.authentication.JBossCachedAuthenticationManager.authenticate(JBossCachedAuthenticationManager.java:371)
 [picketbox-infinispan-4.0.7.Final.jar:4.0.7.Final]
   at
 org.jboss.security.authentication.JBossCachedAuthenticationManager.isValid(JBossCachedAuthenticationManager.java:160)
 [picketbox-infinispan-4.0.7.Final.jar:4.0.7.Final]
   at
 org.jboss.as.web.security.JBossWebRealm.authenticate(JBossWebRealm.java:214)
 [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
   at
 org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:280)
 [jbossweb-7.0.13.Final.jar:]
   at
 org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:381)
 [jbossweb-7.0.13.Final.jar:]
   at
 org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)
 [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
   at
 org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
 [jbossweb-7.0.13.Final.jar:]
   at
 org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
 [jbossweb-7.0.13.Final.jar:]
   at
 org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
 [jbossweb-7.0.13.Final.jar:]
   at
 org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)
 [jbossweb-7.0.13.Final.jar:]
   at
 org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
 [jbossweb-7.0.13.Final.jar:]
   at
 org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)
 [jbossweb-7.0.13.Final.jar:]
   at
 org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)
 [jbossweb-7.0.13.Final.jar:]
   at java.lang.Thread.run(Thread.java:722) 
 [rt.jar:1.7.0_21]




 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Drools-6-unable-to-login-to-kie-drools-wb-distribution-wars-6-0-0-Final-jboss-as7-0-tp4027334.html
 Sent from 

Re: [rules-users] [Optaplanner] Filter values = immovable planning entities

2013-12-13 Thread Geoffrey De Smet

  
  

On 12-12-13 18:11, Mats Norn wrote:


  
Hi,
  I've got a domain with the following entities:

  

entities? you mean classes?

  
- Person (planning entity)
  - Desk (planning variable)

  

a class cannot be a variable. This probably a problem fact that and
person.getDesk() nor DeskAssignement.getPerson() is the planning
variables.

  
- DeskAssignment (solution)

  

Now I am totally confused :)
in the official examples, something called Assignment is a planning
entity.

  


All persons should be assigned to a desk according to some
  rules. 

What I would like to do is to make certain Persons and
  their Desk immovable, ie, they are assigned a desk in the
  initial solution and should be fixed there. They are only
  there for the score calculation. 

  

agreed, "immovable" is the correct concept to use for that

  


I looked at 14.3.1 Immovable planning entities but couldn't
  really see how I would apply it to my use case. 

  

Take a look at the course scheduling example.
Here's a demo of immovable planning entities in that example:
 http://www.youtube.com/watch?v=4meWIhPRVn8

  
Why is the filter applied at the planning entity level?
  Since it's the planning variable that changes I thought that I
  should somehow filter the allowed values for the Desk. 

  

Don't mix the concept of "(im)movable entities" (which is what you
want) with the concept of "limiting value ranges per entity" or the
concept of "filtering specific move selectors" (which is overkill
and convoluted for your needs).

  




Regards, 

Mats









  
  
  
  
  ___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


  

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] [Optaplanner] Filter values = immovable planning entities

2013-12-13 Thread Geoffrey De Smet

  
  

On 13-12-13 10:39, Mats Norn wrote:


  Bad choice of words. Entities. :-)


I've got three classes:



  @PlanningEntity(movableEntitySelectionFilter =
MovableWorkersSelectionFilter.class)
  public class Person extends Property {
  
  
String signature;
String name;
Desk desk;
boolean movable;
  
...
  }
  
  
  Fact:
  
  
  public class Desk extends Property {
  
  


  double x;
  double y;


  public Desk() {
  }
  
...
  }
  
Solution:

  


  @PlanningSolution
  public class
DeskAssignmentSolution implements
SolutionHardSoftScore {
  
  
private ListPerson
persons;
private ListDesk
desks;
private HardSoftScore score;
  

  
   
@PlanningEntityCollectionProperty
public ListPerson
getPersons() {
  return persons;
  
  }
  
  
public void
setPersons(ListPerson persons) {
  this.persons = persons;
}
  
  
public void
setDesks(ListDesk desks) {
  this.desks = desks;
}
  

  
   
@ValueRangeProvider(id="deskRange")
public ListDesk
getDesks() {
  return desks;
  
  }
...
  
  
  }
  
  
  A desk is assigned to a person
and makes up a desk assignment solution.
  
  
  Certain desks should not be
assigned since the are all ready occupied. The are
correctly assigned to the right person in the initial
solution.

  

  

Ah.
So there are 2 requirements:
- Some persons are immovable: they are already assigned to a desk
(MovableWorkersSelectionFilter somehow recognizes those and filters
them out). 
- Since no 2 persons can share the same desk, there's little point
in putting a desk that is already assigned to an immovable person in
the value range. You can filter them out of the value range (by
putting filters in the CH and local search etc), but I wouldn't
bother with that improvement: your original hard constraint "no 2
persons can share the same desk" will gives those moves an
infeasible score, so they are unlikely to be picked anyway (and if
they are picked it can actually be a good thing: tunnel through an
infeasible solution to a better feasible solution).

  

  

  

  
  Does the SelectionFilter prevent
the desk being assigned somehow? I thought a
SelectionFilterPerson would only prevent a move
of the Person but it's the Desk being assigned?
  
  
  Regards,
  Mats
  
  
  
  


  
On Fri, Dec 13, 2013 at 9:32 AM, Geoffrey De Smet ge0ffrey.s...@gmail.com
wrote:

   
On 12-12-13 18:11, Mats Norn wrote:


  
Hi,
  I've got a domain with the following entities:

  

entities? you mean classes?

  
- Person (planning entity)
  - Desk (planning variable)

  

a class cannot be a variable. This probably a
problem fact that and person.getDesk() nor
DeskAssignement.getPerson() is the planning
variables.

  
- DeskAssignment (solution)

  

Now I

Re: [rules-users] Fwd: Gradle/SBT example for Drools6

2013-12-10 Thread Geoffrey De Smet

  
  
The drools-bom is mostly aimed to make it easier for maven users,
so they don't have to declare the version of every drools artifact
separately in their dependencyManagement.

In gradle, don't import the bom, declare a property for the drools
version and just use that property as a version when you depend on a
drools artifact.

On 10-12-13 16:09, Diego Alvarez
  Zuluaga wrote:


  
Hi


  

  
  
  Anyone has a working gradle/sbt configuration for
Drools6?
  



  
I tried a lot to convert the "bom" unsuccessfully :(




  This is not
supported by gradle or SBT:


   dependencyManagement
  dependencies
dependency
 
groupIdorg.drools/groupId
 
artifactIddrools-bom/artifactId
  typepom/type
 
version6.0.0.Final/version
  scopeimport/scope
/dependency
  /dependencies
/dependencyManagement



  


  
  
  --
  Diego Alvarez Zuluaga
  
http://d1egoaz.com/

  


  
  
  
  
  ___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


  

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] Optaplanner (V6.0.0) / Vehicle Routing / Speed of a Vehicle

2013-12-09 Thread Geoffrey De Smet

  
  
Presuming you mean the VRP with time windows variant:
Both VRP example variants follows their research spec (see docs for
link).
The VRP with time windows spec indeed just counts the distance as
time in the score function,
so given that the distance is specified in longitude/latitude, that
means a vehicle has a static speed (whatever that amounts to).

The way most implementations deal with this (as well with other
real-world requirements),
is to replace the connections from customer A to customer B
with real GPS navigation times.
See

http://stackoverflow.com/questions/19410972/optaplanner-vrp-edge-weights-need-to-use-actual-gps-data-instead-of-euclidean-di

Also note that you can customize the score function
(vehicleRoutingScoreRules.drl) to your business's needs.
Depending on your business, you might want to favor time
optimization, fuel consumption optimization or a weighted score of
both.

On 09-12-13 23:47, Suleyman Demirel
  wrote:


  Hello everyone,


I have just found out about optaplanner and have been
  testing the vehicle routing problem on the examples provided.
  I am not able to see how we can change the speed of a vehicle
  using the data files provided. If my calculations are not
  wrong, the current assumption looks like a vehicle's speed is
  30 kmh (or miles per hour, whichever is assumed to be used).


Does anyone know how that can be modified? Thanks.
  
  
  -- 
  
Suleyman Demirel

  

  
  
  
  
  ___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


  

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] [Optaplanner] Scheduling + VRP

2013-12-01 Thread Geoffrey De Smet

On 30-11-13 15:02, Mats Norén wrote:
 Hi,
 I'm looking for an example that does both scheduling and vrp.
No example of that combination yet.
 I have workers with certain skills and I have goods (which require a 
 particular skill set) to be delivered or picked up within certain time 
 windows.
 Each worker work in a team.
 The team should if possible be assigned to the same delivery/pickup.
 The workers work in shifts and by law has to have breaks etc.
 I want to create a schedule that assigns workers/teams to deliveries/pickups 
 and stay within the time windows as well as optimizing the distance travelled.
 I thought about the nurse rostering example together with cvrptw but the 
 nurse rostering uses shifts (day, night).

 Do I have to do it in two steps? First VRP and then try to assign the workers?
In practice, I often see this happening in 2 separate, sequential 
planning problems (or phases),
but that's just because of Conway's law:
   organizations which design systems ... are constrained to produce 
designs which are copies of the communication structures of these 
organizations

2 phases is probably suboptimal, because the limitations on the second 
phase influence the planning of the first phase.
There are 3 ways to handle that:

1) Ignore it that 2 phases is suboptimal. You 'll have better results 
that the old system already. You can tweak it by adding some constraints 
in phase 1 that make it easier for phase 2.

2) Bender's decomposition. Basically ping-pong between phase 1 and phase 
2 (where the result of phase 2 adds constraints in phase 1). Not yet 
supported out-of-the-box by OptaPlanner, but probably a domain specific 
pita to implement.

3) Do it all in 1 phase. OptaPlanner 6 has been written to handle 
multiple planning entity classes and multiple planning variables, so 
it's definitely possible. You 'll like need to add course grained moves 
to get things to change for phase 1 in a way that works for phase 2, to 
avoid getting stuck in a score trap (see docs).

I am a strong believer in approach 3). If you go that way, let me know 
how it works out: I need cases to prove that the human planners that 
follow Conway's law should not limit our potential when automating this.
But the conservative choice is 1).

In any case, I recommend to prototype phase 1 first.


 The only hard facts are the workers worktime and the goods delivery/pickup 
 time.

 Any suggestions?

 Best regards,
 Mats
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] [Optaplanner] Scheduling + VRP

2013-12-01 Thread Geoffrey De Smet

On 01-12-13 23:27, Mats Norén wrote:
 Thanks,
 I'll give number three a try :-)
 Is there an example with two planning entities?
Not yet. Also look for a recent question on this mailing list about 
Construction Heuristics and 2 planning entity classes.
There's a small undocumented part that that didn't make the 6.0.0.Final 
ref manual.

 Regards,
 Mats

 1 dec 2013 kl. 10:58 skrev Geoffrey De Smet ge0ffrey.s...@gmail.com:

 On 30-11-13 15:02, Mats Norén wrote:
 Hi,
 I'm looking for an example that does both scheduling and vrp.
 No example of that combination yet.
 I have workers with certain skills and I have goods (which require a 
 particular skill set) to be delivered or picked up within certain time 
 windows.
 Each worker work in a team.
 The team should if possible be assigned to the same delivery/pickup.
 The workers work in shifts and by law has to have breaks etc.
 I want to create a schedule that assigns workers/teams to 
 deliveries/pickups and stay within the time windows as well as optimizing 
 the distance travelled.
 I thought about the nurse rostering example together with cvrptw but the 
 nurse rostering uses shifts (day, night).

 Do I have to do it in two steps? First VRP and then try to assign the 
 workers?
 In practice, I often see this happening in 2 separate, sequential
 planning problems (or phases),
 but that's just because of Conway's law:
organizations which design systems ... are constrained to produce
 designs which are copies of the communication structures of these
 organizations

 2 phases is probably suboptimal, because the limitations on the second
 phase influence the planning of the first phase.
 There are 3 ways to handle that:

 1) Ignore it that 2 phases is suboptimal. You 'll have better results
 that the old system already. You can tweak it by adding some constraints
 in phase 1 that make it easier for phase 2.

 2) Bender's decomposition. Basically ping-pong between phase 1 and phase
 2 (where the result of phase 2 adds constraints in phase 1). Not yet
 supported out-of-the-box by OptaPlanner, but probably a domain specific
 pita to implement.

 3) Do it all in 1 phase. OptaPlanner 6 has been written to handle
 multiple planning entity classes and multiple planning variables, so
 it's definitely possible. You 'll like need to add course grained moves
 to get things to change for phase 1 in a way that works for phase 2, to
 avoid getting stuck in a score trap (see docs).

 I am a strong believer in approach 3). If you go that way, let me know
 how it works out: I need cases to prove that the human planners that
 follow Conway's law should not limit our potential when automating this.
 But the conservative choice is 1).

 In any case, I recommend to prototype phase 1 first.

 The only hard facts are the workers worktime and the goods delivery/pickup 
 time.

 Any suggestions?

 Best regards,
 Mats
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] Optaplanner with Apache Commons Collections 4.0

2013-11-29 Thread Geoffrey De Smet

On 27-11-13 22:12, jonathan.labin wrote:
 Apache Commons Collections 4.0 has been released and has some data structures
 that I'm interested in using in my application.

 To your knowledge can Optaplanner function with version 4.0 swapped in place
 of 3.2.1?
I am not of anyone that tried besides you.
If you want to be confident it's safe, do the following:

git clone optaplanner
cd optaplanner
gedit pom.xml
// in dependencyManagement overwrite the commons-collections 
dependency to 4.0 and save
mvn clean install
// runs all unit and integration tests in about 8 minutes (without the 
stress test that take 30 hours but don't cover more code)

If the build succeeds, its fine.

 I have tried this and not encountered any issues at build or run time but
 that of course doesn't mean they aren't there.

 Will the next release of Optaplanner leverage this more recent release of
 Collections?
Probably not in the next release. IIRC Hibernate, EAP 6, etc are still 
using commons-collections 3.x,
so it would be too early to jump to a new major release (a minor or 
hotfix release would be less trouble).
Sooner or later, we will upgrade though.

Side note: I am seriously considering of adding a guava dependency in 
optaplanner 6.1 and dump the commons-collections dependency altogether.
   https://issues.jboss.org/browse/PLANNER-209
Wdyt?


 Thanks,

 Jon



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Optaplanner-with-Apache-Commons-Collections-4-0-tp4026958.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] BEST_FIT Null Pointer Exception

2013-11-29 Thread Geoffrey De Smet
 Exception in thread main java.lang.NullPointerException
   at
 com.example.domain.solver.MyVariableStrengthComparator.compare(MyVariableStrengthComparator.java:30)
That's an NPE in your code :)
(if that doesn't make any sense, any decent Java Programming 
course/tutorial should cover how to diagnose and fix that)

On 28-11-13 13:32, newbie wrote:
 Exception in thread main java.lang.NullPointerException
   at
 com.example.domain.solver.MyVariableStrengthComparator.compare(MyVariableStrengthComparator.java:30)
   at
 com.example.domain.solver.MyVariableStrengthComparator.compare(MyVariableStrengthComparator.java:1)
   at java.util.Arrays.mergeSort(Arrays.java:1270)
   at java.util.Arrays.mergeSort(Arrays.java:1282)
   at java.util.Arrays.mergeSort(Arrays.java:1282)
   at java.util.Arrays.mergeSort(Arrays.java:1282)
   at java.util.Arrays.mergeSort(Arrays.java:1282)
   at java.util.Arrays.sort(Arrays.java:1210)
   at java.util.Collections.sort(Collections.java:159)
   at
 org.optaplanner.core.impl.heuristic.selector.common.decorator.ComparatorSelectionSorter.sort(ComparatorSelectionSorter.java:28)
   at
 org.optaplanner.core.impl.heuristic.selector.value.decorator.SortingValueSelector.constructCache(SortingValueSelector.java:43)
   at
 org.optaplanner.core.impl.heuristic.selector.common.SelectionCacheLifecycleBridge.phaseStarted(SelectionCacheLifecycleBridge.java:48)
   at
 org.optaplanner.core.impl.phase.event.SolverPhaseLifecycleSupport.firePhaseStarted(SolverPhaseLifecycleSupport.java:41)
   at
 org.optaplanner.core.impl.heuristic.selector.AbstractSelector.phaseStarted(AbstractSelector.java:47)
   at
 org.optaplanner.core.impl.phase.event.SolverPhaseLifecycleSupport.firePhaseStarted(SolverPhaseLifecycleSupport.java:41)
   at
 org.optaplanner.core.impl.heuristic.selector.AbstractSelector.phaseStarted(AbstractSelector.java:47)
   at
 org.optaplanner.core.impl.heuristic.selector.value.decorator.ReinitializeVariableValueSelector.phaseStarted(ReinitializeVariableValueSelector.java:52)
   at
 org.optaplanner.core.impl.phase.event.SolverPhaseLifecycleSupport.firePhaseStarted(SolverPhaseLifecycleSupport.java:41)
   at
 org.optaplanner.core.impl.heuristic.selector.AbstractSelector.phaseStarted(AbstractSelector.java:47)
   at
 org.optaplanner.core.impl.phase.event.SolverPhaseLifecycleSupport.firePhaseStarted(SolverPhaseLifecycleSupport.java:41)
   at
 org.optaplanner.core.impl.heuristic.selector.AbstractSelector.phaseStarted(AbstractSelector.java:47)
   at
 org.optaplanner.core.impl.phase.event.SolverPhaseLifecycleSupport.firePhaseStarted(SolverPhaseLifecycleSupport.java:41)
   at
 org.optaplanner.core.impl.constructionheuristic.placer.AbstractEntityPlacer.phaseStarted(AbstractEntityPlacer.java:41)
   at
 org.optaplanner.core.impl.constructionheuristic.DefaultConstructionHeuristicSolverPhase.phaseStarted(DefaultConstructionHeuristicSolverPhase.java:120)
   at
 org.optaplanner.core.impl.constructionheuristic.DefaultConstructionHeuristicSolverPhase.solve(DefaultConstructionHeuristicSolverPhase.java:62)
   at
 org.optaplanner.core.impl.solver.DefaultSolver.runSolverPhases(DefaultSolver.java:190)
   at
 org.optaplanner.core.impl.solver.DefaultSolver.solve(DefaultSolver.java:155)



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/BEST-FIT-Null-Pointer-Exception-tp4026935p4026977.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Optaplanner ShiftAssignment Employee is null

2013-11-29 Thread Geoffrey De Smet

On 29-11-13 11:47, ns wrote:
 Hi,

 I have a strange error. When I get my final roster, I do:

 System.out.println(final_roster.getShiftAssignmentList());
Look at this line (final_roster)

 I get a list of all the employees (with their names) assigned to a certain
 shift on a certain date.

 Now I would like to iterate over this list to save it to my database, so I
 do the following to test:

 for (ShiftAssignment shiftAssignment : roster.getShiftAssignmentList())
Now look at this line (roster)
 {
   System.out.println(Shift assignment:  + shiftAssignment.getEmployee()
 +  -  + shiftAssignment.getShiftDate() +  -  +
 shiftAssignment.getShift().getLabel());
 }

 But now the shiftAssignment.getEmployee() returns null. How can this happen?
 Thanks



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Optaplanner-ShiftAssignment-Employee-is-null-tp4027010.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] CurriculumCourse - extending for multiple teachers per course

2013-11-27 Thread Geoffrey De Smet
I haven't done many experiments yet with multiple planning entity classes
for which 1 planning entity class points to the other planning entity 
class (unless it's chained like in VRP).
The unit tests cover these constructs though, so no worries.

Anyway, if you fancy writing a blog article about your use case, your 
domain model and your results,
I 'd definitely be interested in reading that (and supply my thoughts on 
the design).

On 27-11-13 02:22, clients wrote:
 Thanks, that was it. After digging around a bit I was able to get it working.

 Appreciate the help!



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/CurriculumCourse-extending-for-multiple-teachers-per-course-tp4026896p4026948.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Optaplanner rule to assign employee only to shift when he/she has the skills

2013-11-26 Thread Geoffrey De Smet
If you copied the employee rostering example, you can click on the 
shifts to assign them to another employee.

Before you do that, write down the score.
Then use the trick above the reassign the shifts as you believe it's better.
Now write down the score again.
Is the score better?

On 26-11-13 09:29, ns wrote:
 Does anyone know why Optaplanner plans all employees, instead of only the
 employees with the necessary skills? Thank you.



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Optaplanner-rule-to-assign-employee-only-to-shift-when-he-she-has-the-skills-tp4026879p4026940.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] BEST_FIT Null Pointer Exception

2013-11-25 Thread Geoffrey De Smet
Can you copy-paste the whole stacktrace?

On 25-11-13 21:51, newbie wrote:
 I am currently using final 6.0 and I used
 constructionHeuristicTypeBEST_FIT/constructionHeuristicType but after I
 have run it propmts java.lang.NullPointerException pointing to my
 PlanningVariableStrengComparator. Did I miss something? My planning variable
 comparator by the way is :

 public class MyVariableStrengthComparator implements ComparatorMyVariable,
 Serializable {

  public int compare(MyVariable a, MyVariable b) {
  return new CompareToBuilder()
  .append(a.getId(), b.getId())
  .toComparison();
  }

 }



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/BEST-FIT-Null-Pointer-Exception-tp4026935.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] CurriculumCourse - extending for multiple teachers per course

2013-11-24 Thread Geoffrey De Smet

  
  

On 22-11-13 23:38, clients wrote:


  Hi, 

I have been playing around with the optaplanner library for the past couple
of weeks trying to learn a bit of the basics. I have been making some
progress but I have a simple variation I am trying to accomplish to the
stock CurriculumCourse example and am hitting a wall. 

What I am trying to do is modify the CurriculumCourse example to also allow
the teachers to be planning variables. I plan on extending it to give
constraints on which courses individual teachers can teach, but to start I
am just assuming each teacher can teach any class to make things easier. 

- First I tried to add the Course entity as a second planning entity with
the teacher being a PlanningVariable but keep on running into an exception
based on the solver configuration

java.lang.IllegalArgumentException: The entityPlacerConfig
(QueuedEntityPlacerConfig(null, null)) has no entitySelector configured and
because there are multiple in the planningEntityClassSet ([class
org.optaplanner.examples.curriculumcourse.domain.Lecture, class
org.optaplanner.examples.curriculumcourse.domain.Course]), it can not be
deducted automatically. at
org.optaplanner.core.config.constructionheuristic.placer.EntityPlacerConfig.deduceEntityDescriptor(EntityPlacerConfig.java:43)

That's inside the construction heuristic configuration.
An entitySelector gets automatically generated there and
because there are multiple entities, it doesn't know which one you
mean.
I haven't documented yet how you can customize the CH configuration,
but here are some tips:
Follow the rabit hole down from ConstructionHeuristicSolverPhaseConfig and
  QueuedEntityPlacerConfig.
  The configuration looks something like this:
   constructionHeuristic
 queuedEntityPlacer
   entitySelector id="a"/
   changeMoveSelector
 mimicEntitySelector refId="a"/
 valueSelector
   /changeMoveSelector
 /queuedEntityPlacer
   /constructionHeuristic

Note: the mimic part is documented already.
Seeing that you have 2 planning entitie classes,
you can add 2 constructionHeuristic elements, and change the
entitySelector for each entity class.


  


I can't seem to figure out where the entitySelector is missing or what the
entityPlacer is used for or where it is configured. I have read that
multiple planning entities are possible, but can't determine how to get this
*simple* example to work.

- Second I tried to see if i could move the teacher planning variable to the
Lecture planningEntity, but cant figure out a way to keep all of the
lectures of one course stuck with the same teacher. I dont believe I can
change other planning entities on my own when one is updated.

I am still new to looking at these problems and determining the best model
to fit it, so hoping someone might have some tips/help on how to handle this
scenario.

Thanks in advanced,



--
View this message in context: http://drools.46999.n3.nabble.com/CurriculumCourse-extending-for-multiple-teachers-per-course-tp4026896.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users




  

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] SolutionInitializer for Nullable Planning Variable

2013-11-24 Thread Geoffrey De Smet
Are you using 6.0.0.Final? There was a bug with nullable variables and 
CH's in 6.0.0.CR5 and earlier.

On 24-11-13 03:20, newbie wrote:
 I created a custom solver which assign planning variables to planning
 entities. I have a simple rule checking if  there are no assign variable
 that adds negative soft constraint. But when I assigned my planning variable
 it increases the negative score instead of reducing it. I have for example
 12 entities and my starting score was
 0/-12.But when I initialized it with 4 variables it increases to 0/-16.

 rule null variable

  when
   $myEntity : Entity( variable == null )
  then
   scoreHolder.addSoftConstraintMatch(kcontext, 0, -1);
 end



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/SolutionInitializer-for-Nullable-Planning-Variable-tp4026901.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] SolutionInitializer for Nullable Planning Variable

2013-11-24 Thread Geoffrey De Smet
In that case, can you create a new jira and attach any way I can 
reproduce the issue locally?
   https://issues.jboss.org/browse/PLANNER

On 24-11-13 14:50, newbie wrote:
 Yes I am using now the latest version 6.0.0.Final.



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/SolutionInitializer-for-Nullable-Planning-Variable-tp4026901p4026905.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Optaplanner: Unexpected global [scoreHolder] - Kie API trouble

2013-11-22 Thread Geoffrey De Smet
Which path in what file?

On 22-11-13 15:27, jonathan.labin wrote:
 It seems to also throw this error any time the path includes the character: \
 Even properly escaped in the string as \\



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Optaplanner-Unexpected-global-scoreHolder-tp4023837p4026886.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Optaplanner: Unexpected global [scoreHolder] - Kie API trouble

2013-11-22 Thread Geoffrey De Smet
Looks like a bug in drools, not really relate to optaplanner as it 
happens before you set this KieBase on OptaPlanner's SolverFactory, I 
presume?

If (and only if) it reproduces with drools 6.0.0.Final (optaplanner 
6.0.0.Final uses that version), create a new jira:
   https://issues.jboss.org/browse/DROOLS
We're in squashing bugs mode, so it's a perfect time to create these 
jira's :)

On 22-11-13 16:19, jonathan.labin wrote:
 I am calling KieFileSystem.write(String path ,String content) but the same
 issue may be experienced with any of the versions of write that take a
 path parameter but I haven't tried them.

 I found that if the path parameter includes a character \ there is no error
 produced when calling KieFileSystem.write(...).

 When a KieBuilder.buildAll() is called a warning is logged:
 [o.d.compiler.kie.builder.impl.AbstractKieModule   ] No files found for
 KieBase defaultKieBase

 Then when solving begins the exception  is thrown:
 java.lang.RuntimeException: Unexpected global [scoreHolder]
 (the same stack trace provided at the beginning of this thread).

 For my code I've done a String regex just before the write call to swap any
 \ into /
 replaceAll(,/)



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Optaplanner-Unexpected-global-scoreHolder-tp4023837p4026888.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Optaplanner: Unexpected global [scoreHolder] - Kie API trouble

2013-11-22 Thread Geoffrey De Smet
then file a jira in optaplanner, it might be optaplanner's fault in 
ScoreDirectorFactoryConfig.java.

On 22-11-13 17:14, jonathan.labin wrote:
 The exception is not finally thrown until the call to
 solver.solve();



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Optaplanner-Unexpected-global-scoreHolder-tp4023837p4026891.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] How to deal with doubles in Optaplanner drools rules

2013-11-21 Thread Geoffrey De Smet
Use scoreDefinitionTypeHARD_SOFT_DOUBLE/scoreDefinitionType

Read this section
http://docs.jboss.org/drools/release/latest/optaplanner-docs/html_single/index.html#d0e4068
and especially this section:
http://docs.jboss.org/drools/release/latest/optaplanner-docs/html_single/index.html#avoidFloatingPointNumbersInScoreCalculation

hth

On 21-11-13 11:54, ns wrote:
 Hi,

 I am having trouble dealing with doubles in the Optaplanner drools rule drl
 file. See error message below.

 Exception in thread main java.lang.IllegalStateException: There are errors
 in the scoreDrl's:
 Error Messages:
 Message [id=1, level=ERROR,
 path=optaplanner-kie-namespace//be/ocmwturnhout/permanenties/solver/permanentiesScoreRules.drl,
 line=96, column=0
 text=Rule Compilation error The method
 addSoftConstraintMatch(RuleContext, int) in the type HardSoftScoreHolder is
 not applicable for the arguments (RuleContext, double)]

 I have the following then rule part:

 scoreHolder.addSoftConstraintMatch(kcontext, -(10 *
 Math.abs(($employee.getArbeidsbreuk() * $assignmentTotal.intValue()) -
 $assignmentTotalEmployee.intValue())) * (10 *
 Math.abs(($employee.getArbeidsbreuk().intValue() *
 $assignmentTotal.intValue()) - $assignmentTotalEmployee.intValue())) );

 $employee.getArbeidsbreuk() is a double.

 Aren't doubles allowed or can I convert it? Thanks.

 Kind regards,

 Ncik



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/How-to-deal-with-doubles-in-Optaplanner-drools-rules-tp4026865.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Optaplanner rules NullPointerException in PhreakAccumulateNode

2013-11-21 Thread Geoffrey De Smet
That's a bug in drools.
What version are you using?
If you can reproduce it in 6.0.0.Final, can you file a jira here?
   https://issues.jboss.org/browse/DROOLS

On 21-11-13 14:40, ns wrote:
 Hi,

 I am trying to accomplish the following, a part time employee (eg 50%) needs
 to do only half the shifts a full time employee needs to do. I have created
 a rule, that

 1. count number of shifts of certain shiftType
 2. count number of shifts of a certain shiftType per employee
 3. count the total number of arbeidsbreuken per employee and within a
 certain shiftType
 4. do something with these numbers so that an part time employee only gets
 half the shifts assigned that a full time employee gets

 The complete rule is:

 rule arbeidsbreuk
  when
   //System.out.println(arbeidsbreuk, Drools!);
   ShiftAssignment($employee : employee, $shiftType : shiftType)
   //count aantal shifts
  $assignmentTotal : Number() from accumulate(
  $assignment : ShiftAssignment(shiftType == $shiftType),
  count($assignment)
  )
  
  //count aantal shifts per medewerker
  $assignmentTotalEmployee : Number() from accumulate(
  $assignmentEmployee : ShiftAssignment(employee == $employee,
 shiftType == $shiftType),
  count($assignmentEmployee)
  )
  
  //count arbeidsbreuken van alle medewerkers
  $arbeidsbreukTotal : Number() from accumulate(
  //Employee($breuk : arbeidsbreuk),
  ShiftAssignment(employee == $employee, shiftType == $shiftType),
  sum($employee.getArbeidsbreuk())
  )
 $assignmentTotalEmployee.intValue())
  then
   System.out.println(Arbeidsbreuk drools:  +
 $employee.getArbeidsbreuk() +  -  + $assignmentTotal.intValue() +  -  +
 $assignmentTotalEmployee.intValue() +  -  + $arbeidsbreukTotal);
  scoreHolder.addSoftConstraintMatch(kcontext,
 -(Math.abs(($employee.getArbeidsbreuk() * $assignmentTotal.intValue()) -
 $assignmentTotalEmployee.intValue()) *
 (Math.abs(($employee.getArbeidsbreuk() * $assignmentTotal.intValue()) -
 $assignmentTotalEmployee.intValue( );
 end

 I get the following error:

 Exception in thread main org.drools.core.RuntimeDroolsException:
 java.lang.NullPointerException
   at org.drools.core.rule.Accumulate.accumulate(Accumulate.java:182)
   at
 org.drools.core.phreak.PhreakAccumulateNode.addMatch(PhreakAccumulateNode.java:756)
   at
 org.drools.core.phreak.PhreakAccumulateNode.doLeftInserts(PhreakAccumulateNode.java:164)
   at
 org.drools.core.phreak.PhreakAccumulateNode.doNode(PhreakAccumulateNode.java:81)
   at
 org.drools.core.phreak.RuleNetworkEvaluator.switchOnDoBetaNode(RuleNetworkEvaluator.java:524)
   at
 org.drools.core.phreak.RuleNetworkEvaluator.evalBetaNode(RuleNetworkEvaluator.java:494)
   at
 org.drools.core.phreak.RuleNetworkEvaluator.innerEval(RuleNetworkEvaluator.java:277)
   at
 org.drools.core.phreak.RuleNetworkEvaluator.outerEval(RuleNetworkEvaluator.java:161)
   at
 org.drools.core.phreak.RuleNetworkEvaluator.evaluateNetwork(RuleNetworkEvaluator.java:116)
   at
 org.drools.core.phreak.RuleExecutor.reEvaluateNetwork(RuleExecutor.java:205)
   at
 org.drools.core.phreak.RuleExecutor.evaluateNetworkAndFire(RuleExecutor.java:65)
   at
 org.drools.core.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:936)
   at
 org.drools.core.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1183)
   at
 org.drools.core.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:935)
   at
 org.drools.core.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:909)
   at
 org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:233)
   at
 org.optaplanner.core.impl.score.director.drools.DroolsScoreDirector.calculateScore(DroolsScoreDirector.java:98)
   at
 org.optaplanner.core.impl.solver.scope.DefaultSolverScope.calculateScore(DefaultSolverScope.java:101)
   at
 org.optaplanner.core.impl.bestsolution.BestSolutionRecaller.solvingStarted(BestSolutionRecaller.java:58)
   at
 org.optaplanner.core.impl.solver.DefaultSolver.solvingStarted(DefaultSolver.java:177)
   at
 org.optaplanner.core.impl.solver.DefaultSolver.solve(DefaultSolver.java:154)
   at be.ocmwturnhout.permanenties.Main.main(Main.java:495)
 Caused by: java.lang.NullPointerException
   at
 be.ocmwturnhout.permanenties.solver.Rule_arbeidsbreuk654888368.accumulateExpression2(Rule_arbeidsbreuk654888368.java:23)
   at
 be.ocmwturnhout.permanenties.solver.Rule_arbeidsbreuk654888368AccumulateExpression2Invoker.evaluate(Rule_arbeidsbreuk654888368AccumulateExpression2Invoker.java:25)
   at
 org.drools.core.base.accumulators.JavaAccumulatorFunctionExecutor.accumulate(JavaAccumulatorFunctionExecutor.java:107)
   at org.drools.core.rule.Accumulate.accumulate(Accumulate.java:173)
   

Re: [rules-users] Optaplanner rule to assign employee only to shift when he/she has the skills

2013-11-21 Thread Geoffrey De Smet
That seems wierd:

  skill == $shiftType

That's equals between apples and oranges?

On 21-11-13 16:23, ns wrote:
 I am trying to create a rule that adds a hard constraint when an employee
 gets assigned to a shift for which he does not have the skills.

 I have created a table in MySQL that assigns an employee to a certain
 shiftType. In my code I stated that once an employee is assigned to a
 shiftType, he or she automatically has the skills needed for that shiftType,
 hence the skill == $shiftType part in the rule.

 rule alternativeSkill
  when
  $assignment : ShiftAssignment($employee : employee, $shiftType :
 shiftType)
  not SkillProficiency(employee == $employee, skill == $shiftType)
  then
  scoreHolder.addHardConstraintMatch(kcontext, -1);
 end

 With the above rule employees still get assigned to shifts they do not have
 the skill for. What is wrong with this rule? Thanks.

 Kind regards,

 Nick



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Optaplanner-rule-to-assign-employee-only-to-shift-when-he-she-has-the-skills-tp4026879.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Nullable Planning Variable

2013-11-20 Thread Geoffrey De Smet
In 6.0.0.CR5 (and earlier) there was a bug in the CH with nullable 
variables that forced them to pick a non-null value.
Try 6.0.0.Final. The release announcement will go out next week.

Also, that version has an example (and therefor an integration test) of 
a nullable variable:
the hospital bed planning example has been redefined and rewritten to 
accommodate for overconstrained planning.

On 21-11-13 05:35, newbie wrote:
 I am using 6.0.0CR5. I configure the planning variable to be null. Now using
 the construction heuristic constructionHeuristic
  constructionHeuristicTypeFIRST_FIT/constructionHeuristicType
  forager
pickEarlyTypeFIRST_NON_DETERIORATING_SCORE/pickEarlyType
  /forager
/constructionHeuristic

 all the planning entities was assigned with a planning variable even if the
 assignment lead to a negative hard constraint. I assumed that some of it
 will be assigned by null to avoid the negative hard constraint. Is my
 assumption correct way of using the nullable planning varibale config?
 Thanks.



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Nullable-Planning-Variable-tp4026757p4026862.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Optaplanner order schedule performance problem

2013-11-20 Thread Geoffrey De Smet

  
  
I don't have the time budget to do a full code review for a
community question,
but here are my initial thoughts:


A) Is your average calculation count per second above 5000?
If not, figure out which score rules are slowing you down.


B) Your assessment of "Concept with timeslots has to many possible
order positions." might be correct.

I've seen before on job shop scheduling problems,
that having second grained accuracy on starting time, in cases with
days/weeks of running time,
where each job (=order) takes minutes - is inefficient in a
straightforward model, currently.
Specifically because the constraints want the jobs to be pasted
after each other.

Here are (parts of) a solution for B):

1) Use a smarter (more complex model) that leaves less pointless
combinations.
Some idea's:
- Look at the Project Job Scheduling example's source code.
 http://www.youtube.com/watch?v=_2zweB9JD7c
If orders have dependencies on each other, this works well.
- Look at Vehicle Routing with Time windows. Maybe this model works
for you:
Each Vehicle = 1 of your machines. Each customer = 1 job.
ArrivalTime = startingOrderTime.
Setup times etc are added automatically in the arrivalTime due to
the VariableListener.

2) (Future) For OptaPlanner 6.1.0.Beta1 (which is coming soon), we
are working on numeric ValueRanges.
 https://issues.jboss.org/browse/PLANNER-160
This way, if a the values are (00:01, 00:02, 00:03, ..., 00:55,
...),
OptaPlanner understands that 00:02 is closer to 00:03 than to 00:55,
and the generic change move selector will support a gaussian
distribution random close to it's current value.

3) (Future) "CH based metaheuristics" (also called "indirect
metaheuristics" - or by me "feature L").
Too hard to explain now, but research shows this is very promising
for these kind of use cases (a big leap forward).
I am confident I can make it simple to use (despite it's inherit
complexity), hopefully for 6.1.
It does have some drawbacks and limitations (especially if you rely
on a specific types of soft constraints).


On 20-11-13 17:32, Mohr, Michael wrote:


  
  
  
  
Hi,

I must find start and end times for orders on different
equipments in requirement of a stock.
What can I do better to get faster a solution.

I read the forum entries but it don't helps.
- Scheduling events with varying durations - corrupted score
- Time Slots vs Time Periods
Graphics
  and detail description
  in the pdf. 


Domain model

@PlanningEntity
EquipmentAllocation has a Equipment
EquipmentAllocation has a Order
EquipmentAllocation has a TimeSlot
--
@PlanningVariable
Order
Attribute: quantity
--
TimeSlot
Attribute: startTime, endTime, duration, sequenceNumber
--
Material
Attribute: stock, minStock, maxStock
--
Material Demand has a TimeSlot
Attribute: quantity
--

Conditions:
-Order is executable on each equipment.
-Orders has different sizes.
-Order running time is depending of the material and
the equipment.
-Gaps between orders are possible if there is no
demand.
-Gaps between orders are possible when there is a
equipment setup time.
-Parallel orders with same material on different
equipments are possible.

Target:
-Calculate start and endtims for an order.
-Start and endtime is precisely one minute (maximum
five minutes if runtime is to long).
-Satisfy only the demand of a material.
-Good result in 5 minutes.
-No exceed min or max stock.

Plan data:
-Plan for 24 hours.
-Plan 35 orders (normal order time is 2 hours).
-Plan 5 demands with different materials (7 orders
per demand).
-Plan 3 equipments.

Problem:
-No result in 5 minutes.
-Concept with timeslots has to many possible order
positions.
-

Re: [rules-users] Java Heap Space Out of Memory

2013-11-19 Thread Geoffrey De Smet

On 19-11-13 07:23, newbie wrote:
 I am currently using optaplanner 6.0.0.CR5, I have about 11000 planning
 entity objects and about 1000 planning variable objects. Would that be the
 cause of this problem?
By default, OptaPlanner uses selectors with cacheType=JIT, which can 
handle 50K entities with 5k values.
If you specifically specify cacheType=STEP|PHASE or use a custom 
MoveListFactory, look into using JIT or MoveIteratorFactory instead.

If that's not the case, what score calculation are you using?
What's the stacktrace?

Use a tool like VisualVM to find out what is causing the problem. See 
this comment:
   https://plus.google.com/+GeoffreyDeSmet/posts/fVAXfXXKB7n




 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Java-Heap-Space-Out-of-Memory-tp4026825.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Nullable Planning Variable

2013-11-15 Thread Geoffrey De Smet
Use optaplanner 6.0.0.CR5 [1], that supports nullable planning variables 
in construction heuristics.

[1] http://www.optaplanner.org/community/droolsPlannerRenamed.html


On 13-11-13 07:31, newbie wrote:
 According to Drools 5.5 reference doc Nullable planning variables are not
 supported for construction heuristics in 5.5.x or lower. I cannot config
 the planning variable to be null using drools 5.5?



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Nullable-Planning-Variable-tp4026757.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Equal shift assignment based on employment form

2013-11-15 Thread Geoffrey De Smet

On 12-11-13 14:22, ns wrote:
 Hi,

 I would like to distribute shifts equally among employees based on their
 employment form (full time or part time: 100%, 75%, 50%, ...). I have a
 variable for each employee that holds the employment form. How do I make
 sure all shifts get distributed equally, so that somebody that works 50% of
 the time only gets half the shifts assigned than someone who works 100%.
See the new docs section fairness of 6.0.0.Final (not yet released):
https://github.com/droolsjbpm/optaplanner/blob/master/optaplanner-docs/src/main/docbook/en-US/images/Chapter-Score_calculation/fairnessScoreConstraints.png
   

 And how do I make sure shifts that employee need to do are distributed
 equally over time. So for example we have 20 shifts a month and 5 employees.
 How do I make sure I get a plan like e1, e2, e3, e4, e5, e1, e2, e3, e4, e5,
 ... Instead of e1, e1, e1, e1, e1, e2, e2, e2, e2, e2. Thanks.
2 ways (depending on your goals):
- penalize multiple gaps in a row (using the squared trick as shown above)
- count the number of assignments per week and penalize the square of it.

HTH

 Kind regards,

 Nick



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Equal-shift-assignment-based-on-employment-form-tp4026746.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] How to forsee mid way planning team changes (optaplanner)

2013-11-08 Thread Geoffrey De Smet
Makes sense. This is is probably the most straightforward way to model 
it cleanly.

You probably want to make 2 EmployeeParts and still link them to same 
Employee.
An EmployeePart is basically an employee for the entire time that he/she 
works under the same regime.
A shift gets assigned to an EmployeePart.
Normally, an Employee has only 1 EmployeePart.
But depending on how much history you're loading in due to continous 
planning (where xmas of last year might influece allocation of this 
year's xmas), you might find that some employees had 3 or more parts 
over that time span.

On 08-11-13 14:29, ns wrote:
 Hi Geoffrey,

 thanks for the reply and suggestions. I think I have found a work around
 that works for me. I am going to consider a team switch as two employees and
 make a planning for two separate employees. One ending at a certain point in
 time and the other starting at a certain point. Afterwards I join the two
 plans into one plan for that particular employee.

 Kind regards,

 Nick



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/How-to-forsee-mid-way-planning-team-changes-tp4026663p4026690.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Creating selection filter for PlanningEntity with 4 planning variables

2013-11-07 Thread Geoffrey De Smet

On 07-11-13 16:21, maciekpob wrote:
 We are developing an application whose PlanningEntity has multiple planning
 variables, in fact 4.  There are some moves that we do not want to select.
 To ensure that the values proposed (moves) for the 4 different variables do
 not break a constraint (between them).  We wanted to filter out inacceptable
 move configurations instead of using the score function to check the
 constraints.

 We studied the MoveSelector and SelectorFilter APIs and we implemented a
 ChangeMove SelectionFilter as an UnionMoveSelector of ChangeMoves of the
 four variables.   The SelectionFilter is written to accept or refuse the
 values (of the 4 variables) proposed.

   

 However we encounter problems:

 -  The same ChangeMove (with same values of the 4 variables)  are
 proposed in consecutive moves and hence invocations of SelectionFilter
A) First, see what happens if you put on the unionMoveSelector 
cacheType=PHASE (or STEP).
By using a cacheType != JIT you guarantee that the same ChangeMove 
cannot be selected twice.

I would expect you to go out of memory in that case.
If that's not the case - then see C).

B) Next, see what happens if you put the cacheType=PHASE (or STEP) on 
every changeMove, but not in unionMoveSelector.
This probably fixes the problem and might be your favorite way to do things.
But I want to know why you're getting the bailout, so do figure that out 
and reply :)

 -  The SelectionFilter rejects the values since it breaks
 constraints

 Then the we get a warning : “Bailing out of neverEnding selector ({}) to
 avoid infinite loop”.
C) Bailout is normally almost impossible to occur. Let me explain bailout.
Bailout only applies with filtering for cacheType=JIT, because JIT 
selectors are neverEnding.
Bailout happens if it's has selected (size * 10) moves (so if there are 
1 million possible moves, it must have selected 10 million moves)
AND not a single one of them was accepted by the filter.

Given the fact that it keeps selecting the same move - and that move is 
not accepted, that might explain this though.
So the real question is why does it keep selecting the same move? Is 
there only 1 move?


PS: what version are you using?
I remember fixing a bailout related problem in one of the CR's. Make 
sure you're using 6.0.0.CR5 or higher.
   

 Hence we have been unable to implement the SelectionFilter for our purposes.

 Could you advise us?








 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Creating-selection-filter-for-PlanningEntity-with-4-planning-variables-tp4026575p4026679.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.

 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] Optaplanner JAXB

2013-11-07 Thread Geoffrey De Smet

  
  
No, because the *Config classes aren't annotated with JAXB
annotations.
There's a open discussion if we want to migrate from XStream to
JAXB, so we can offer an XSD of the solver config.

Also note, that these 2 things are completely distinct:
1) read a solver configuration from XML
2) read a solution dataset from XML (~ProblemIO)

For 2), you can very easily replace XStreamProblemIO with a
JaxbProblemIO (which should be easy to write).

On 07-11-13 17:59, Jugu Dannie wrote:


  The optaplanner uses XStream for reading the solver
configuration from XML. For using JAXB instead, is it sufficient
to have custom implementation of XMLSolverFactory and
SolverConfig?
  
  
  
  
  ___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


  

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] Drools v6 documentation release date

2013-11-06 Thread Geoffrey De Smet
Try something like this meanwhile:

git clone ... droolsjbpm-knowledge
cd droolsjbpm-knowledge
cd kie-docs
mvn clean install -Dfull
firefox drools-docs/target/.../index.html

On 06-11-13 10:52, xat wrote:
 Hello Guys,

 Is release date of v6 documentation available?

 BR,
 Roman



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Drools-v6-documentation-release-date-tp4026659.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Drools v6 documentation release date

2013-11-06 Thread Geoffrey De Smet
try
cd .. // to droolsjbpm-knowledge itself
mvn clean install -DskipTests -Dfull
// wait for maven to download the internet
cd kie-docs

hth
On 06-11-13 15:03, xat wrote:
 Thanks Geoffrey,

 maven fails with an error

 [root@drools kie-docs]# mvn clean install -Dfull
 /usr/java/jdk1.7.0_21/
 [INFO] Scanning for projects...
 [INFO]
 
 [ERROR] FATAL ERROR
 [INFO]
 
 [INFO] Error building POM (may not be this project's POM).


 Project ID: org.kie:kie-docs
 POM Location: /root/drl6doc/droolsjbpm-knowledge/kie-docs/pom.xml
 Validation Messages:

  [0]  'dependencies.dependency.version' is missing for junit:junit
  [1]  'dependencies.dependency.version' is missing for
 org.mockito:mockito-all


 Reason: Failed to validate POM for project org.kie:kie-docs at
 /root/drl6doc/droolsjbpm-knowledge/kie-docs/pom.xml


 [INFO]
 
 [INFO] Trace
 org.apache.maven.reactor.MavenExecutionException: Failed to validate POM for
 project org.kie:kie-docs at
 /root/drl6doc/droolsjbpm-knowledge/kie-docs/pom.xml
  at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:376)
  at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:289)
  at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:126)
  at org.apache.maven.cli.MavenCli.main(MavenCli.java:282)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  at
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:601)
  at
 org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
  at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
  at
 org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
  at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
 Caused by: org.apache.maven.project.InvalidProjectModelException: Failed to
 validate POM for project org.kie:kie-docs at
 /root/drl6doc/droolsjbpm-knowledge/kie-docs/pom.xml
  at
 org.apache.maven.project.DefaultMavenProjectBuilder.processProjectLogic(DefaultMavenProjectBuilder.java:996)
  at
 org.apache.maven.project.DefaultMavenProjectBuilder.buildInternal(DefaultMavenProjectBuilder.java:799)
  at
 org.apache.maven.project.DefaultMavenProjectBuilder.buildFromSourceFileInternal(DefaultMavenProjectBuilder.java:476)
  at
 org.apache.maven.project.DefaultMavenProjectBuilder.build(DefaultMavenProjectBuilder.java:197)
  at org.apache.maven.DefaultMaven.getProject(DefaultMaven.java:548)
  at
 org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:458)
  at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:362)
  ... 11 more
 [INFO]
 
 [INFO] Total time:  1 second
 [INFO] Finished at: Wed Nov 06 15:57:02 EET 2013
 [INFO] Final Memory: 2M/50M
 [INFO]
 
 [root@drools kie-docs]#


 maven version:
 [root@drools kie-docs]# mvn -v
 /usr/java/jdk1.7.0_21/
 Maven version: 2.0.8
 Java version: 1.7.0_21
 OS name: linux version: 2.6.32-358.18.1.el6.x86_64 arch: amd64 Family:
 unix
 [root@drools kie-docs]#



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Drools-v6-documentation-release-date-tp4026659p402.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Optaplanner - Issue with real-time, chained and shadow variables

2013-11-04 Thread Geoffrey De Smet

  
  

On 01-11-13 19:38, Juan Ignacio
  Barisich wrote:


  

  

  

  
Hi everybody

I am using optaplanner in real-time style. My
application domain is similar to the "Vehicle
Routing" example (http://docs.jboss.org/drools/release/6.0.0.CR5/optaplanner-docs/html_single/index.html#vehicleRouting).
I mean, I am using chained variables and shadow
variables. I have a problem while trying to remove a
fact (an entity), via a ProblemFactChange:

java.lang.IllegalArgumentException: The entity
instance (...) was never added to this
ScoreDirector. Usually the cause is that that
specific instance was not in your Solution's
entities.

  
  The fact removing that I made is like:
  
  solver.addProblemFactChange(new ProblemFactChange() {
  
 @Override
 public void doChange(ScoreDirector
  scoreDirector) {
  ...
 
  scoreDirector.beforeEntityRemoved(toRemove);
 
  workingSolution.getCustomerList().remove(toRemove);

  

  

  

the remove() method will make no difference because the Customer
"toRemove" instance
is not the same instance as which is in the workingSolution's
Customer list.

See the CloudBalancing's PRoblemFactChange implementation how to
solve this.
And one of the warnings in the Real-time planning section of the
docs to understand it better:)

  

  

  
   
  scoreDirector.afterEntityRemoved(toRemove);
 }
});
  

I think the problem is there. Do you know what I'm doing
wrong?
  
  I have attached a test case based on the "Vehicle
  Routing". To run it, just put that file into the
  optaplanner-distribution-6.0.0.CR5/examples/sources/src/test/java/org/optaplanner/examples/vehiclerouting/app/
  directory.
  

I'd
  appreciate any ideas on how to resolve this.
  Best regards,
  

Juan Ignacio Barisich

  

  



  

  

  
  
  
  
  ___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


  

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] [OptaPlanner] Help on Construction Heuristics

2013-11-04 Thread Geoffrey De Smet

  
  
Either:

1) add a hard constraint to penalize what you don't want

2) look into ValueRangeProvider from entity (see docs), which
effectively makes it a build-in hard constraint.

3) Use Filtering in both the Local Search selectors as the CH
selectors (but the CH selector usage is not yet documented).
This 3) option is very difficult, especially for SwapMove's.

I recommend 1) by default.
Also don't expect that CH's give you a feasible solution, use LS on
top of CH's to get a good, feasible solution.
See "phase overview" section in the docs.

On 03-11-13 17:29, Tales Costa wrote:


  Hi all,


I am new to Optaplanner and would like some help on
  understanding how to control the planning value chosen
  byOptaplanner.


Based on the info on User Guide and the NQueen example, I
  understand that for Local Search algorithms one can use the
  Move interface (for example to forbid some specific row
  change).


However, for the Construction heuristics have not found
  any similar option. For these algoritms the only option seems
  to be to make load adjustements on the score calculations (as
  the nqueens example does for queens on the same row). Is this
  correct or am I missing something ?


Regards


Tales
  
  
  
  
  ___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


  

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] Creating selection filter for PlanningEntity with 4 planning variables

2013-11-04 Thread Geoffrey De Smet
Can you give an example?

This sounds like just another hard constraint.

On 04-11-13 12:27, maciekpob wrote:
 I'd like to filter out planning values that are incoherent between each
 other.



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Creating-selection-filter-for-PlanningEntity-with-4-planning-variables-tp4026575p4026618.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Optaplanner - Issue with real-time, chained and shadow variables

2013-11-04 Thread Geoffrey De Smet

  
  

On 04-11-13 13:10, Juan Ignacio
  Barisich wrote:


  

  

  
Geoffrey, thanks for
response.
  
The the Customer
"toRemove" instance IS the same instance as which is in
the workingSolution's Customer list. In fact, in the
test example I have attached, I get that instance via:

final Customer toRemove =
workingSolution.getCustomerList().get(0);
  

  

  

Ok, then that's not the problem indeed.

  

  

  
  
  I try to reproduce the hack in CloudBalancing's
  problemFactChange implementation, but with no success. I
  mean, I tried:
  

 // to clean the next variable of previous in the
  chain

 Standstill prev = toRemove.getPreviousStandstill();
   scoreDirector.beforeEntityRemoved(prev);
   prev.setNextCustomer(null);
   scoreDirector.afterEntityRemoved(prev);
   

but this throw an exception like:
java.lang.IllegalStateException: The entity (1(after 66))
has a variable (previousStandstill) with value (66(after
51)) which has a mappedBy variable (nextCustomer) with a
value (null) which is not that entity.
  

  

Ah, that explains it.

Although you remove the customer instance toRemove,
one of the other customers still has it as previousStandstill
and/or one of the other customers still has it as nextStandstill.

  

  

  
  Also, i try to clean the previous variable of the following
  item in the chain:
  
   // to clean the previous variable of the following customer
  in the chain
   Customer nextCustomer = toRemove.getNextCustomer();
   if (nextCustomer != null) {
scoreDirector.beforeEntityRemoved(nextCustomer);
nextCustomer.setPreviousStandstill(null);
scoreDirector.beforeEntityRemoved(nextCustomer);
   }
  
  but this throw an exception like:
  java.lang.IllegalStateException: The ScoreDirector (class
  org.optaplanner.core.impl.score.director.common.TrailingEntityMapSupport)
  is corrupted, because the entity (10(after null)) for chained
  planningVariable (previousStandstill) cannot be retracted: it
  was never inserted.
  

Can you take a look to the test I have attached and guide me
  to solve this?
  
  Thanks a lot.

Regards


  



  
  

  

  
  

2013/11/4 Geoffrey De Smet ge0ffrey.s...@gmail.com
  

   
On 01-11-13 19:38, Juan Ignacio Barisich wrote:


  

  

  

  
Hi everybody

I am using optaplanner in real-time
style. My application domain is similar
to the "Vehicle Routing" example (http://docs.jboss.org/drools/release/6.0.0.CR5/optaplanner-docs/html_single/index.html#vehicleRouting).

I mean, I am using chained variables and
shadow variables. I have a problem while
trying to remove a fact (an entity), via
a ProblemFactChange:

java.lang.IllegalArgumentException: The
entity instance (...) was never added to
this ScoreDirector. Usually the cause is
that that specific instance was not in
your Solution's entities.

  
  The fact removing that I made is like:
  
  solver.addProblemFactChange(new
  ProblemFactChange() {
  
 @Override
 public void
  do

Re: [rules-users] Optaplanner - Issue with real-time, chained and shadow variables

2013-11-04 Thread Geoffrey De Smet

  
  

On 04-11-13 14:24, Juan Ignacio
  Barisich wrote:


  
You are right. 
  Do you think that is a bug? Or is there a
  hack to solve this?

  

User problem :)
Do something like:

toRemove.getPreviousStandstill().setNextStandstill(toRemove.getNextStandstill);

toRemove.getNextStandstill().setPreviousStandstill(toRemove.getPreviousStandstill);
It might need a cast and instanceof check to Customer.

  


  2013/11/4 Geoffrey De Smet ge0ffrey.s...@gmail.com
  

   
On 04-11-13 13:10, Juan Ignacio Barisich wrote:


  

  

  
Geoffrey,
thanks for response.
  
The the
Customer "toRemove" instance IS the same
instance as which is in the
workingSolution's Customer list. In fact, in
the test example I have attached, I get that
instance via:

final Customer toRemove =
workingSolution.getCustomerList().get(0);
  

  

  

  
  Ok, then that's not the problem indeed.
  

  

  

  
  
  I try to reproduce the hack in
  CloudBalancing's problemFactChange
  implementation, but with no success. I mean, I
  tried:
  

 // to clean the next variable of
  previous in the chain

 Standstill prev =
  toRemove.getPreviousStandstill();
   scoreDirector.beforeEntityRemoved(prev);
   prev.setNextCustomer(null);
   scoreDirector.afterEntityRemoved(prev);
   

but this throw an exception like:
java.lang.IllegalStateException: The entity
(1(after 66)) has a variable
(previousStandstill) with value (66(after 51))
which has a mappedBy variable (nextCustomer)
with a value (null) which is not that entity.
  

  

  
  Ah, that explains it.
  
  Although you remove the customer instance toRemove,
  one of the other customers still has it as
  previousStandstill
  and/or one of the other customers still has it as
  nextStandstill.
  

  

  
 

Also, i try to clean the previous variable of
the following item in the chain:

 // to clean the previous variable of the
following customer in the chain
 Customer nextCustomer =
toRemove.getNextCustomer();
 if (nextCustomer != null) {
 
scoreDirector.beforeEntityRemoved(nextCustomer);
  nextCustomer.setPreviousStandstill(null);
 
scoreDirector.beforeEntityRemoved(nextCustomer);
 }

but this throw an exception like:
java.lang.IllegalStateException: The
ScoreDirector (class
org.optaplanner.core.impl.score.director.common.TrailingEntityMapSupport)

is corrupted, because the entity (10(after
null)) for chained planningVariable
(previousStandstill) cannot be retracted: it was
never inserted.

  
  Can you take a look to the test I have
attached and guide me to
   

Re: [rules-users] Ask for help with OptaPlanner

2013-11-04 Thread Geoffrey De Smet

  
  

  rule " test rule"
   when
   $s : Shift($i
: index)
   $d :
Demand(shift.getIndex() == $i)
   then
   System.out.println("Test
rule fired.");
  end

So your Solution.getProblemFacts() method adds all Shifts and all
Demands?
Then the rule should fire if there is indeed such a combination.

Write a SimpleScoreCalculator to verify this (see docs).
Later on, you can reuse that SimpleScoreCalculator in
assertionScoreDirectorFactory to validate your DRL (which is
much faster).

On 04-11-13 16:26, nkgxgongxi wrote:


  Ge0ffery,

Thank you very much for the reply. I have double-checked my code, and I did
use addAll() here.

I also used one of my simplest OptaPlanner projects as a test, and the same
thing occurred. 

Later last Friday I found out a workaround of picking up planning entity
first (in my rule definition). Then I can access to the problem facts via
condition match. But this made the code complex and not elegant. Would you
elaborate more if I misunderstand how OptaPlanner solver behaves? 

Once again, I really appreciate your help and your effort on this powerful
software. 

Cheers,




--
View this message in context: http://drools.46999.n3.nabble.com/rules-users-Ask-for-help-with-OptaPlanner-tp4026583p4026626.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users




  

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] Ask for help with OptaPlanner

2013-11-02 Thread Geoffrey De Smet

  
  
Check your Solution.getProblemFacts() method.
Make sure you used addAll() instead of add() in there.

On 01-11-13 16:46, Xi Gong wrote:


  Hi Folks,


I am new to OptaPlanner, so please forgive me if this is a
  stupid question.


I developed a project to solve a worker assignment problem
  based on OptaPlanner. I have a java class "Demand" which has
  the information of capacity needed for each shift.
I added it to the solution class as a problem fact, since
  it should never be changed. Then I wrote rules saying that
  when the supply on that shift can not satisfy the demand there
  will be a point loss.


The problem I met is that when stepping into local search
  phase, the solver can not access to this class.


For instance, I have the following rule:

  rule " test rule"
   when
   $s :
Shift($i : index)
   $d :
Demand(shift.getIndex() == $i)
   then
   System.out.println("Test
rule fired.");
  end
  
  
  From console log I observed that at local search phase
this rule was never fired.
  Does anyone have any thoughts on why this happened and
how I should solve this problem? I will appreciate your
help.
  
  
  Thanks,

  
  
  
  
  ___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


  

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] Problem with chained planning variables

2013-10-28 Thread Geoffrey De Smet


On 28-10-13 17:27, Juan Ignacio Barisich wrote:
Thanks Geoffrey. One more question:Is there a planned release date for 
optaplanner 6.0.0.Final ?
When the rest of drools and jbpm and ready to release. We're on the same 
release train :)
But optaplanner 6 is ready for prime time, don't let the CR5 suffix 
make you believe otherwise.


Thanks again



2013/10/25 Geoffrey De Smet ge0ffrey.s...@gmail.com 
mailto:ge0ffrey.s...@gmail.com


Upgrade to 6.0.0.CR5 (follow the upgrade recipe txt)
and take advantage of the new feature called shadow variables
(see docs).
Also see the VRP with timewindows example for an implementation
that uses shadow variables :)


On 25-10-13 00:27, Juan Ignacio Barisich wrote:

Hi again. The problem was a score corruption issue. When I
activate de mode debug:

environmentModeDEBUG/environmentMode

some exceptions appear, like:

java.lang.IllegalStateException: Score corruption: the
workingScore (0hard/-35soft) is not the uncorruptedScore
(0hard/-31soft)...

I had to fix some rules, but I cant fix one in particular. When I
looking at the example rules (with chained variables), the most
are based only on the previous item of the chain, e.g.:

rule distanceToPreviousAppearance
when
$visit : Visit(previousAppearance != null,
$distanceToPreviousAppearance : distanceToPreviousAppearance)
then
insertLogical(new
IntConstraintOccurrence(distanceToPreviousAppearance,
ConstraintType.NEGATIVE_SOFT,
$distanceToPreviousAppearance,
$visit));
end

When optaplanner do the moves while planning, the
IntConstraintOccurrence works ok, because the drools engine
retracts the IntConstraintOccurrence facts properly. But, in my
case the score caculation must be based on the entire chain. That is:

I have some Doctors, and Cases (medical cases). I have to write a
score rule for consider the delay of attention. So, each Case has
a request time (when the patient calls) and a approximate
duration of the case (in minutes). So, if I have the next chain:

Doctor1 - Case1 (requestTime:8am, duration:60minutes) -
Case2(requestTime:8:30am, duration:30minutes) -
Case3(requestTime:8:30am, duration:30minutes)

the delay time for this solution must be: 30min(for Case2) +
60min(for Case3) = 90 minutes. As yo see, you can't calculate the
delay of one Case only as from its previous on the chain.

I must to implement a rule to calculate a soft constraint, to
achive less-delay plannings. My first attempt looks like:

rule delaySC
when
$case : Case( )
eval($case.getDelay()  0)
then
   insertLogical(new IntConstraintOccurrence(delaySC,
ConstraintType.NEGATIVE_SOFT,
$case.getDelay(), $case));
end

I have to do an eval(), because a delay can not be negative. The
getDelay() method process the chain and calculates it. The
problem of this attempt, an other similars, is when the
optaplanner engine do the moves while solving, the
IntConstraintOccurrence is not retracted and the score corruption
exception appears.

The question is: ¿have you know similar scenarios, in which you
have to process the entire chain to calculate the score of a
solution?¿is there a way to solve this?

Thanks

Regards







2013/9/2 Juan Ignacio Barisich juan.baris...@gmail.com
mailto:juan.baris...@gmail.com

Hi everybody.
I have a problem with chained planning variables.
I'm using optaplanner 5.5.0.Final.
I have a planning entity like:

@PlanningEntity()
public class Case implements Chained {
private Chained previous;
@PlanningVariable(chained = true)
@ValueRanges({
@ValueRange(type =
ValueRangeType.FROM_SOLUTION_PROPERTY, solutionProperty =
doctors),
@ValueRange(type =
ValueRangeType.FROM_SOLUTION_PROPERTY, solutionProperty =
cases, excludeUninitializedPlanningEntity = true) })
public Chained getPrevious() {
return previous;
}
}

A fact class:
public class Doctor implements Chained {
   ...
}

An a solution class:
public class Plan extends implements SolutionHardAndSoftScore {
private ListDoctor doctors;
private ListCase cases;
private HardAndSoftScore score;

@PlanningEntityCollectionProperty
public ListCase getCases() {
return cases;
}

public Collection? extends Object getProblemFacts() {
return new ArrayListDoctor(doctors);
}
}

The equals / hashCode / clone methods are inspired on the
TravelingSalesmanTour example

Re: [rules-users] Problem with chained planning variables

2013-10-25 Thread Geoffrey De Smet

  
  
Upgrade to 6.0.0.CR5 (follow the upgrade recipe txt)
and take advantage of the new feature called "shadow variables" (see
docs).
Also see the VRP with timewindows example for an implementation that
uses shadow variables :)

On 25-10-13 00:27, Juan Ignacio
  Barisich wrote:


  

  

  

  
Hi again. The problem was a score corruption
  issue. When I activate de mode debug:
  
environmentModeDEBUG/environmentMode
  

some exceptions appear, like:

java.lang.IllegalStateException: Score corruption:
the workingScore (0hard/-35soft) is not the
uncorruptedScore (0hard/-31soft)...

  
  I had to fix some rules, but I cant fix one in
  particular. When I looking at the example rules (with
  chained variables), the most are based only on the
  previous item of the chain, e.g.: 
  
  rule "distanceToPreviousAppearance"
   when
   $visit : Visit(previousAppearance != null,
  $distanceToPreviousAppearance :
  distanceToPreviousAppearance)
   then
   insertLogical(new
  IntConstraintOccurrence("distanceToPreviousAppearance",
  ConstraintType.NEGATIVE_SOFT,
   $distanceToPreviousAppearance,
   $visit));
  end
  

When optaplanner do the moves while planning, the
IntConstraintOccurrence works ok, because the drools
engine "retracts" the IntConstraintOccurrence facts
properly. But, in my case the score caculation must be
based on the entire chain. That is:

  
  I have some Doctors, and Cases (medical cases). I have to
  write a score rule for consider the delay of attention.
  So, each Case has a request time (when the patient calls)
  and a approximate duration of the case (in
  minutes). So, if I have the next chain:
  

Doctor1
- Case1 (requestTime:8am, duration:60minutes) -
Case2(requestTime:8:30am,
duration:30minutes) - Case3(requestTime:8:30am,
duration:30minutes)

  
  the
  delay time for this solution must be: 30min(for Case2) +
  60min(for Case3) = 90 minutes. As yo see, you can't
  calculate the delay of one Case only as from
  its previous on the chain.
  
  I must to implement a rule to calculate a soft constraint,
  to achive less-delay plannings. My first attempt looks
  like:
  
  rule "delaySC"
   when 
$case : Case( )
eval($case.getDelay()  0)
   then
insertLogical(new
  IntConstraintOccurrence("delaySC",
  ConstraintType.NEGATIVE_SOFT, 
  $case.getDelay(), $case));
  end
  

I
  have to do an eval(), because a delay can not be negative.
  The getDelay() method process the chain and calculates it.
  The problem of this attempt, an other similars, is when
  the optaplanner engine do the moves while solving, the IntConstraintOccurrence
  is not retracted and the score corruption
  exception appears.
  
  The question is: have you know similar scenarios, in which
  you have to process the entire chain to calculate the score of
  a solution? is there a way to solve this?
  

Thanks
  

Regards


  



  

  

  

  

  

  

  

  

  
  

2013/9/2 Juan Ignacio Barisich juan.baris...@gmail.com
  

  

  Hi everybody.
  
  I have a problem with chained planning variables.

I'm using optaplanner 5.5.0.Final.
  
  I have a planning entity 

Re: [rules-users] Monte Carlo and additional Optimisers for OptaPlanner

2013-10-25 Thread Geoffrey De Smet

On 25-10-13 12:50, sirinath wrote:
 Hi,

 Is it possible to provide more out of the box optimisers and solvers as part
 of OptaPlanner.
Yes, we're trying to add more every major release.
For 6.1 we 'll probably add the CH's cheapest insertion and regret 
insertion.
If you want to add one yourself, start by looking at 
DefaultLocalSearchSolverPhase.java.

 Also add functionality for simulations (Monte Carlo) which would be a good
 addition and fit.
Simulation support would be great indeed - but the requirements aren't 
clearly definied yet (feedback, examples or use cases welcome).

It's already possible to do simulation + optimization
by doing the simulation inside the score function (for example by 
running a monte carlo simulation)
and doing the optimization with optaplanner.

drools-chance (very experimental currently) has a lot of constructs that 
can help in simulation (bayes stuff etc).

 Suminda



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Monte-Carlo-and-additional-Optimisers-for-OptaPlanner-tp4026495.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Monte Carlo and additional Optimisers for OptaPlanner

2013-10-25 Thread Geoffrey De Smet


On 25-10-13 16:08, sirinath wrote:


Where is Drools chance hosted?


https://github.com/droolsjbpm/drools-chance


Perhaps GA/GP can be a part of this?


Yes, here's a Genetic Algoritms prototype for OptaPlanner:
  https://github.com/elsam/optaplanner
Results with GA's were poor, but we're going to add it sooner or later.
Here's the relevant issue to add it:
  https://issues.jboss.org/browse/PLANNER-154


Also Monte Carlo.

Maybe the current way to do is awkward? Is this covered in the 
documentation?



simulation isn't covered in the documentation.

What kind of simulation do you want to do?
What's the problem definition?

On 25 Oct 2013 17:54, ge0ffrey [via Drools] [hidden email] 
/user/SendEmail.jtp?type=nodenode=4026499i=0 wrote:



On 25-10-13 12:50, sirinath wrote:
 Hi,

 Is it possible to provide more out of the box optimisers and
solvers as part
 of OptaPlanner.
Yes, we're trying to add more every major release.
For 6.1 we 'll probably add the CH's cheapest insertion and regret
insertion.
If you want to add one yourself, start by looking at
DefaultLocalSearchSolverPhase.java.

 Also add functionality for simulations (Monte Carlo) which would
be a good
 addition and fit.
Simulation support would be great indeed - but the requirements
aren't
clearly definied yet (feedback, examples or use cases welcome).

It's already possible to do simulation + optimization
by doing the simulation inside the score function (for example by
running a monte carlo simulation)
and doing the optimization with optaplanner.

drools-chance (very experimental currently) has a lot of
constructs that
can help in simulation (bayes stuff etc).


 Suminda



 --
 View this message in context:

http://drools.46999.n3.nabble.com/Monte-Carlo-and-additional-Optimisers-for-OptaPlanner-tp4026495.html
 Sent from the Drools: User forum mailing list archive at
Nabble.com.
 ___
 rules-users mailing list
 [hidden email]
http://user/SendEmail.jtp?type=nodenode=4026497i=0
 https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
[hidden email] http://user/SendEmail.jtp?type=nodenode=4026497i=1
https://lists.jboss.org/mailman/listinfo/rules-users



If you reply to this email, your message will be added to the
discussion below:

http://drools.46999.n3.nabble.com/Monte-Carlo-and-additional-Optimisers-for-OptaPlanner-tp4026495p4026497.html

To unsubscribe from Monte Carlo and additional Optimisers for
OptaPlanner, click here.
NAML

http://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml




View this message in context: Re: [rules-users] Monte Carlo and 
additional Optimisers for OptaPlanner 
http://drools.46999.n3.nabble.com/Monte-Carlo-and-additional-Optimisers-for-OptaPlanner-tp4026495p4026499.html
Sent from the Drools: User forum mailing list archive 
http://drools.46999.n3.nabble.com/Drools-User-forum-f47000.html at 
Nabble.com.



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] Drools memory consumption

2013-10-24 Thread Geoffrey De Smet

  
  
Which version of drools?
Memory consumption improved a lot in 5.2 or 5.3 IIRC.

On 24-10-13 09:14, Elran Dvir wrote:


  
  
  
  
Thanks
for the quick response.

I
dont use entrypoints or windows in my rules.
I
am using temporal constraints.

I
cant retract the Log facts because I dont know whether
other rules need them.


Maybe
Its because there is no expiration set for Log. But I am
not sure if I can.
(CorrelatedEvent
has multiple expirations defined over the drl files)
I
wrote this question two days ago and no one responded:

I have several drl files.
Each drl file contains one rule.
Each drl file is built to a knowledge
  package.
Each drl file contains declaration of the
  same fact (referencing to a imported class defined outside of
  the drl). The facts role is of course event.

Can I define different expiration
  (@expires) for the fact in each drl?
Is expiration relevant only to the same
  drl?
Is the answer different if the fact is
  created in the rules RHS (CorrelatedEvent) or if it inserted
  to the sessions working memory outside of the drl (Log)?

Thanks.

From:
rules-users-boun...@lists.jboss.org
[mailto:rules-users-boun...@lists.jboss.org]
On Behalf Of Matteo Cusmai
Sent: Thursday, October 24, 2013 9:32 AM
To: Rules Users List
Subject: Re: [rules-users] Drools memory consumption

Are you using any entrypoint?
  Time or length based?
  It could be possible you have to retract manually the events.

  On 24 Oct 2013 08:23, "Elran Dvir" elr...@checkpoint.com
wrote:
  

  I am sending this message again
  because maybe the last wasnt sent because of the
  attached snapshots.
  I removed them now.
  Thanks.
  
  Hi
all,
  
  I
am using Drools Fusion. I am getting OutOfMemoryError
rather fast. My JVM is running with Xmx4g flag.
  I
have rules defined in another (not Drools) language.
  Every
rule is translated programmatically to a drl file. This
is because the user can add and remove rules (in the
other language) dynamically.
  The
default configuration contains 125 rules.
  
  For
example, one rule is supposed to identify a port scan
event.
  The basic fact is connection log. For each combination
of src (source IP) and dst (destination IP) , detect a
port scan event, if over 60 seconds there were at least
20 connection logs with different service and protocol.
  The event will stay closed for 10 minute - no event
will be sent during this time for this combination of
src and dst. The event the connection logs ids
(markers).
  (other
rules are very similar in structure, but different in
logic, of course)

  

This
  is its programmatic drl file:
  
  
  package
com.checkpoint.correlation.impl.drools.package30;
  
  import
java.util.Date
  import
java.util.HashMap
  import
java.util.Set
  import
com.checkpoint.correlation.impl.drools.Log
  import
com.checkpoint.correlation.impl.drools.CorrelatedEvent
  
  global
com.checkpoint.correlation.server.EventsHandler
externalEventsHandler;
  
  import
function
com.checkpoint.correlation.impl.utils.UserDefinedFunctions.isInDayHourRange
  import
function
com.checkpoint.correlation.impl.utils.UserDefinedFunctions.isInIpRange
  
  function
boolean filter(Log log) {

  
return (!((log.fieldsMap.get("src")!= null 
isInIpRange(log.fieldsMap.get("src").toString(),
"10.80.0.0", "10.80.255.255")) ||
(log.fieldsMap.get("src")!= null 

Re: [rules-users] uninitializedEntityFilter example

2013-10-21 Thread Geoffrey De Smet
Duplicates
http://stackoverflow.com/questions/19489850/detailed-example-for-uninitializedentityfilter

On 21-10-13 09:26, chakez30 wrote:
 I have set my planning variable to be nullable. But using this the
 constucution heuristic initializes variables to null values and i think this
 is a waste of time for computing the optimal solution. From the documents
 you can overwrite this using uninitializedEntityFilter. But it doesnt show
 the actual UninitializedTaskFilter.class. What would be the content of this
 class? Thanks!



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/uninitializedEntityFilter-example-tp4026431.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


  1   2   3   4   5   6   7   >