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] Drools Planner: Vehicle routing problems

2014-06-11 Thread Neb
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. 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


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] Drools Planner: Vehicle routing problems

2014-05-29 Thread Neb
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


Re: [rules-users] Drools Planner: what if possible values of a PlanningVariable are dependent of another one?

2014-05-09 Thread dBijkoo
ignore post above misread your statement about option B

Option B will not work if a block contains multiple observations as you
stated, which is the case in my problem.





--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-Drools-Planner-what-if-possible-values-of-a-PlanningVariable-are-dependent-of-another-on-tp4021175p4029493.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


Re: [rules-users] Drools Planner: what if possible values of a PlanningVariable are dependent of another one?

2014-05-09 Thread dBijkoo
ge0ffrey wrote
> On 08-05-14 14:38, dBijkoo wrote:
>> ge0ffrey wrote
>>> In OptaPlanner's architecture current philosophy, this is not legal:
>>> a value range should be stable for each variable (of each entity) during
>>> solving.
>>> This not guaranteed to work (and it is guaranteed not to work if you do
>>> phase caching of moves:
>>> it will invalidly exclude part of the search space).
>> So if I understand you correctly phase caching moves is the way to go?
> No
> Phase caching moves is definitely NOT the way to go :)
> Phase caching means it caches as moves at the beginning of the solver
> phase.
> So as some variables change value in steps, the possible move set doesn't.

Ah yes I see, misread it.


ge0ffrey wrote
> Anyway, what is the recommended solution?
> Not sure.
> 
> A) Either just allow all combinations, that will work.
> 
> B) Or try
> @Entity class Observation {
>@Variable block;
> }
> @Entity class Block {
> @Variable("periodRange) period;
> @VariableProvider("periodRange") getPeriodRange();
> }
> 
> Not sure if this matches for your case - multiple Observations might 
> share the same Block for a different period...
> 
> This is allowed - (it's called ValueRange from planning entity) and more 
> deeply supported (although it does have a few limits too).
> 
> C) Or try
> 
> class BlockPeriod {
> Block;
> Period;
> }
> @Entity class Observation {
>  @Variable BlockPeriod;
> }
> 
> Hmm. I like alternative C!

I thought of option B myself aswell, a valid solution (since multiple
Observations should be using the same block) but couldnt get it working.
>From what I understand it should be used like this:

@ValueRange(type = ValueRangeType.FROM_PLANNING_ENTITY_PROPERTY)

But the only time I have seen the above used was in a version 5.5 or lower
(I'm using 6.0.1.Final) and my optaplanner-core dependency can't find
@ValueRange annotation.

I however did notice use of something similiar in the 6.0.1 documentation
(http://docs.jboss.org/drools/release/6.0.1.Final/optaplanner-docs/html_single/index.html#d0e2678)
look for "4.3.5.2.2. ValueRangeProvider on a planning entity". But can't
seem to find the code for this in the 6.0.1.Final code example.

So basically my question comes down to how do i use "ValueRange from
planning entity" I tried searching for it but couldn't find it anywehere
except on version 5.5 or below as describer above.



--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-Drools-Planner-what-if-possible-values-of-a-PlanningVariable-are-dependent-of-another-on-tp4021175p4029492.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


Re: [rules-users] Drools Planner: what if possible values of a PlanningVariable are dependent of another one?

2014-05-08 Thread Geoffrey De Smet

On 08-05-14 14:38, dBijkoo wrote:
> ge0ffrey wrote
>> In OptaPlanner's architecture current philosophy, this is not legal:
>> a value range should be stable for each variable (of each entity) during
>> solving.
>> This not guaranteed to work (and it is guaranteed not to work if you do
>> phase caching of moves:
>> it will invalidly exclude part of the search space).
> So if I understand you correctly phase caching moves is the way to go?
No
Phase caching moves is definitely NOT the way to go :)
Phase caching means it caches as moves at the beginning of the solver phase.
So as some variables change value in steps, the possible move set doesn't.

>
>
> ge0ffrey wrote
>> If it does work for you, I am interested to know more about this - so I
>> can consider to make this approach legal.
> It is working for me, to give you a better impression of my approach i added
> an image of my "planning classdiagram".
> <http://drools.46999.n3.nabble.com/file/n4029484/Planning_class_diagram.png>
> Observation contains 2 annotated planningVariables getScheduleBlock() and
> getPeriod(). in the getPeriod() function it checks if the scheduleBlock is
> not null, if so it uses scheduleBlock.getPlanningsPeriods() function to
> return a list of periods.

I believe this approach will hit the wall when you try to add a move 
that changes the 2 variables of an entity in a single move.
Side note: To do this, you can configure a 
 of 2  for which the 
second has an  that mimics the first one's. IIRC, the 
course timetabling example has such a config example.

What will happen is that it will select a variable for the period from 
the range of the Observation's old block
and meanwhile also change the block.

There's a number of features this approach won't allow you to do (and I 
might not recall all of them).
Because I want to solve this problem, without limiting so many features, 
I want to solve it differently in the future.

>
> If have any more questions feel free to ask, we are all working to make
> OptaPlanner better.
+1 yes, definitely :) I understand the need for this problem, and why 
the current recommended solution is suboptimal (to large search space).
Feel free to make a jira for the problem (not your proposed solution).
>   I can even send you a zip of my current code if you are
> interested.
My time is too limited to review code zips (unless it's a reproducer for 
an accepted bug).


Anyway, what is the recommended solution?
Not sure.

A) Either just allow all combinations, that will work.

B) Or try
@Entity class Observation {
   @Variable block;
}
@Entity class Block {
@Variable("periodRange) period;
@VariableProvider("periodRange") getPeriodRange();
}

Not sure if this matches for your case - multiple Observations might 
share the same Block for a different period...

This is allowed - (it's called ValueRange from planning entity) and more 
deeply supported (although it does have a few limits too).

C) Or try

class BlockPeriod {
Block;
Period;
}
@Entity class Observation {
 @Variable BlockPeriod;
}

Hmm. I like alternative C!

>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/rules-users-Drools-Planner-what-if-possible-values-of-a-PlanningVariable-are-dependent-of-another-on-tp4021175p4029484.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 Planner: what if possible values of a PlanningVariable are dependent of another one?

2014-05-08 Thread dBijkoo
ge0ffrey wrote
> In OptaPlanner's architecture current philosophy, this is not legal:
> a value range should be stable for each variable (of each entity) during 
> solving.
> This not guaranteed to work (and it is guaranteed not to work if you do 
> phase caching of moves:
> it will invalidly exclude part of the search space).

So if I understand you correctly phase caching moves is the way to go?


ge0ffrey wrote
> If it does work for you, I am interested to know more about this - so I 
> can consider to make this approach legal.

It is working for me, to give you a better impression of my approach i added
an image of my "planning classdiagram". 
<http://drools.46999.n3.nabble.com/file/n4029484/Planning_class_diagram.png> 
Observation contains 2 annotated planningVariables getScheduleBlock() and
getPeriod(). in the getPeriod() function it checks if the scheduleBlock is
not null, if so it uses scheduleBlock.getPlanningsPeriods() function to
return a list of periods.

If have any more questions feel free to ask, we are all working to make
OptaPlanner better. I can even send you a zip of my current code if you are
interested.



--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-Drools-Planner-what-if-possible-values-of-a-PlanningVariable-are-dependent-of-another-on-tp4021175p4029484.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


Re: [rules-users] Drools Planner: what if possible values of a PlanningVariable are dependent of another one?

2014-05-08 Thread Geoffrey De Smet

On 08-05-14 10:08, dBijkoo wrote:
> Im dealing with the almost the same problem as the original poster. The only
> difference is that the subset of entity specific variables and the total
> amount of possible variables spread over all entity specific variables has a
> factor of up to 24 in between them. This combined with the amount of enities
> makes it a huge increase in total amount of possibilities. This gives me the
> feeling that using the evaluation class wastes a lot of time evaluation
> solution which would never be viable.
>
> Since the original post is 1 and a half years old and a lot of new versions
> have been released since then, I was wondering if the same solution applies
> to my problem aswell and how it compares to my solution which i described
> below.
>
>
> At the moment i solved it as follows:
> PlanningEntity A has the following @PlanningVariable annotation
>
> a class x where the @ValueRangeProvider of x is provided by the
> @PlanningSolution annotated class.
> a class y where the @ValueRangeProvider uses x to provide the subset of
> classes y if x is not null, otherwise it returns an empty list (code
> below)
>
>  @ValueRangeProvider(id = "timePeriods")
>  public List getTimePeriods(){
>  ScheduleBlock s = getScheduleBlock();
>  if(s == null) {
>  return new ArrayList();
>  }
>  return getScheduleBlock().getTimePeriods();
>  }
>
> This feels like a hack/workaround for the problem but feel free to let me
> know what you think,

In OptaPlanner's architecture current philosophy, this is not legal:
a value range should be stable for each variable (of each entity) during 
solving.
This not guaranteed to work (and it is guaranteed not to work if you do 
phase caching of moves:
it will invalidly exclude part of the search space).
If it does work for you, I am interested to know more about this - so I 
can consider to make this approach legal.



>
> Thanks
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/rules-users-Drools-Planner-what-if-possible-values-of-a-PlanningVariable-are-dependent-of-another-on-tp4021175p4029480.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 Planner: what if possible values of a PlanningVariable are dependent of another one?

2014-05-08 Thread dBijkoo
Im dealing with the almost the same problem as the original poster. The only
difference is that the subset of entity specific variables and the total
amount of possible variables spread over all entity specific variables has a
factor of up to 24 in between them. This combined with the amount of enities
makes it a huge increase in total amount of possibilities. This gives me the
feeling that using the evaluation class wastes a lot of time evaluation
solution which would never be viable. 

Since the original post is 1 and a half years old and a lot of new versions
have been released since then, I was wondering if the same solution applies
to my problem aswell and how it compares to my solution which i described
below. 


At the moment i solved it as follows: 
PlanningEntity A has the following @PlanningVariable annotation 

a class x where the @ValueRangeProvider of x is provided by the
@PlanningSolution annotated class. 
a class y where the @ValueRangeProvider uses x to provide the subset of
classes y if x is not null, otherwise it returns an empty list (code
below) 

@ValueRangeProvider(id = "timePeriods") 
public List getTimePeriods(){ 
ScheduleBlock s = getScheduleBlock(); 
if(s == null) { 
return new ArrayList(); 
} 
return getScheduleBlock().getTimePeriods(); 
} 

This feels like a hack/workaround for the problem but feel free to let me
know what you think, 

Thanks



--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-Drools-Planner-what-if-possible-values-of-a-PlanningVariable-are-dependent-of-another-on-tp4021175p4029480.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


Re: [rules-users] Drools Planner Version 5.5.0 vs Drools OptaPlanner Version 6.0.0

2013-07-10 Thread Geoffrey De Smet


On 10-07-13 11:44, Wolfgang Laun wrote:
> The Drools Documentation Alibi contains also notes on OptaPlanner here:
>
> http://docs.jboss.org/drools/release/6.0.0.Beta3/droolsjbpm-introduction-docs/html_single/index.html#releaseNotes_6.0.0_OptaPlanner
+1
Also the social media (G+, twitter and facebook) streams mention the 
improvements, so you can see it directly in your news stream:
   https://plus.google.com/112724449845406009021/posts

Also, you 'll find the UpgradeFromPreviousVersionRecipe.txt useful once 
you actually upgrade:
https://github.com/droolsjbpm/optaplanner/blob/master/optaplanner-distribution/src/main/assembly/filtered-resources/UpgradeFromPreviousVersionRecipe.txt
>
> -W
>
>
> On 10/07/2013, droolster  wrote:
>> Hello,
>>
>> I searched the PDF documents for Drools Planner and Drools Optaplanner as
>> well as searching the forums but I couldn't find any information on what is
>> new in Version 6 compared to Version 5.5.0. I would be grateful if someone
>> could give me a list of the new versions. The reason is that I now have a
>> need to solve a constraint based problem and I am wondering whether I
>> should
>> go for version 6 or stick with version 5.5.0.
>>
>> Thanks in advance for your help.
>>
>>
>>
>> --
>> View this message in context:
>> http://drools.46999.n3.nabble.com/Drools-Planner-Version-5-5-0-vs-Drools-OptaPlanner-Version-6-0-0-tp4024859.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


Re: [rules-users] Drools Planner Version 5.5.0 vs Drools OptaPlanner Version 6.0.0

2013-07-10 Thread Wolfgang Laun
The Drools Documentation Alibi contains also notes on OptaPlanner here:

http://docs.jboss.org/drools/release/6.0.0.Beta3/droolsjbpm-introduction-docs/html_single/index.html#releaseNotes_6.0.0_OptaPlanner

-W


On 10/07/2013, droolster  wrote:
> Hello,
>
> I searched the PDF documents for Drools Planner and Drools Optaplanner as
> well as searching the forums but I couldn't find any information on what is
> new in Version 6 compared to Version 5.5.0. I would be grateful if someone
> could give me a list of the new versions. The reason is that I now have a
> need to solve a constraint based problem and I am wondering whether I
> should
> go for version 6 or stick with version 5.5.0.
>
> Thanks in advance for your help.
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Drools-Planner-Version-5-5-0-vs-Drools-OptaPlanner-Version-6-0-0-tp4024859.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 Planner Version 5.5.0 vs Drools OptaPlanner Version 6.0.0

2013-07-10 Thread droolster
typo: a list of the new versions

should read:

a list of the new *features*



--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-Planner-Version-5-5-0-vs-Drools-OptaPlanner-Version-6-0-0-tp4024859p4024860.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] Drools Planner Version 5.5.0 vs Drools OptaPlanner Version 6.0.0

2013-07-10 Thread droolster
Hello,

I searched the PDF documents for Drools Planner and Drools Optaplanner as
well as searching the forums but I couldn't find any information on what is
new in Version 6 compared to Version 5.5.0. I would be grateful if someone
could give me a list of the new versions. The reason is that I now have a
need to solve a constraint based problem and I am wondering whether I should
go for version 6 or stick with version 5.5.0.

Thanks in advance for your help.



--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-Planner-Version-5-5-0-vs-Drools-OptaPlanner-Version-6-0-0-tp4024859.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


Re: [rules-users] Drools Planner/Optaplanner suitability

2013-06-26 Thread Geoffrey De Smet

On 26-06-13 17:53, droolster wrote:
> Hello,
>
> Please can the community tell me if Drools Planner/Optaplanner is the best
> tool to use for the problem described below:
>
> 1. For a list of items, I assign a point depending on the value of each
> item. For different values of an item, I will assign a different point (kind
> of on a rule basis i.e. if value = A, then assign 3 points, if value = B,
> then assign 9 points etc)
> 2. I multiply the points assigned to each item by a weight.
> 3. I sum the total number of weighted points and divide by the sum of the
> weights (basically, I compute the weight average).
>
> Is Drools Planner the right tool to use here or is it better to use Drools
> Expert?
>
> >From looking at the Drools Planner documentation, it looks like an
> optimisation tool and I am not really doing any optimising here. I am just
> calculating a value based on some rules.
Since you're not trying to maximize or minimize that average (by 
choosing the item values as optimal as possible for example),
this doesn't sound like an OptaPlanner problem.

Drools Expert should be good for this indeed :)
>
> Regards.
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Drools-Planner-Optaplanner-suitability-tp4024569.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] Drools Planner/Optaplanner suitability

2013-06-26 Thread droolster
Hello,

Please can the community tell me if Drools Planner/Optaplanner is the best
tool to use for the problem described below:

1. For a list of items, I assign a point depending on the value of each
item. For different values of an item, I will assign a different point (kind
of on a rule basis i.e. if value = A, then assign 3 points, if value = B,
then assign 9 points etc)
2. I multiply the points assigned to each item by a weight.
3. I sum the total number of weighted points and divide by the sum of the
weights (basically, I compute the weight average).

Is Drools Planner the right tool to use here or is it better to use Drools
Expert?

>From looking at the Drools Planner documentation, it looks like an
optimisation tool and I am not really doing any optimising here. I am just
calculating a value based on some rules.

Regards.



--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-Planner-Optaplanner-suitability-tp4024569.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


Re: [rules-users] [drools-planner] please advice on IntConstraintOccurrence weight

2013-06-06 Thread Geoffrey De Smet

  
  

On 06-06-13 11:50, Michiel Vermandel
  wrote:


  
> That's comparing apples and oranges.
> If you have 2 solutions
  A and B scored using a different score function, it's
  impossible to state whether A is better/worse than B based on
  those scores or the number of violations.


Well the rules stay the
  same, only the weight is changed.


If I have for example a rule
  (R1) that requires a given skill for a job and a rule (R2)
  which says someone can only do one job at the time then
Solution A) with different
  weights I get something like 20 violations of R1 and 10
  violations of R2
Solution B) with equal
  weights I get something like 5 violations of R1 and 2
  violations of R2
So B) is better.
  

Agreed - and Planner should be finding solution B) with A's scoring
function.

Suggestions:
1) Verify with enviromnentMode assertion that there is no score
corruption. That can explain that weirdness.
Upgrade to 6.0.0.Beta3's match system if you do have score
corruption - it will likely solve it - the easy way.

2) Use the benchmarker and test Tabu Search vs Late Acceptance etc,
with different parameters.

3) Verify that R1 and R2 are not score trapped (see 6.0 docs keyword
"score trap")

  


I understand the fact that a
  business analysis defines the weights, that's why they have
  been different so far.
1)  I just don't know how to
  get to solution B (which is better than A if you recalculate
  with the weights of A) with the correct weights applied.


2) Can you indicate how hard
  it is to migrate from 5.5.0 to 6.0?
  

Follow the UpgradeFromPreviousVersionRecipe.txt in the zip.
It takes an hour or 3, but it the recipe makes it painless.

  


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


  

From: Geoffrey
De Smet 
To:
Michiel Vermandel ; Rules
Users List  
Sent:
Thursday, June 6, 2013 11:15 AM
Subject:
Re: [drools-planner] please advice on
IntConstraintOccurrence weight
   

  
 
  On 06-06-13
10:22, Michiel Vermandel wrote:
  
  

  Hi,
  
  
  (using
drools-planner 5.5.0.Final)
  

  I'm
  struggling with assigning weights to
  IntConstraintOccurrence in a rule's LHS.
  If
  I assign different weights for different rules
  (because we think one rule is more important
  than an other)

  
  The business analysis defines the score weights, it's
  not our call to make which is more important etc.
  One way talk to you your business people and get them
  to convert their knowledge into score weights
  is to ask "if you had to put a price tag on
  everything, how much would violating this constraint
  cost us?".
  Basically normalize everything to a price.
  
  For example: in nurse rostering, "not giving a nurse
  her day off requests costs the solution 100 $".
  It might seem unethical to put a price tag on a
  nurse's happiness, but reality does it implicitly
  anyway.
  
  

  
  our end result is far worse than when we
  assign all equal weights.
  I
  do not look at the total value of hard and
  soft score but at the number of violations.

  
  That's comparing apples and oranges.
  If you have 2 solutions A and B scored using a
  different score function, it's impossible to state
  whether A is better/worse than B based on those scores
  or the number of viol

Re: [rules-users] [drools-planner] please advice on IntConstraintOccurrence weight

2013-06-06 Thread Michiel Vermandel
> That's comparing apples and oranges.
> If you have 2 solutions A and B scored using a different score function, it's 
> impossible to state whether A is better/worse than B based on those scores or 
> the number of violations.

Well the rules stay the same, only the weight is changed.

If I have for example a rule (R1) that requires a given skill for a job and a 
rule (R2) which says someone can only do one job at the time then
Solution A) with different weights I get something like 20 violations of R1 and 
10 violations of R2
Solution B) with equal weights I get something like 5 violations of R1 and 2 
violations of R2
So B) is better.

I understand the fact that a business analysis defines the weights, that's why 
they have been different so far.
1)  I just don't know how to get to solution B (which is better than A if you 
recalculate with the weights of A) with the correct weights applied.

2) Can you indicate how hard it is to migrate from 5.5.0 to 6.0?

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



 From: Geoffrey De Smet 
To: Michiel Vermandel ; Rules Users List 
 
Sent: Thursday, June 6, 2013 11:15 AM
Subject: Re: [drools-planner] please advice on IntConstraintOccurrence weight
 




On 06-06-13 10:22, Michiel Vermandel wrote:

Hi,
>
>
>(using drools-planner 5.5.0.Final)
>
>
>I'm struggling with assigning weights to IntConstraintOccurrence in a rule's 
>LHS.
>If I assign different weights for different rules (because we think one rule 
>is more important than an other)
The business analysis defines the score weights, it's not our call to make 
which is more important etc.
One way talk to you your business people and get them to convert
their knowledge into score weights
is to ask "if you had to put a price tag on everything, how much
would violating this constraint cost us?".
Basically normalize everything to a price.

For example: in nurse rostering, "not giving a nurse her day off
requests costs the solution 100 $".
It might seem unethical to put a price tag on a nurse's happiness,
but reality does it implicitly anyway.


our end result is far worse than when we assign all equal weights.
>I do not look at the total value of hard and soft score but at the number of 
>violations.
That's comparing apples and oranges.
If you have 2 solutions A and B scored using a different score
function, it's impossible to state whether A is better/worse than B
based on those scores or the number of violations.

What you can do is take solution B and grind it through A's score
function to compare it with score A (or vica versa).


I can imagine that the planner can evolve much easier to a better solution with 
all weights being the same because if not then "transient" moves will be made 
impossible to take.
Yes, if and only if the more difficult constraints have higher weights 
(otherwise it's the opposite).

But it's a bit absurd. For example in nurse rostering, I could give
all nurses their day off requests if I didn't have to worry about
assigning no more than 2 shifts to the same nurse as the same
time...


>
>But how should we then implement importance in rules?
Define your score function as your business needs it. Use the techniques 
described in the 6.0 manual: negative/postive, weights and levels.

PS: 6.0.0.Beta3 is out and the new addSoftConstraintMatch() system
is much faster and easier to use (see the blog post of a few months
ago).


>
>Thanks
> 
>-
>http://www.codessentials.com - Your essential software, for free!
>Follow us at http://twitter.com/#!/Codessentials
>
>
>___
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] please advice on IntConstraintOccurrence weight

2013-06-06 Thread Geoffrey De Smet

  
  

On 06-06-13 10:22, Michiel Vermandel
  wrote:


  
Hi,


(using drools-planner
  5.5.0.Final)

  
I'm struggling with
assigning weights to IntConstraintOccurrence in a rule's
LHS.
If I assign different
weights for different rules (because we think one rule is
more important than an other)
  

The business analysis defines the score weights, it's not our call
to make which is more important etc.
One way talk to you your business people and get them to convert
their knowledge into score weights
is to ask "if you had to put a price tag on everything, how much
would violating this constraint cost us?".
Basically normalize everything to a price.

For example: in nurse rostering, "not giving a nurse her day off
requests costs the solution 100 $".
It might seem unethical to put a price tag on a nurse's happiness,
but reality does it implicitly anyway.


  
 our end result is far
worse than when we assign all equal weights.
I do not look at the
total value of hard and soft score but at the number of
violations.
  

That's comparing apples and oranges.
If you have 2 solutions A and B scored using a different score
function, it's impossible to state whether A is better/worse than B
based on those scores or the number of violations.

What you can do is take solution B and grind it through A's score
function to compare it with score A (or vica versa).


  
I can imagine that the
planner can evolve much easier to a better solution with all
weights being the same because if not then "transient" moves
will be made impossible to take.
  

Yes, if and only if the more difficult constraints have higher
weights (otherwise it's the opposite).

But it's a bit absurd. For example in nurse rostering, I could give
all nurses their day off requests if I didn't have to worry about
assigning no more than 2 shifts to the same nurse as the same
time...

  

  
But how should we then
implement importance in rules?
  

Define your score function as your business needs it. Use the
techniques described in the 6.0 manual: negative/postive, weights
and levels.

PS: 6.0.0.Beta3 is out and the new addSoftConstraintMatch() system
is much faster and easier to use (see the blog post of a few months
ago).

  

  
Thanks
 
-
  http://www.codessentials.com - Your essential software, for
  free!
  Follow us at http://twitter.com/#!/Codessentials
  
  
  
  
  ___
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] [drools-planner] please advice on IntConstraintOccurrence weight

2013-06-06 Thread Michiel Vermandel
Hi,

(using drools-planner 5.5.0.Final)

I'm struggling with assigning weights to IntConstraintOccurrence in a rule's 
LHS.
If I assign different weights for different rules (because we think one rule is 
more important than an other) our end result is far worse than when we assign 
all equal weights.
I do not look at the total value of hard and soft score but at the number of 
violations.
I can imagine that the planner can evolve much easier to a better solution with 
all weights being the same because if not then "transient" moves will be made 
impossible to take.

But how should we then implement importance in rules?

Thanks

 
-
http://www.codessentials.com - Your essential software, for free!
Follow us at http://twitter.com/#!/Codessentials___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] [Drools Planner] Multi depot CVRP / CVRPTW

2013-04-11 Thread Geoffrey De Smet

  
  

On 11-04-13 18:38, Mats Norén wrote:


  Hi Geoffrey,
Do you think it would be possible to integrate the
  nurse rostering example with the vrp example? By that I mean
  to schedule nurses *and* stops in an optimal way. At the same
  time. 
I'm looking at a home care service problem where
  there is a need for weekly schedules for the nurses as well as
  an ambition to minimize the driving distance as well. 

  

That could be multiple entityClasses.
Or it could just be 1 entityClass with multiple variables.

  


Is it feasible or is it troublesome to have
  several planning entities at the same time?
  

Definitely feasible. Local search is designed to be able to deal
with multiple entityClasses.
The Construction heuristics in 5.5 probably don't not support
multiple entityClasses,
but the new implementation of Construction Heuristics in 6 should
support it (although they aren't enabled by default yet for
6.0.0.Beta1 - you have to explicitly define the 
configuration).
Current workaround is to do a simplistic SolutionInitializer OR use
the  api (which will be made the default in the coming
weeks).


  


Regards,
Mats


  
  

On Mon, Mar 4, 2013 at 4:49 PM, Mats
  Norén 
  wrote:
  

  Thanks Geoffrey,
  
  

  On Mon, Mar 4, 2013 at 4:33 PM,
Geoffrey De Smet 
wrote:

   
The example only does the capacitated vehicle
routing problem (VRP + capacity limits), not the
windowed vehicle routing problem.


  

  
  
By "your example" I meant the pseudo rule you sent
me in a previous mail and not the  cvrp example in
drools-planner-examples. 
  
  

  

  

  


Should I add each CustomerTimeWindow as
a fact in the
VrpSchedule.getProblemFacts?
  

  

Yes, so your score rules can exploit it.
Also, you 'll want to make sure that your score
rule penalize "the number of minutes that a time
window isn't met".

  
  

  



  
  Ok, by this you mean the difference in minutes
from the arrivaltime and the customer timewindow?
i.e., the largest of (arrivalTime - endTime) and
(startTime-arrivalTime) given that  (arrivalTime
< startTime or arrivalTime > endTime) ?

  
  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 lis

Re: [rules-users] [Drools Planner] Multi depot CVRP / CVRPTW

2013-04-11 Thread Mats Norén
Hi Geoffrey,
Do you think it would be possible to integrate the nurse rostering example
with the vrp example? By that I mean to schedule nurses *and* stops in an
optimal way. At the same time.
I'm looking at a home care service problem where there is a need for weekly
schedules for the nurses as well as an ambition to minimize the driving
distance as well.

Is it feasible or is it troublesome to have several planning entities at
the same time?

Regards,
Mats



On Mon, Mar 4, 2013 at 4:49 PM, Mats Norén  wrote:

> Thanks Geoffrey,
>
> On Mon, Mar 4, 2013 at 4:33 PM, Geoffrey De Smet 
> wrote:
>
>>
>> The example only does the capacitated vehicle routing problem (VRP +
>> capacity limits), not the windowed vehicle routing problem.
>>
>>
> By "your example" I meant the pseudo rule you sent me in a previous mail
> and not the  cvrp example in drools-planner-examples.
>
>>
>>  Should I add each CustomerTimeWindow as a fact in the
>> VrpSchedule.getProblemFacts?
>>
>> Yes, so your score rules can exploit it.
>> Also, you 'll want to make sure that your score rule penalize "the number
>> of minutes that a time window isn't met".
>>
>>
> Ok, by this you mean the difference in minutes from the arrivaltime and
> the customer timewindow? i.e., the largest of (arrivalTime - endTime) and
> (startTime-arrivalTime) given that  (arrivalTime < startTime or arrivalTime
> > endTime) ?
>
> Regards,
> Mats
>
>>
>> ___
>> rules-users mailing 
>> listrules-users@lists.jboss.orghttps://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] drools-planner MoveIteratorFactory vs SelectionFilter

2013-04-02 Thread Geoffrey De Smet

Op 02-04-13 17:33, roman.stumm schreef:
> Is there any example for a SelectionFilter or a
> MoveListFactory/MoveIteratorFactory with a chained-PlanningEntity problem
> (e.g. vehiclerouting)? We are using drools-planner 5.5.0.Final.
> If not: should it be possible to implement the Move*Factory in the same way
> as for other problems or are there any additional pitfalls to pay attention
> for (regarding the configuration of swapMoveSelectors)?
6.0 has better docs for MoveList/IteratorFactory IIRC.
https://hudson.jboss.org/hudson/job/optaplanner/lastSuccessfulBuild/artifact/optaplanner-docs/target/docbook/publish/en-US/html_single/index.html

>
> Thanks for any hints,
> Roman
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/drools-planner-MoveIteratorFactory-vs-SelectionFilter-tp4023170.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] drools-planner MoveIteratorFactory vs SelectionFilter

2013-04-02 Thread roman.stumm
Is there any example for a SelectionFilter or a
MoveListFactory/MoveIteratorFactory with a chained-PlanningEntity problem
(e.g. vehiclerouting)? We are using drools-planner 5.5.0.Final.
If not: should it be possible to implement the Move*Factory in the same way
as for other problems or are there any additional pitfalls to pay attention
for (regarding the configuration of swapMoveSelectors)?

Thanks for any hints,
Roman



--
View this message in context: 
http://drools.46999.n3.nabble.com/drools-planner-MoveIteratorFactory-vs-SelectionFilter-tp4023170.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


Re: [rules-users] Drools Planner renames to OptaPlanner: Announcing www.optaplanner.org

2013-03-21 Thread Cedric Hurst
Wow, let me be the first (or more realistically the tenth or twelfth) person to 
congratulate you and the Planner team on the new status as a Drools/jBPM 
sibling.  Looking forward to using 6.x beta on my new project next week.  

--
Build Smarter Software.

Spantree Technology Group, LLC
813 W Randolph St, Suite 301, Chicago, IL
email: ced...@spantree.net (mailto:ced...@spantree.net) | phone: 773.359.3865 
(tel:773.359.3865)
web: http://www.spantree.net


On Thursday, March 21, 2013 at 2:09 PM, Geoffrey De Smet wrote:

> We’re proud to announce the rename Drools Planner to OptaPlanner starting 
> with version 6.0.0.Beta1. We’re also happy to unveil its new website: 
> www.optaplanner.org (http://www.optaplanner.org).
>  
>  
> OptaPlanner optimizes business resource usage. Every organization faces 
> planning problems: provide products or services with a limited set of 
> constrained resources (employees, assets, time and money). OptaPlanner 
> optimizes such planning to do more business with less resources. Typical use 
> cases include vehicle routing, employee rostering and equipment scheduling.
>  
>  
>  
> OptaPlanner is a lightweight, embeddable planning engine written in Java™. It 
> helps normal Java™ programmers solve constraint satisfaction problems 
> efficiently. Under the hood, it combines optimization heuristics and 
> metaheuristics with very efficient score calculation.
>  
>  
>  
> OptaPlanner is open source software, released under the Apache Software 
> License (http://www.jboss.org/optaplanner/code/license.html). It is 100% pure 
> Java™, runs on the JVM and is available in the Maven Central Repository 
> (http://www.jboss.org/optaplanner/download/download.html) too.
>  
>  
>  
> For more information, visit the new website:
>  
>  
>  http://www.optaplanner.org
>  
>  
> Why change the name?  
>  
>  
> OptaPlanner is the new name for Drools Planner. OptaPlanner is now 
> standalone, but can still be optionally combined with the Drools rule engine 
> for a powerful declarative approach to planning optimization.
>  
>  
>  
> OptaPlanner has graduated from the Drools (http://www.jboss.org/drools) 
> project to become a top-level JBoss Community (http://www.jboss.org/) project.
>  
>  
>  
> OptaPlanner is not a fork of Drools Planner. We simply renamed it.
>  
>  
>  
> OptaPlanner (the planning engine) joins its siblings Drools (the rule engine) 
> and jBPM (the workflow engine) in the KIE group.
>  
>  
>  
>  
> Our commitment to Drools hasn't changed.
>  
>  
>  
> The efficient Drools rule engine is still the recommended way to do score 
> calculation.
>  
>  
>  
> Alternative score calculation options, such as pure Java calculation (no 
> Drools), also remain fully supported.
>  
>  
>  
>  
>  
> How will this affect your business?  
>  
>  
> From a business point of view, there's little or no change:
>  
>  
>  
> The mission remains unchanged:
>  
>  
>  
> We're still 100% committed to put business resource optimization in the hands 
> of normal Java developers.
>  
>  
>  
>  
> The license remains unchanged (Apache Software License 2.0). It's still the 
> same open source license.
>  
>  
>  
> The release lifecycle remains unchanged: OptaPlanner is still released at the 
> same time as Drools and jBPM.
>  
>  
>  
> Red Hat is considering support subscription offerings for OptaPlanner as part 
> of its BRMS 
> (http://www.redhat.com/products/jbossenterprisemiddleware/business-rules/) 
> and BPM platforms.
>  
>  
>  
> A Tech Preview of OptaPlanner is targeted for BRMS 6.0.
>  
>  
>  
>  
>  
> What has changed?  
>  
> The website has changed to http://www.optaplanner.org
>  
>  
>  
> The distributions artifacts have changed name:
>  
>  
>  
> Jar names changes:
>  
>  
>  
> drools-planner-core-*.jar is now optaplanner-core-*.jar
>  
>  
>  
> drools-planner-benchmark-*.jar is now optaplanner-benchmark-*.jar
>  
>  
>  
>  
> Maven identification groupId's and artifactId's changes:
>  
>  
>  
> groupId org.drools.planner is now org.optaplanner
>  
>  
>  
> artifactId drools-planner-core is now optaplanner-core
>  
>  
>  
> artifactId drools-planner-benchmark is now optaplanner-benchmark
>  
>  
>  
>  
> As usual, for more information see the Upgrade Recipe in the download zip.
>  
>  
>  
>  
> The API's namespace has changed. As usual, see the upgrade recipe 
> (https://github.com/droolsjbpm/optaplanner/blob/master/optaplanner-distribution/src/main/assembly/filtered-resources/UpgradeFromPreviousVersionRecipe.txt)
>  on how to deal with this efficiently.
>  
>  
>  
> Starting from 6.1.0.Final, OptaPlanner will have a 100% backwards compatible 
> API.
>  
>  
>  
>  
> OptaPlanner gets its own IRC channels on Freenode (http://freenode.net/): 
> #optaplanner and #optaplanner-dev
>  
>  
>  
>  
>  
> ___
> rules-users mailing list
> rules-users@lists.jboss.org (mailto:rules-users@lists.jboss.org)
> https://lists.jboss.

Re: [rules-users] [Drools Planner] Multi depot CVRP / CVRPTW

2013-03-04 Thread Mats Norén
Thanks Geoffrey,

On Mon, Mar 4, 2013 at 4:33 PM, Geoffrey De Smet wrote:

>
> The example only does the capacitated vehicle routing problem (VRP +
> capacity limits), not the windowed vehicle routing problem.
>
>
By "your example" I meant the pseudo rule you sent me in a previous mail
and not the  cvrp example in drools-planner-examples.

>
>  Should I add each CustomerTimeWindow as a fact in the
> VrpSchedule.getProblemFacts?
>
> Yes, so your score rules can exploit it.
> Also, you 'll want to make sure that your score rule penalize "the number
> of minutes that a time window isn't met".
>
>
Ok, by this you mean the difference in minutes from the arrivaltime and the
customer timewindow? i.e., the largest of (arrivalTime - endTime) and
(startTime-arrivalTime) given that  (arrivalTime < startTime or arrivalTime
> endTime) ?

Regards,
Mats

>
> ___
> rules-users mailing 
> listrules-users@lists.jboss.orghttps://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] [Drools Planner] Multi depot CVRP / CVRPTW

2013-03-04 Thread Geoffrey De Smet

  
  

Op 04-03-13 13:39, Mats Norén schreef:


  

  

  

  
Hi Geoffrey,

After a long period away from this problem I've come
back to it and I'm feeling a bit lost :-)

  
  Could you elaborate on how to best model the rules and
  domain objects. I've looked at the nurse rostering
  example but didn't find any clues on how to proceed.
  

My first stab on this uses the following rules:

rule "arrivalTime"
    when
    $vehicle : VrpVehicle()
    $customer : VrpCustomer(
    vehicle == $vehicle,
    $arrivalTime : arrivalTime)
    then
    insertLogical(new
VrpCustomerVisitArrivalTime($customer, $arrivalTime));
end

rule "arrivalWithinTimeWindow"
    when
    VrpCustomerVisitArrivalTime($c : customer, $a :
arrival)
    not CustomerTimeWindow(customer == $c, $a >
startTime, $a < endTime)
    then
    insertLogical(new
IntConstraintOccurrence("arrivalWithinTimeWindow",
ConstraintType.HARD, -$a, $c))
end

  
  I've added a method arrivalTime to VrpCustomer that walks
  the VrpAppearances to the Depot and accumulates the travel
  time between each appearance.  (I'm using GraphHopper and
  the OpenStreetMap roadnetwork). This works similar to the
  getDistance(VrpLocation location). 
  

What I didn't grasp is how the rule in your example is using
the CustomerTimeWindow? I'm assuming the CustomerTimeWindow
is a property on VrpCustomer?
  

  

The example only does the capacitated vehicle routing problem (VRP +
capacity limits), not the windowed vehicle routing problem.

  

  
  
  Should I add each CustomerTimeWindow as a fact in the
  VrpSchedule.getProblemFacts?

  

Yes, so your score rules can exploit it.
Also, you 'll want to make sure that your score rule penalize "the
number of minutes that a time window isn't met".

  

  

Btw, I'm using drools-planner 6.0.0-SNAPSHOT.



Regards,
Mats

  

  

  
  
  ps.
  
  I like the new name OptaPlanner.
  
  ds.

  
  

  

  

  

  
  

On Tue, Nov 20, 2012 at 1:54 PM, Mats
  Norén 
  wrote:
  
Ok, so on the first rule should fire for all
  occurrences of a Customer since each Customer should have
  at least one visit? 



  

  
It's not another planning variable,
instead,
do something like

when
  ...
then
   insertLogical(new CustomerVisitArrivalTime(...));
end

when
    CustomerVisitArrivalTime($c : customer, $a :
arrival)
    not CustomerTimeWindow(customer == $c, $a >
start, $a < end)
then
    insertLogical(new IntConstraintOccurrence(...))
end

See nurseRosteringScoreRules.drl for an example of
use of
insertLogical's like that
  
  

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

  

  
  

Btw, tha

Re: [rules-users] [Drools Planner] Multi depot CVRP / CVRPTW

2013-03-04 Thread Mats Norén
Hi Geoffrey,
After a long period away from this problem I've come back to it and I'm
feeling a bit lost :-)

Could you elaborate on how to best model the rules and domain objects. I've
looked at the nurse rostering example but didn't find any clues on how to
proceed.

My first stab on this uses the following rules:

rule "arrivalTime"
when
$vehicle : VrpVehicle()
$customer : VrpCustomer(
vehicle == $vehicle,
$arrivalTime : arrivalTime)
then
insertLogical(new VrpCustomerVisitArrivalTime($customer,
$arrivalTime));
end

rule "arrivalWithinTimeWindow"
when
VrpCustomerVisitArrivalTime($c : customer, $a : arrival)
not CustomerTimeWindow(customer == $c, $a > startTime, $a < endTime)
then
insertLogical(new
IntConstraintOccurrence("arrivalWithinTimeWindow", ConstraintType.HARD,
-$a, $c))
end

I've added a method arrivalTime to VrpCustomer that walks the
VrpAppearances to the Depot and accumulates the travel time between each
appearance.  (I'm using GraphHopper and the OpenStreetMap roadnetwork).
This works similar to the getDistance(VrpLocation location).

What I didn't grasp is how the rule in your example is using the
CustomerTimeWindow? I'm assuming the CustomerTimeWindow is a property on
VrpCustomer?

Should I add each CustomerTimeWindow as a fact in the
VrpSchedule.getProblemFacts?

Btw, I'm using drools-planner 6.0.0-SNAPSHOT.

Regards,
Mats

ps.
I like the new name OptaPlanner.
ds.





On Tue, Nov 20, 2012 at 1:54 PM, Mats Norén  wrote:

> Ok, so on the first rule should fire for all occurrences of a Customer
> since each Customer should have at least one visit?
>
> It's not another planning variable,
>> instead,
>> do something like
>>
>> when
>>   ...
>> then
>>insertLogical(new CustomerVisitArrivalTime(...));
>> end
>>
>> when
>> CustomerVisitArrivalTime($c : customer, $a : arrival)
>> not CustomerTimeWindow(customer == $c, $a > start, $a < end)
>> then
>> insertLogical(new IntConstraintOccurrence(...))
>> end
>>
>> See nurseRosteringScoreRules.drl for an example of use of
>> insertLogical's like that
>>
>> ___
>> rules-users mailing list
>> rules-users@lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>
> Btw, thanks for your help and thanks for a great product!
>
> Regards,
> Mats
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] 'Drools Planner-Vehicle routing in VisualStudio.Net 2010/2012

2013-02-21 Thread vs1
Thanks for looking into this.

Well I mean to say can we use '*Drools Planner-Vehicle routing*' in
*ASP.Net*?



--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-Drools-Planner-Vehicle-routing-in-VisualStudio-Net-2010-2012-tp4022502p4022510.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


Re: [rules-users] 'Drools Planner-Vehicle routing in VisualStudio.Net 2010/2012

2013-02-21 Thread Geoffrey De Smet

Only if you're really masochistic ;)

No, VisualStudio doesn't support Java 1.6 or higher (last time I checked).
Use IntelliJ ( http://www.jetbrains.com/idea/ ), Eclipse or Netbeans:
http://docs.jboss.org/drools/release/5.5.0.Final/drools-planner-docs/html_single/index.html#d0e288


Op 21-02-13 07:46, Testaaa Asdfghj schreef:

Hello everyone,

I am new user so please guide.
Is it possible to implement *'Drools Planner-Vehicle routing' *in 
*VisualStudio.Net 2010/2012 ?*



--
Thanks,
VS


___
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] 'Drools Planner-Vehicle routing in VisualStudio.Net 2010/2012

2013-02-20 Thread Testaaa Asdfghj
Hello everyone, 

I am new user so please guide. 
Is it possible to implement 'Drools Planner-Vehicle routing'  in 
VisualStudio.Net 2010/2012 ?


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

[rules-users] Drools Planner-Vehicle routing in VisualStudio.Net

2013-02-20 Thread vs1
Hello everyone,

I am new user so please guide.
Is it possible to implement *'Drools Planner-Vehicle routing' * in
*VisualStudio.Net 2010/2012 ?*


--
Thanks,
VS



--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-Planner-Vehicle-routing-in-VisualStudio-Net-tp4022500.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


Re: [rules-users] Drools Planner 5.5.0.Final Memory corruption issues + mvel2 optimizer exception

2013-02-17 Thread Geoffrey De Smet

Op 17-02-13 10:15, duggal schreef:
> The problem is fixed now. I am summarizing the resolution to provide closure
> to this post.
>
Thanks for sharing the resolution :)

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


Re: [rules-users] Drools Planner 5.5.0.Final Memory corruption issues + mvel2 optimizer exception

2013-02-17 Thread duggal
The problem is fixed now. I am summarizing the resolution to provide closure
to this post.

Problem 1 - MVEL2 optimizer exceptions:
While using Planner 5.5.0.FINAL, I was invoking varargs method in my DRL
files. There is a known bug in the MVEL2 version used in 5.5.0.FINAL (see
https://issues.jboss.org/browse/DROOLS-11) for varargs methods.
I had tried to workaround this bug by invoking the varargs method as follows
-
clause.evaluate(new Object[] {$task, $resource, $group1, $group2}).
While this worked well in 5.5.0.FINAL, it resulted in the exceptions (see
original post) in the log.
Fix 1 - After upgrading to 5.5.1-SNAPSHOT, the MVEL2 library got upgraded to
the varargs fixed version MVEL2.1.4.Final. I changed the DRL varargs method
call as follows -
clause.evaluate($task, $resource, $group1, $group2)
The exceptions were then removed from the file.

Problem 2 - Memory corruption issues.
The corruption of the problem facts data structure was INPUT to the Drool
Planner and hence not caused by  the Planner library.
The issue that I identified in my code was a due to a bug in the custom
serialization code between client and server.
Fix 2 - Fixed the bug in custom serialization code. NO ISSUE IN PLANNER.




--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-Planner-5-5-0-Final-Memory-corruption-issues-tp407p4022355.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


Re: [rules-users] Drools Planner: contraint for rest time between shift

2013-02-17 Thread kadrohit
please forward me the soln

thanks
rohit



--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-Planner-contraint-for-rest-time-between-shift-tp4022200p4022352.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


Re: [rules-users] Drools Planner: contraint for rest time between shift

2013-02-16 Thread Geoffrey De Smet
It would be interesting to have the solution in the mail archive in this 
thread :)

Op 15-02-13 23:01, fdauffy schreef:
> Hello
> I could finally solve my problem in the drl file.
> If anybody is interested by my solution, just ask for it.
>
> Frédéric
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Drools-Planner-contraint-for-rest-time-between-shift-tp4022200p4022347.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 Planner: contraint for rest time between shift

2013-02-15 Thread fdauffy
Hello
I could finally solve my problem in the drl file.
If anybody is interested by my solution, just ask for it.

Frédéric



--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-Planner-contraint-for-rest-time-between-shift-tp4022200p4022347.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

Re: [rules-users] Drools Planner: contraint for rest time between shift

2013-02-14 Thread fdauffy
Hello
I worked on adding a shift date start and a shift date time. I did it in
Shift.java file, I think that's the right place.
Then in EmployeePanel.java, I calculate the value for these two fields (I
think there is no way to assign them directly with a link between Shiftype 
and Shift.
Then I tried to write the new constraint in the drl file: Apparently, I have
to change the default time format in order to access to the time parameters:
I couldn't find clearly how doing that modification. Could you tell me how
doing it
I'm using Netbeans 7.2.1 to run my project: is there a way to run the rule
part in debug mode? (environmentmode?) That would help me a lot as I'm a
beginner in DRL language.
Could you tell me also where I could find more documentation about DRL
language? I just found that for the moment:
http://docs.jboss.org/drools/release/5.5.0.Final/drools-expert-docs/html_single/index.html
(any books,..)

Many Thanks

Frédéric



--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-Planner-contraint-for-rest-time-between-shift-tp4022200p4022304.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

Re: [rules-users] Drools Planner Chaining/Cloning Documentation Suggestion

2013-02-12 Thread Trails
Hi Geoffrey,

Yes that would solve it!

Many Thanks!
Taylor



--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-Planner-Chaining-Cloning-Documentation-Suggestion-tp404p4022252.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


Re: [rules-users] Drools Planner 5.5.0.Final Memory corruption issues + mvel2 optimizer exception

2013-02-12 Thread Geoffrey De Smet

Op 12-02-13 14:47, duggal schreef:
>> Can you try 5.5.1-SNAPSHOT?
> I tried with 5.5.1-SNAPSHOT from
> https://repository.jboss.org/nexus/content/groups/public
> The problem still exists
>
>> If you can reproduce with 5.5.1-SNAPSHOT, please file a jira with the
>> stacktrace and if possible a way to reproduce.
>>https://issues.jboss.org/browse/DROOLS
> I am trying to package the issue into a reproducible test case for the JIRA.
Great. In the jira, be clear that you're reporting the mvel problem, not 
the planner score corruption.
Once the mvel problem is fixed, we can start looking at the planner 
score corruption, if it's still there (and isn't caused by the mvel 
problem).
>
> I have tried different combinations of large and small data and have the
> following observations -
> 1. The data corruption happens when a limit on the number of problem facts
> is crossed. This leads me to believe that insertion of a large amount of
> data in the working memory is causing this issue.
> 2. I am running the planner within a server side library. Each time i invoke
> the optimization routine and suffer this error, the server process memory
> keeps increasing. This indicates that memory is not being released
> (corruption?)
Sounds like a memory leak (= serious issue), which has normally 
unrelated to score corruption.
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Drools-Planner-5-5-0-Final-Memory-corruption-issues-tp407p4022250.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 Planner 5.5.0.Final Memory corruption issues + mvel2 optimizer exception

2013-02-12 Thread duggal
>Can you try 5.5.1-SNAPSHOT? 
I tried with 5.5.1-SNAPSHOT from
https://repository.jboss.org/nexus/content/groups/public 
The problem still exists

>If you can reproduce with 5.5.1-SNAPSHOT, please file a jira with the 
>stacktrace and if possible a way to reproduce. 
>   https://issues.jboss.org/browse/DROOLS
I am trying to package the issue into a reproducible test case for the JIRA.

I have tried different combinations of large and small data and have the
following observations -
1. The data corruption happens when a limit on the number of problem facts
is crossed. This leads me to believe that insertion of a large amount of
data in the working memory is causing this issue.
2. I am running the planner within a server side library. Each time i invoke
the optimization routine and suffer this error, the server process memory
keeps increasing. This indicates that memory is not being released
(corruption?)



--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-Planner-5-5-0-Final-Memory-corruption-issues-tp407p4022250.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


Re: [rules-users] Drools Planner 5.5.0.Final Memory corruption issues + mvel2 optimizer exception

2013-02-12 Thread Geoffrey De Smet
Can you try 5.5.1-SNAPSHOT?
That mvel stacktrace shouldn't be there.
But if there is a problem in mvel, it should fail-fast the app entirely, 
instead of continuing.

If you can reproduce with 5.5.1-SNAPSHOT, please file a jira with the 
stacktrace and if possible a way to reproduce.
   https://issues.jboss.org/browse/DROOLS

Op 12-02-13 08:37, duggal schreef:
> I am using Drools Planner for an optimization problem and facing weird memory
> corruption issues.
> The problem facts and planning entities are JPA entities which have lots of
> relationships and are large in size.
>
> When I use a few of the entities, then the solving works ok.
> However when I use large number of these entities, then I get strange
> exceptions indicating memory corruption in the result. E.g. the serialized
> best solution (serialized by me for persistence purposes) appears to be have
> invalid class types in members.
>
> I see that there are the following exceptions in the log (for both small and
> large data sets) -
>   Exception in thread "Thread-106" java.lang.RuntimeException: Unknown
> accessor type:
> org.mvel2.optimizers.impl.refl.collection.ArrayCreator@e7d1626d
> [2/12/13 12:35:34:309 IST] 0174 SystemErr R   at
> org.drools.rule.constraint.ConditionAnalyzer.analyzeAccessor(ConditionAnalyzer.java:264)
> [2/12/13 12:35:34:309 IST] 0174 SystemErr R   at
> org.drools.rule.constraint.ConditionAnalyzer.analyzeNode(ConditionAnalyzer.java:250)
> [2/12/13 12:35:34:309 IST] 0174 SystemErr R   at
> org.drools.rule.constraint.ConditionAnalyzer.statementToExpression(ConditionAnalyzer.java:467)
> [2/12/13 12:35:34:309 IST] 0174 SystemErr R   at
> org.drools.rule.constraint.ConditionAnalyzer.readInvocationParams(ConditionAnalyzer.java:457)
> [2/12/13 12:35:34:309 IST] 0174 SystemErr R   at
> org.drools.rule.constraint.ConditionAnalyzer.analyzeAccessor(ConditionAnalyzer.java:345)
> [2/12/13 12:35:34:309 IST] 0174 SystemErr R   at
> org.drools.rule.constraint.ConditionAnalyzer.analyzeExpressionNode(ConditionAnalyzer.java:326)
> [2/12/13 12:35:34:309 IST] 0174 SystemErr R   at
> org.drools.rule.constraint.ConditionAnalyzer.analyzeAccessor(ConditionAnalyzer.java:286)
> [2/12/13 12:35:34:309 IST] 0174 SystemErr R   at
> org.drools.rule.constraint.ConditionAnalyzer.analyzeNode(ConditionAnalyzer.java:250)
> [2/12/13 12:35:34:309 IST] 0174 SystemErr R   at
> org.drools.rule.constraint.ConditionAnalyzer.analyzeSingleCondition(ConditionAnalyzer.java:133)
> [2/12/13 12:35:34:309 IST] 0174 SystemErr R   at
> org.drools.rule.constraint.ConditionAnalyzer.analyzeCondition(ConditionAnalyzer.java:99)
> [2/12/13 12:35:34:309 IST] 0174 SystemErr R   at
> org.drools.rule.constraint.ConditionAnalyzer.analyzeCondition(ConditionAnalyzer.java:70)
> [2/12/13 12:35:34:309 IST] 0174 SystemErr R   at
> org.drools.rule.constraint.MvelConditionEvaluator.getAnalyzedCondition(MvelConditionEvaluator.java:83)
> [2/12/13 12:35:34:309 IST] 0174 SystemErr R   at
> org.drools.rule.constraint.MvelConstraint.executeJitting(MvelConstraint.java:270)
> [2/12/13 12:35:34:309 IST] 0174 SystemErr R   at
> org.drools.rule.constraint.MvelConstraint.access$200(MvelConstraint.java:51)
> [2/12/13 12:35:34:309 IST] 0174 SystemErr R   at
> org.drools.rule.constraint.MvelConstraint$ConditionJitter.run(MvelConstraint.java:250)
> [2/12/13 12:35:34:309 IST] 0174 SystemErr R   at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:897)
> [2/12/13 12:35:34:309 IST] 0174 SystemErr R   at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:919)
> [2/12/13 12:35:34:309 IST] 0174 SystemErr R   at
> java.lang.Thread.run(Thread.java:770)
>
> Are these exceptions (which appear benign in the small data set solution)
> causing my issue?
> Are there any further troubleshooting that I can perform to isolate the root
> cause?
>
> Any help will be much appreciated. Thanks
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Drools-Planner-5-5-0-Final-Memory-corruption-issues-tp407.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 Planner Chaining/Cloning Documentation Suggestion

2013-02-12 Thread Geoffrey De Smet

Op 12-02-13 04:20, Trails schreef:
> Hi all,
>
> I'm new to drools planner and liking it a lot!
>
> I spent some hours last night cracking my head on something.  I have
> switched my domain from planning variable pointing to planning facts to
> using chained planning variables.
>
> I ran into a problem with score corruption, which was surprising as I am
> still using a Simple Score Calculator.
>
> It turns out my problem was when cloning the solution the planning variable
> (now chained) was still pointing to entities in the old solution.  I was
> following along the user guide when I fell over this.
>
> I'd like to humbly suggest that the drools planner user guide include a
> note/warning/something in the chained variable section about ensuring that
> when cloning the solution, the chained planning variables are updated to
> point to the cloned planning entities.  There is currently no mention of
> solution cloning in this section, and the code included in the doc does not
> mention this either.
Thanks for the feedback :)

Coincidence wants it that I 've already documented it for 6.0.0-SNAPSHOT 
in section 4.3.5.6.
Could you review that documentation?
https://hudson.jboss.org/hudson/view/Drools%20jBPM/job/drools-planner/lastSuccessfulBuild/artifact/drools-planner-docs/target/docbook/publish/en-US/html_single/index.html#d0e2674

 From 6.0, implementing cloning is optional and the default 
implementation already deals with the chaining pitfall :)
>
> This is illustrated in the examples, e.g. TSP, but it's in the Solution, not
> the planning entities.
>
> Just hoping to save others the head scratching.
>
> Thanks!
> Taylor
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Drools-Planner-Chaining-Cloning-Documentation-Suggestion-tp404.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 Planner: contraint for rest time between shift

2013-02-12 Thread Geoffrey De Smet

Op 11-02-13 21:24, fdauffy schreef:
> Hello
> Thanks for your quick answer.
> In fact, I realise that the ShiftDate class doesn't contain directly a date
> field, only a dayindex or the date as string.
> If I want to use your solution, I guess I will have to implement either a
> date or a time field in order to be able to add hours as you suggest.
In the nurseRostering example, there's a shiftIndex, which is uniqueness 
over shiftTypeIndex and shiftDateIndex.
But it doesn't accurately depict time indeed.
In the nurseRostering example, there's also shiftDateIndex together with 
shiftType.startTimeString, but the latter is just a String because there 
was no need to parse it.

So yes, to go the time way, you'll need to alter the domain :)
> I continue to work on the subject and I have another question: do you think
> I should continue on the way you indicated and do the modification in order
> to be able to do some time comparison between shifts, or go in another
> direction with the unwanted pattern (I just discover that this afternoon).
> If I understand well, with the unwanted pattern, I should be able to avoid
> some group of consecutive shifts like late shift followed by early shift..
> This solution looks easier to me but less nice (code to update if new
> shifts,...).
Sounds less nice indeed.
Talk to your business: let them figure out what they want.
The time way seems most business simple, I could imagine a contract 
stating "at least 8 hours rest after a shift".
But maybe they're ok with have an early-shift(6-14) followed by a 
demi-late-shift (18-22), even though there are only 4 hours in between,
so the shift patterns do matter.

Your score function should be what your business wants it to be. But it 
takes a few iterations before they accurately know want they want :)
>
> You really did a great job with Drools Planner!!
>
> Frédéric
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Drools-Planner-contraint-for-rest-time-between-shift-tp4022200p402.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] Drools Planner 5.5.0.Final Memory corruption issues

2013-02-11 Thread duggal
I am using Drools Planner for an optimization problem and facing weird memory
corruption issues.
The problem facts and planning entities are JPA entities which have lots of
relationships and are large in size.

When I use a few of the entities, then the solving works ok.
However when I use large number of these entities, then I get strange
exceptions indicating memory corruption in the result. E.g. the serialized
best solution (serialized by me for persistence purposes) appears to be have
invalid class types in members.

I see that there are the following exceptions in the log (for both small and
large data sets) -
 Exception in thread "Thread-106" java.lang.RuntimeException: Unknown
accessor type:
org.mvel2.optimizers.impl.refl.collection.ArrayCreator@e7d1626d
[2/12/13 12:35:34:309 IST] 0174 SystemErr R at
org.drools.rule.constraint.ConditionAnalyzer.analyzeAccessor(ConditionAnalyzer.java:264)
[2/12/13 12:35:34:309 IST] 0174 SystemErr R at
org.drools.rule.constraint.ConditionAnalyzer.analyzeNode(ConditionAnalyzer.java:250)
[2/12/13 12:35:34:309 IST] 0174 SystemErr R at
org.drools.rule.constraint.ConditionAnalyzer.statementToExpression(ConditionAnalyzer.java:467)
[2/12/13 12:35:34:309 IST] 0174 SystemErr R at
org.drools.rule.constraint.ConditionAnalyzer.readInvocationParams(ConditionAnalyzer.java:457)
[2/12/13 12:35:34:309 IST] 0174 SystemErr R at
org.drools.rule.constraint.ConditionAnalyzer.analyzeAccessor(ConditionAnalyzer.java:345)
[2/12/13 12:35:34:309 IST] 0174 SystemErr R at
org.drools.rule.constraint.ConditionAnalyzer.analyzeExpressionNode(ConditionAnalyzer.java:326)
[2/12/13 12:35:34:309 IST] 0174 SystemErr R at
org.drools.rule.constraint.ConditionAnalyzer.analyzeAccessor(ConditionAnalyzer.java:286)
[2/12/13 12:35:34:309 IST] 0174 SystemErr R at
org.drools.rule.constraint.ConditionAnalyzer.analyzeNode(ConditionAnalyzer.java:250)
[2/12/13 12:35:34:309 IST] 0174 SystemErr R at
org.drools.rule.constraint.ConditionAnalyzer.analyzeSingleCondition(ConditionAnalyzer.java:133)
[2/12/13 12:35:34:309 IST] 0174 SystemErr R at
org.drools.rule.constraint.ConditionAnalyzer.analyzeCondition(ConditionAnalyzer.java:99)
[2/12/13 12:35:34:309 IST] 0174 SystemErr R at
org.drools.rule.constraint.ConditionAnalyzer.analyzeCondition(ConditionAnalyzer.java:70)
[2/12/13 12:35:34:309 IST] 0174 SystemErr R at
org.drools.rule.constraint.MvelConditionEvaluator.getAnalyzedCondition(MvelConditionEvaluator.java:83)
[2/12/13 12:35:34:309 IST] 0174 SystemErr R at
org.drools.rule.constraint.MvelConstraint.executeJitting(MvelConstraint.java:270)
[2/12/13 12:35:34:309 IST] 0174 SystemErr R at
org.drools.rule.constraint.MvelConstraint.access$200(MvelConstraint.java:51)
[2/12/13 12:35:34:309 IST] 0174 SystemErr R at
org.drools.rule.constraint.MvelConstraint$ConditionJitter.run(MvelConstraint.java:250)
[2/12/13 12:35:34:309 IST] 0174 SystemErr R at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:897)
[2/12/13 12:35:34:309 IST] 0174 SystemErr R at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:919)
[2/12/13 12:35:34:309 IST] 0174 SystemErr R at
java.lang.Thread.run(Thread.java:770)

Are these exceptions (which appear benign in the small data set solution)
causing my issue?
Are there any further troubleshooting that I can perform to isolate the root
cause?

Any help will be much appreciated. Thanks



--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-Planner-5-5-0-Final-Memory-corruption-issues-tp407.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] Drools Planner Chaining/Cloning Documentation Suggestion

2013-02-11 Thread Trails
Hi all,

I'm new to drools planner and liking it a lot!

I spent some hours last night cracking my head on something.  I have
switched my domain from planning variable pointing to planning facts to
using chained planning variables.

I ran into a problem with score corruption, which was surprising as I am
still using a Simple Score Calculator.

It turns out my problem was when cloning the solution the planning variable
(now chained) was still pointing to entities in the old solution.  I was
following along the user guide when I fell over this.  

I'd like to humbly suggest that the drools planner user guide include a
note/warning/something in the chained variable section about ensuring that
when cloning the solution, the chained planning variables are updated to
point to the cloned planning entities.  There is currently no mention of
solution cloning in this section, and the code included in the doc does not
mention this either.

This is illustrated in the examples, e.g. TSP, but it's in the Solution, not
the planning entities.

Just hoping to save others the head scratching.

Thanks!
Taylor



--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-Planner-Chaining-Cloning-Documentation-Suggestion-tp404.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


Re: [rules-users] Drools Planner: contraint for rest time between shift

2013-02-11 Thread fdauffy
Hello
Thanks for your quick answer.
In fact, I realise that the ShiftDate class doesn't contain directly a date
field, only a dayindex or the date as string.
If I want to use your solution, I guess I will have to implement either a
date or a time field in order to be able to add hours as you suggest.
I continue to work on the subject and I have another question: do you think
I should continue on the way you indicated and do the modification in order
to be able to do some time comparison between shifts, or go in another
direction with the unwanted pattern (I just discover that this afternoon).
If I understand well, with the unwanted pattern, I should be able to avoid
some group of consecutive shifts like late shift followed by early shift..
This solution looks easier to me but less nice (code to update if new
shifts,...).

You really did a great job with Drools Planner!!

Frédéric



--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-Planner-contraint-for-rest-time-between-shift-tp4022200p402.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

Re: [rules-users] Drools Planner: contraint for rest time between shift

2013-02-11 Thread Geoffrey De Smet

Op 11-02-13 13:12, fdauffy schreef:
> Hello,
> I'm starting a project regarding shift planning and while trying Drools
> Planner, I notice that in your documentation that somes contraints are given
> as example like rest time between shift.
> But in all the examples, I couldn't find any constraint like that.
> Does anybody already work on such constraint?
>
> Many thanks
>
> Frédéric
Shouldn't be hard, something like this:

rule "todo"
 when
 $left : ShiftAssignment(
 $employee : employee, employee != null,
 $leftShiftEnd : shiftEnd
 )
 $right : ShiftAssignment(
 employee == $employee,
 shiftStart >  $leftShiftEnd,
 shiftStart <  $leftShiftEnd + employee.minimumRestTime,
 $rightShiftStart : shiftStart
 )
 not ShiftAssignment(
 employee == $employee,
 shiftStart >  $leftShiftEnd,
 shiftStart <  $rightShiftStart
 )
 then
 insertLogical(..., $leftShiftEnd + employee.minimumRestTime - 
$rightShiftStart, $left, $right));
end

>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Drools-Planner-contraint-for-rest-time-between-shift-tp4022200.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] Drools Planner: contraint for rest time between shift

2013-02-11 Thread fdauffy
Hello,
I'm starting a project regarding shift planning and while trying Drools
Planner, I notice that in your documentation that somes contraints are given
as example like rest time between shift.
But in all the examples, I couldn't find any constraint like that.
Does anybody already work on such constraint?

Many thanks

Frédéric



--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-Planner-contraint-for-rest-time-between-shift-tp4022200.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

Re: [rules-users] Drools planner: The workingMemory has 1 ConstraintOccurrence(s) in excess

2013-02-05 Thread Michiel Vermandel
Wel... I still get The workingMemory has 1 ConstraintOccurrence(s) in excess, 
even with that Sequence.next().
Sequence.next()generates on every invokation a new Longobject with a value one 
higher than the one of the previous invokation.
This leaves me completely clueless on how/when drools expert throws "The 
workingMemory has 1 ConstraintOccurrence(s) in excess".

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



 From: Michiel Vermandel 
To: Geoffrey De Smet ; Rules Users List 
 
Sent: Tuesday, February 5, 2013 12:49 PM
Subject: Re: [rules-users] Drools planner: The workingMemory has 1 
ConstraintOccurrence(s) in excess
 

Hi,

In order to save time and focus on the bigger (?) problems:

how bad is it to use a sequence number as extra parameter like
insertLogical(new IntConstraintOccurrence("noConsecutiveIV", 
ConstraintType.NEGATIVE_HARD,   Sequence.next() );

to avoid the ConstraintOccurrence(s) in excess (for now) ?

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



 From: Geoffrey De Smet 
To: Michiel Vermandel ; Rules Users List 
 
Sent: Tuesday, February 5, 2013 12:19 PM
Subject: Re: Drools planner: The workingMemory has 1 ConstraintOccurrence(s) in 
excess
 



Op 05-02-13 11:22, Michiel Vermandel schreef:

Hi,
>
>Thanks for the advice.
>
>1) About drools 5.5.1-SNAPSHOT: It doens't seem to be in the
list of available distros:
> Eclipse > pom > Dependencies > Add > Search
results.
>After 5.5.0-Final I get the Alphas of 6.0.0.
>I'm not such a wiz in Maven.
>How do I get the 5.5.1-SNAPSHOT into my m2/Nexus repo?
>
Look for "the jboss snapshop repo" on google. See the URL I pasted. Or look in 
the droolsjbpm-parent pom's  section.


>
>2) I'll do as you advised but here are already the stats:
>I've got 260 planning entities in my test
About the planning variables: I have 3 different types of planning variables 
but I do not use any default selector. Thus I do not have Entities * Values of 
possible moves.
>
Normally, one should always also add a changeMoveSelector for every variable 
(on top of the course grained moves), possibly with a filter to avoid breaking 
build-in constraints. Try it with the benchmarker.

I reduce quite some moves (I think/hope I do not eliminate the moves that could 
lead to the optimal solution).
>For the 3 different variable types I have 5 MoveListFactories
and they produce for the 260 entities all together 8550 possible
moves.
>
 
>-
>http://www.codessentials.com - Your essential software, for
  free!
>Follow us at http://twitter.com/#!/Codessentials
>
>
>________
> From: Geoffrey De Smet 
>To: rules-users@lists.jboss.org 
>Sent: Tuesday, February 5, 2013 9:35 AM
>Subject: Re: [rules-users] Drools planner: The workingMemory has 1 
>ConstraintOccurrence(s) in excess
> 
>
>
>
>Op 05-02-13 09:16, Michiel Vermandel schreef:
>
>Hi,
>>
>>
>>I am using Drools planner 5.5.0.Final.
>>
>>Once again I have the exception "The workingMemory has 1 
>>ConstraintOccurrence(s) in excess".
>>I have added all relevant planning variables as parameters of the 
>>ConstraintOccurrence.
>>
>>Could the following theory be an explanation for
  this issue? 
>>
>>My dataset is not that big (not small either).
>>Could it be that a certain move is taken twice
  within the same step (as part of score trap?)
  which results in the same constraint occurrence?
>>
No, the same move twice in the same step should not cause any trouble.
>If you can prove this causes the score corruption, it's
a bug in Drools Expert.
>There have been a bunch of bugfixes in drools, so try
drools (-core, -compiler, knowledge-api, mvel, ...)
5.5.0-SNAPSHOT:
>   
>https://repository.jboss.org/nexus/content/groups/public/org/drools/drools-core/5.5.1-SNAPSHOT/drools-core-5.5.1-20130205.051201-93.pom
>If that doesn't help, paste the rule.
>
>
>>I have one other question - maybe related:
>>In my configuration I have this:
>>
>>        
>>     
  7
  
>>        
>>        
>>       
  FIRST_BEST_SCORE_IMPROVING
>>       
  1000
>>        
>>
>>Because of the forager configuration a step is
  sometimes taken after as little as 40 moves, 

Re: [rules-users] Drools planner: The workingMemory has 1 ConstraintOccurrence(s) in excess

2013-02-05 Thread Michiel Vermandel
Hi,

In order to save time and focus on the bigger (?) problems:

how bad is it to use a sequence number as extra parameter like
insertLogical(new IntConstraintOccurrence("noConsecutiveIV", 
ConstraintType.NEGATIVE_HARD,   Sequence.next() );

to avoid the ConstraintOccurrence(s) in excess (for now) ?

Thanks

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



 From: Geoffrey De Smet 
To: Michiel Vermandel ; Rules Users List 
 
Sent: Tuesday, February 5, 2013 12:19 PM
Subject: Re: Drools planner: The workingMemory has 1 ConstraintOccurrence(s) in 
excess
 



Op 05-02-13 11:22, Michiel Vermandel schreef:

Hi,
>
>Thanks for the advice.
>
>1) About drools 5.5.1-SNAPSHOT: It doens't seem to be in the
list of available distros:
> Eclipse > pom > Dependencies > Add > Search
results.
>After 5.5.0-Final I get the Alphas of 6.0.0.
>I'm not such a wiz in Maven.
>How do I get the 5.5.1-SNAPSHOT into my m2/Nexus repo?
>
Look for "the jboss snapshop repo" on google. See the URL I pasted. Or look in 
the droolsjbpm-parent pom's  section.


>
>2) I'll do as you advised but here are already the stats:
>I've got 260 planning entities in my test
About the planning variables: I have 3 different types of planning variables 
but I do not use any default selector. Thus I do not have Entities * Values of 
possible moves.
>
Normally, one should always also add a changeMoveSelector for every variable 
(on top of the course grained moves), possibly with a filter to avoid breaking 
build-in constraints. Try it with the benchmarker.

I reduce quite some moves (I think/hope I do not eliminate the moves that could 
lead to the optimal solution).
>For the 3 different variable types I have 5 MoveListFactories
and they produce for the 260 entities all together 8550 possible
moves.
>
 
>-
>http://www.codessentials.com - Your essential software, for
  free!
>Follow us at http://twitter.com/#!/Codessentials
>
>
>____
> From: Geoffrey De Smet 
>To: rules-users@lists.jboss.org 
>Sent: Tuesday, February 5, 2013 9:35 AM
>Subject: Re: [rules-users] Drools planner: The workingMemory has 1 
>ConstraintOccurrence(s) in excess
> 
>
>
>
>Op 05-02-13 09:16, Michiel Vermandel schreef:
>
>Hi,
>>
>>
>>I am using Drools planner 5.5.0.Final.
>>
>>Once again I have the exception "The workingMemory has 1 
>>ConstraintOccurrence(s) in excess".
>>I have added all relevant planning variables as parameters of the 
>>ConstraintOccurrence.
>>
>>Could the following theory be an explanation for
  this issue? 
>>
>>My dataset is not that big (not small either).
>>Could it be that a certain move is taken twice
  within the same step (as part of score trap?)
  which results in the same constraint occurrence?
>>
No, the same move twice in the same step should not cause any trouble.
>If you can prove this causes the score corruption, it's
a bug in Drools Expert.
>There have been a bunch of bugfixes in drools, so try
drools (-core, -compiler, knowledge-api, mvel, ...)
5.5.0-SNAPSHOT:
>   
>https://repository.jboss.org/nexus/content/groups/public/org/drools/drools-core/5.5.1-SNAPSHOT/drools-core-5.5.1-20130205.051201-93.pom
>If that doesn't help, paste the rule.
>
>
>>I have one other question - maybe related:
>>In my configuration I have this:
>>
>>        
>>     
  7
  
>>        
>>        
>>       
  FIRST_BEST_SCORE_IMPROVING
>>       
  1000
>>        
>>
>>Because of the forager configuration a step is
  sometimes taken after as little as 40 moves, but
  sometimes the number of moves grows to enormous
  amounts.
>>I think if that happens that the score is no
  longer improving.
>>Is it "normal" that a certain step can make +50k
  moves and counting?
>>
you're set at 1k minimalAcceptedSelection, so 50k is a lot indeed.
>This is probably because the planningEntityTabuSize is
to high compared to the number of entity's in your
dataset.
>There's a jira for making planningEntityTabuSize
automatically adjust itself based on the entity size
(which would solve this).
>Or it could also be because the number of pos

Re: [rules-users] Drools planner: The workingMemory has 1 ConstraintOccurrence(s) in excess

2013-02-05 Thread Michiel Vermandel
> Normally, one should always also add a changeMoveSelector for every variable 
> (on top of the course grained moves), possibly with a filter to avoid 
> breaking build-in constraints. Try it with the benchmarker.

Even if I know that all moves of the default changeMoveSelector will A) be 
covered by the course grained moves B) if not covered they will break a 
constraint?

Brief explanation:

I need to tie the planning entities in two levels:

(Planning entities are tasks.)

I start from projects, which have phases and those phases have tasks (Planning 
entities).
An important planning variable is a Period (time slot).

All tasks should be executed in parallel within a phase.
All phases in a project should be as parallel as possible, may be sequential if 
no other way, but may not have gaps between the phases.

 
One of the move selectors generates pretty much most of the combinations of 
Task and Period, but a custom Move class will move the other tasks of the phase 
along when moving the single task.
So all tasks will be moved to all periods but they always will drag the other 
tasks in the phase along.

Anyway, I'll try it with the default selectors as well.



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



 From: Geoffrey De Smet 
To: Michiel Vermandel ; Rules Users List 
 
Sent: Tuesday, February 5, 2013 12:19 PM
Subject: Re: Drools planner: The workingMemory has 1 ConstraintOccurrence(s) in 
excess
 



Op 05-02-13 11:22, Michiel Vermandel schreef:

Hi,
>
>Thanks for the advice.
>
>1) About drools 5.5.1-SNAPSHOT: It doens't seem to be in the
list of available distros:
> Eclipse > pom > Dependencies > Add > Search
results.
>After 5.5.0-Final I get the Alphas of 6.0.0.
>I'm not such a wiz in Maven.
>How do I get the 5.5.1-SNAPSHOT into my m2/Nexus repo?
>
Look for "the jboss snapshop repo" on google. See the URL I pasted. Or look in 
the droolsjbpm-parent pom's  section.


>
>2) I'll do as you advised but here are already the stats:
>I've got 260 planning entities in my test
About the planning variables: I have 3 different types of planning variables 
but I do not use any default selector. Thus I do not have Entities * Values of 
possible moves.
>
Normally, one should always also add a changeMoveSelector for every variable 
(on top of the course grained moves), possibly with a filter to avoid breaking 
build-in constraints. Try it with the benchmarker.

I reduce quite some moves (I think/hope I do not eliminate the moves that could 
lead to the optimal solution).
>For the 3 different variable types I have 5 MoveListFactories
and they produce for the 260 entities all together 8550 possible
moves.
>
 
>-
>http://www.codessentials.com - Your essential software, for
  free!
>Follow us at http://twitter.com/#!/Codessentials
>
>
>____
> From: Geoffrey De Smet 
>To: rules-users@lists.jboss.org 
>Sent: Tuesday, February 5, 2013 9:35 AM
>Subject: Re: [rules-users] Drools planner: The workingMemory has 1 
>ConstraintOccurrence(s) in excess
> 
>
>
>
>Op 05-02-13 09:16, Michiel Vermandel schreef:
>
>Hi,
>>
>>
>>I am using Drools planner 5.5.0.Final.
>>
>>Once again I have the exception "The workingMemory has 1 
>>ConstraintOccurrence(s) in excess".
>>I have added all relevant planning variables as parameters of the 
>>ConstraintOccurrence.
>>
>>Could the following theory be an explanation for
  this issue? 
>>
>>My dataset is not that big (not small either).
>>Could it be that a certain move is taken twice
  within the same step (as part of score trap?)
  which results in the same constraint occurrence?
>>
No, the same move twice in the same step should not cause any trouble.
>If you can prove this causes the score corruption, it's
a bug in Drools Expert.
>There have been a bunch of bugfixes in drools, so try
drools (-core, -compiler, knowledge-api, mvel, ...)
5.5.0-SNAPSHOT:
>   
>https://repository.jboss.org/nexus/content/groups/public/org/drools/drools-core/5.5.1-SNAPSHOT/drools-core-5.5.1-20130205.051201-93.pom
>If that doesn't help, paste the rule.
>
>
>>I have one other question - maybe related:
>>In my configuration I have this:
>>
>>        
>>     
  7
  
>>        
>>        
>>       
  FIRST_BEST_SCORE_IMPROVING
>>       
  1000
>>        
>>
>>

Re: [rules-users] Drools planner: The workingMemory has 1 ConstraintOccurrence(s) in excess

2013-02-05 Thread Geoffrey De Smet

  
  

Op 05-02-13 11:22, Michiel Vermandel
  schreef:


  Hi,

Thanks for the advice.

1) About drools 5.5.1-SNAPSHOT: It doens't seem to be in the
list of available distros:
 Eclipse > pom > Dependencies > Add > Search
results.
After 5.5.0-Final I get the Alphas of 6.0.0.
I'm not such a wiz in Maven.
How do I get the 5.5.1-SNAPSHOT into my m2/Nexus repo?
  

Look for "the jboss snapshop repo" on google. See the URL I pasted.
Or look in the droolsjbpm-parent pom's  section.

  
2) I'll do as you advised but here are already the
stats:
I've got 260 planning
entities in my test
About the planning variables: I have 3 different types of
planning variables but I do not use any default selector. Thus I
do not have Entities * Values of possible moves.
  

Normally, one should always also add a changeMoveSelector for every
variable (on top of the course grained moves), possibly with a
filter to avoid breaking build-in constraints. Try it with the
benchmarker.

  I reduce quite some moves
(I think/hope I do not eliminate the moves that could lead to
the optimal solution).
For the 3 different variable types I have 5 MoveListFactories
and they produce for the 260 entities all together 8550 possible
moves.
  


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


  
 
 From:
Geoffrey De Smet 
To:
rules-users@lists.jboss.org 
Sent:
Tuesday, February 5, 2013 9:35 AM
    Subject:
    Re: [rules-users] Drools planner: The workingMemory has
1 ConstraintOccurrence(s) in excess
   


   
Op 05-02-13
  09:16, Michiel Vermandel schreef:


  
Hi,

  
I
am using Drools planner 5.5.0.Final.
  
Once
again I have the exception "The workingMemory
has 1 ConstraintOccurrence(s) in excess".
I have added all relevant planning variables as
  parameters of the ConstraintOccurrence.
  
  Could the following theory be an explanation for
  this issue? 
  
  My dataset is not that big (not small either).
  Could it be that a certain move is taken twice
  within the same step (as part of score trap?)
  which results in the same constraint occurrence?

  

No, the same move twice in the same step should not
cause any trouble.
If you can prove this causes the score corruption, it's
a bug in Drools Expert.
There have been a bunch of bugfixes in drools, so try
drools (-core, -compiler, knowledge-api, mvel, ...)
5.5.0-SNAPSHOT:
  
https://repository.jboss.org/nexus/content/groups/public/org/drools/drools-core/5.5.1-SNAPSHOT/drools-core-5.5.1-20130205.051201-93.pom
If that doesn't help, paste the rule.

  

  I have one other question - maybe related:
  In my configuration I have this:
  
          
       
  7
  
          
          
         
  FIRST_BEST_SCORE_IMPROVING
         
  1000
          
  
  Because of the forager configuration a step is
  sometimes taken after as little as 40 moves, but
  sometimes the number of moves grows to enormous
  amounts.
  I think if that happens that the score is no
  longer improving.
  Is it "normal" that a certain step can make +50k
  moves and counting?

  
  

Re: [rules-users] Drools planner: The workingMemory has 1 ConstraintOccurrence(s) in excess

2013-02-05 Thread Michiel Vermandel
Hi,

Thanks for the advice.

1) About drools 5.5.1-SNAPSHOT: It doens't seem to be in the list of available 
distros:
 Eclipse > pom > Dependencies > Add > Search results.
After 5.5.0-Final I get the Alphas of 6.0.0.
I'm not such a wiz in Maven.
How do I get the 5.5.1-SNAPSHOT into my m2/Nexus repo?


2) I'll do as you advised but here are already the stats:
I've got 260 planning entities in my testAbout the planning variables: I have 3 
different types of planning variables but I do not use any default selector. 
Thus I do not have Entities * Values of possible moves.
I reduce quite some moves (I think/hope I do not eliminate the moves that could 
lead to the optimal solution).
For the 3 different variable types I have 5 MoveListFactories and they produce 
for the 260 entities all together 8550 possible moves.

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



 From: Geoffrey De Smet 
To: rules-users@lists.jboss.org 
Sent: Tuesday, February 5, 2013 9:35 AM
Subject: Re: [rules-users] Drools planner: The workingMemory has 1 
ConstraintOccurrence(s) in excess
 



Op 05-02-13 09:16, Michiel Vermandel schreef:

Hi,
>
>
>I am using Drools planner 5.5.0.Final.
>
>Once again I have the exception "The workingMemory has 1 
>ConstraintOccurrence(s) in excess".
>I have added all relevant planning variables as parameters of the 
>ConstraintOccurrence.
>
>Could the following theory be an explanation for this issue? 
>
>My dataset is not that big (not small either).
>Could it be that a certain move is taken twice within the same
  step (as part of score trap?) which results in the same
  constraint occurrence?
>
No, the same move twice in the same step should not cause any trouble.
If you can prove this causes the score corruption, it's a bug in
Drools Expert.
There have been a bunch of bugfixes in drools, so try drools (-core,
-compiler, knowledge-api, mvel, ...) 5.5.0-SNAPSHOT:
   
https://repository.jboss.org/nexus/content/groups/public/org/drools/drools-core/5.5.1-SNAPSHOT/drools-core-5.5.1-20130205.051201-93.pom
If that doesn't help, paste the rule.


>I have one other question - maybe related:
>In my configuration I have this:
>
>        
>     
  7
  
>        
>        
>       
  FIRST_BEST_SCORE_IMPROVING
>       
  1000
>        
>
>Because of the forager configuration a step is sometimes taken
  after as little as 40 moves, but sometimes the number of moves
  grows to enormous amounts.
>I think if that happens that the score is no longer improving.
>Is it "normal" that a certain step can make +50k moves and
  counting?
>
you're set at 1k minimalAcceptedSelection, so 50k is a lot indeed.
This is probably because the planningEntityTabuSize is to high
compared to the number of entity's in your dataset.
There's a jira for making planningEntityTabuSize automatically
adjust itself based on the entity size (which would solve this).
Or it could also be because the number of possible moves (entity
size * value size) is near 1k.


Or does indicate once more to a score trap?
>
No. It indicates that planner's config should scale down automatically.
How many entity's and values do you have?


>Thanks
>
>Michiel
> 
>
>-
>http://www.codessentials.com - Your essential software, for
  free!
>Follow us at http://twitter.com/#!/Codessentials
>
>
>___
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] Drools planner: The workingMemory has 1 ConstraintOccurrence(s) in excess

2013-02-05 Thread Geoffrey De Smet


Op 05-02-13 09:16, Michiel Vermandel schreef:

Hi,

I am using Drools planner 5.5.0.Final.
Once again I have the exception "The workingMemory has 1 
ConstraintOccurrence(s) in excess".
I have added all relevant planning variables as parameters of the 
ConstraintOccurrence.


Could the following theory be an explanation for this issue?

My dataset is not that big (not small either).
Could it be that a certain move is taken twice within the same step 
(as part of score trap?) which results in the same constraint occurrence?

No, the same move twice in the same step should not cause any trouble.
If you can prove this causes the score corruption, it's a bug in Drools 
Expert.
There have been a bunch of bugfixes in drools, so try drools (-core, 
-compiler, knowledge-api, mvel, ...) 5.5.0-SNAPSHOT:

https://repository.jboss.org/nexus/content/groups/public/org/drools/drools-core/5.5.1-SNAPSHOT/drools-core-5.5.1-20130205.051201-93.pom
If that doesn't help, paste the rule.


I have one other question - maybe related:
In my configuration I have this:


7 



FIRST_BEST_SCORE_IMPROVING
1000


Because of the forager configuration a step is sometimes taken after 
as little as 40 moves, but sometimes the number of moves grows to 
enormous amounts.

I think if that happens that the score is no longer improving.
Is it "normal" that a certain step can make +50k moves and counting?

you're set at 1k minimalAcceptedSelection, so 50k is a lot indeed.
This is probably because the planningEntityTabuSize is to high compared 
to the number of entity's in your dataset.
There's a jira for making planningEntityTabuSize automatically adjust 
itself based on the entity size (which would solve this).
Or it could also be because the number of possible moves (entity size * 
value size) is near 1k.



Or does indicate once more to a score trap?

No. It indicates that planner's config should scale down automatically.
How many entity's and values do you have?


Thanks

Michiel

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


___
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] Drools planner: The workingMemory has 1 ConstraintOccurrence(s) in excess

2013-02-05 Thread Michiel Vermandel
Hi,

I am using Drools planner 5.5.0.Final.

Once again I have the exception "The workingMemory has 1 
ConstraintOccurrence(s) in excess".

I have added all relevant planning variables as parameters of the 
ConstraintOccurrence.

Could the following theory be an explanation for this issue? 

My dataset is not that big (not small either).
Could it be that a certain move is taken twice within the same step (as part of 
score trap?) which results in the same constraint occurrence?

I have one other question - maybe related:
In my configuration I have this:

        
      7 
        
        
        FIRST_BEST_SCORE_IMPROVING
        1000
        

Because of the forager configuration a step is sometimes taken after as little 
as 40 moves, but sometimes the number of moves grows to enormous amounts.
I think if that happens that the score is no longer improving.
Is it "normal" that a certain step can make +50k moves and counting?
Or does indicate once more to a score trap?

Thanks

Michiel
 

-
http://www.codessentials.com - Your essential software, for free!
Follow us at http://twitter.com/#!/Codessentials___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] Drools planner Score corruption issue: how to tackle?

2013-01-11 Thread Geoffrey De Smet

Op 11-01-13 12:14, Reinis schreef:
> Hi,
>
> I want to reinforce statement from Geoffrey by saying that from roughly
> 10 memory corruptions I have had so far, 8 were caused by bugs in MY
> identity/equality code!
:) We've all been there.

We are working towards limiting Planner's relying on identity/equals 
code of your domain objects:
Removal of causes parameter and insertLogical with "compensation actions 
unmatch/changeListeners".
Just look how much prettier (and faster) this will be:
https://github.com/droolsjbpm/drools-planner/blob/master/drools-planner-examples/src/main/resources/org/drools/planner/examples/cloudbalancing/solver/cloudBalancingCompensationActionExperimentScoreRules.drl#L32
 

(incomplete prototype, do not use yet! ConstraintOccurrence's will still 
be supported too)
>
> If you write your own move implementations, here is one additional
> example of the bug I have had and that have caused me sleepless nights
> with sporadic memory corruption:
>
> public class MyMove implements Move {
>
> ...
>
>   public void doMove(ScoreDirector scoreDirector) {
> scoreDirector.beforeVariableChanged(myPlanningVariableInstance,
> "myPlanningVariable");
>   myPlaningVariableInstance.setValue(toValue);
> scoreDirector.beforeVariableChanged(myPlanningVariableInstance,
> "myPlanningVariable"); //notice how I use beforeVariableChanged instead
> of afterVariableChanged...
>   }
> }
Writing custom moves is tricky indeed.
I am working on providing more generic moves, so people don't need to 
resort to writing custom moves:
http://docs.jboss.org/drools/release/5.5.0.Final/drools-planner-docs/html_single/index.html#d0e5468
>
> br
> Reinis
Thanks for the input :)
>
> On 01/10/2013 03:30 PM, Geoffrey De Smet wrote:
>> Op 10-01-13 10:54, Michiel Vermandel schreef:
>>> Hi,
>>>
>>> While running a planning I get after about 5 minutes a score corruption:
>>>
>>> Exception in thread "main" java.lang.IllegalStateException: Score
>>> corruption: the workingScore (-33hard/0soft) is not the
>>> uncorruptedScore (-23hard/0soft):
>>>The workingMemory has 1 ConstraintOccurrence(s) in excess:
>>>  noConsecutiveIV/NEGATIVE_HARD:[Inspection of B747-AX145.I#1
>>> -233344192, Inspection of B737-AC126.I#1 -24157252, Andy]=10
>>>Check the score rules who created those ConstraintOccurrences.
>>> Verify that each ConstraintOccurrence's causes and weight is correct.
>>>
>>> This occurs in the localSearch phase (when only running the
>>> construction heuristic phase, I do not get this exception).
>>>
>>> How do I start in tackling this issue?
>> Start by looking at the "causes" vararg parameter you're giving to new
>> IntConstraintOccurrence,
>> including the equals/hashCode() of each of those elements.
>> Read up about insertLogical in the Drools Expert manual.
>>
>> PS: for 6.0 we're working on unmatchListeners which would allow us to
>> avoid the insertLogical and the "causes" parameter.
>>> Thanks a lot!
>>>
>>> Michiel
>>> -
>>> http://www.codessentials.com - Your essential software, for free!
>>> Follow us at http://twitter.com/#!/Codessentials
>>>
>>>
>>> ___
>>> 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] Drools planner Score corruption issue: how to tackle?

2013-01-11 Thread Reinis
Hi,

I want to reinforce statement from Geoffrey by saying that from roughly 
10 memory corruptions I have had so far, 8 were caused by bugs in MY 
identity/equality code!

If you write your own move implementations, here is one additional 
example of the bug I have had and that have caused me sleepless nights 
with sporadic memory corruption:

public class MyMove implements Move {

...

 public void doMove(ScoreDirector scoreDirector) {
scoreDirector.beforeVariableChanged(myPlanningVariableInstance, 
"myPlanningVariable");
 myPlaningVariableInstance.setValue(toValue);
scoreDirector.beforeVariableChanged(myPlanningVariableInstance, 
"myPlanningVariable"); //notice how I use beforeVariableChanged instead 
of afterVariableChanged...
 }
}

br
Reinis

On 01/10/2013 03:30 PM, Geoffrey De Smet wrote:
>
> Op 10-01-13 10:54, Michiel Vermandel schreef:
>> Hi,
>>
>> While running a planning I get after about 5 minutes a score corruption:
>>
>> Exception in thread "main" java.lang.IllegalStateException: Score 
>> corruption: the workingScore (-33hard/0soft) is not the 
>> uncorruptedScore (-23hard/0soft):
>>   The workingMemory has 1 ConstraintOccurrence(s) in excess:
>> noConsecutiveIV/NEGATIVE_HARD:[Inspection of B747-AX145.I#1 
>> -233344192, Inspection of B737-AC126.I#1 -24157252, Andy]=10
>>   Check the score rules who created those ConstraintOccurrences. 
>> Verify that each ConstraintOccurrence's causes and weight is correct.
>>
>> This occurs in the localSearch phase (when only running the 
>> construction heuristic phase, I do not get this exception).
>>
>> How do I start in tackling this issue?
> Start by looking at the "causes" vararg parameter you're giving to new 
> IntConstraintOccurrence,
> including the equals/hashCode() of each of those elements.
> Read up about insertLogical in the Drools Expert manual.
>
> PS: for 6.0 we're working on unmatchListeners which would allow us to 
> avoid the insertLogical and the "causes" parameter.
>>
>> Thanks a lot!
>>
>> Michiel
>> -
>> http://www.codessentials.com - Your essential software, for free!
>> Follow us at http://twitter.com/#!/Codessentials
>>
>>
>> ___
>> 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] Drools planner Score corruption issue: how to tackle?

2013-01-10 Thread Geoffrey De Smet

  
  

Op 10-01-13 10:54, Michiel Vermandel
  schreef:


  
Hi,

  
While running a
planning I get after about 5 minutes a score corruption:

  
Exception in thread
"main" java.lang.IllegalStateException: Score corruption:
the workingScore (-33hard/0soft) is not the uncorruptedScore
(-23hard/0soft):
  The workingMemory has 1 ConstraintOccurrence(s) in excess:
    noConsecutiveIV/NEGATIVE_HARD:[Inspection of
B747-AX145.I#1 -233344192, Inspection of B737-AC126.I#1
-24157252, Andy]=10
  Check the score rules who created those
ConstraintOccurrences. Verify that each
ConstraintOccurrence's causes and weight is correct.

  
This occurs in the
localSearch phase (when only running the construction
heuristic phase, I do not get this exception).

  
How do I start in
tackling this issue?
  

Start by looking at the "causes" vararg parameter you're giving to
new IntConstraintOccurrence,
including the equals/hashCode() of each of those elements.
Read up about insertLogical in the Drools Expert manual.

PS: for 6.0 we're working on unmatchListeners which would allow us
to avoid the insertLogical and the "causes" parameter.

  

  
Thanks a lot!

  
Michiel
 
-
  http://www.codessentials.com - Your essential software, for
  free!
  Follow us at http://twitter.com/#!/Codessentials
  
  
  
  
  ___
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] Drools planner Score corruption issue: how to tackle?

2013-01-10 Thread Michiel Vermandel
Hi,

While running a planning I get after about 5 minutes a score corruption:

Exception in thread "main" java.lang.IllegalStateException: Score corruption: 
the workingScore (-33hard/0soft) is not the uncorruptedScore (-23hard/0soft):
  The workingMemory has 1 ConstraintOccurrence(s) in excess:
    noConsecutiveIV/NEGATIVE_HARD:[Inspection of B747-AX145.I#1 -233344192, 
Inspection of B737-AC126.I#1 -24157252, Andy]=10
  Check the score rules who created those ConstraintOccurrences. Verify that 
each ConstraintOccurrence's causes and weight is correct.

This occurs in the localSearch phase (when only running the construction 
heuristic phase, I do not get this exception).

How do I start in tackling this issue?

Thanks a lot!

Michiel

 
-
http://www.codessentials.com - Your essential software, for free!
Follow us at http://twitter.com/#!/Codessentials___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Drools Planner - split and join parallelism

2012-12-20 Thread Geoffrey De Smet

Op 20-12-12 00:46, Willem van Asperen schreef:
> Hi All,
>
> I have an idea that I would like to bounce of the list.
>
> As far as I understand, Drools Planner does not do any parallel
> searching. It uses a single solver thread that does all the work.
There are these forms of multi-threading (and multi-JVMing) Planner:

A) "Expert parallelism": Multi-threading Drools Expert score calculation 
(which is the deepest loop of Planner).
Mark Proctor is working on this with his new NoRete algorithm.
Because Planner calls Expert about 5000 / second, so 200ns per work unit,
this might not be suitable for multi-JVMing (due to network overhead).

B) "MoveScope parallelism": Multi-threading the MoveScopes in Planner 
(Local Search, Construction Heuristics, ...)
I have recently started laying the ground work for this,
but it will probably only be completed by 6.1 (Q3 2013).
https://issues.jboss.org/browse/JBRULES-681

The whole difficulty is going parallel without breaking "incremental 
score calculation (delta's)".
The scalability gain of delta's is bigger than parallelization (see 
image in manual).
Combining the 2 will be a major step forward, game changing.
After the 6.0 release I am going focus exclusively on JBRULES-681 for a 
month or 3.

This can also support multi-JVMing by sending bulk loads of MoveScopes 
across the network.

C) "run 2 or more Solvers separately":
Basically take a problem and build 2 Solvers (with different 
configuration) and run both of them on the problem.
At the end, return the best result. I wouldn't call this parallelism really
because if you're already running the statistically-best Solver config, 
the other Solver configs won't do much better.
> What if I would forage not only the best solution so far, but a couple
> of "promising" solutions and split these off to run on a separate
> thread. I would split these itteratively down to a given level of iteration.
Interesting thought: the higher your level of iteration, the less you 
kill delta's, avoid the difficulty of B.
Of course, the higher your level of iteration, the more you become 
problem C), lowering the potential gain...
Lets call this
D) "map-reducing Solvers".

>
> When these threads return I would then pick the best solution from the
> returned values.
>
> Using a multi-core box or even a server farm I could massively increase
> the searched problem space and do it without loosing too much time (some
> parallel management overhead).
This my goal for B) too :)
>
> Has anyone thought of such scheme before? Any luck in implementing?
> Do you see any flaws?
Read up on incremental score calculation (delta's). See Planner manual.
>
> Just a thought.
Go for it: fork Planner and see what you come up with :)
Let me know what works well (and more importantly) what does not work.
>
> Regards,
> Willem
> ___
> 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] Drools Planner - split and join parallelism

2012-12-19 Thread Willem van Asperen
Hi All,

I have an idea that I would like to bounce of the list.

As far as I understand, Drools Planner does not do any parallel
searching. It uses a single solver thread that does all the work.

What if I would forage not only the best solution so far, but a couple
of "promising" solutions and split these off to run on a separate
thread. I would split these itteratively down to a given level of iteration.

When these threads return I would then pick the best solution from the
returned values.

Using a multi-core box or even a server farm I could massively increase
the searched problem space and do it without loosing too much time (some
parallel management overhead).

Has anyone thought of such scheme before? Any luck in implementing?
Do you see any flaws?

Just a thought.

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


Re: [rules-users] Drools Planner: Solving a job schedule problem

2012-12-14 Thread Vincent LEGENDRE
Hi, 

not sure I got all the details (seeing rules could help, I did not understand 
what is wrong with your approach). 

As far I undertand, you already has a list containing the jov sequence, so you 
can update "prevJob" and "nextJob" attributes of you planning variables "Job". 
If yes, let's say you have 2 methods that returns "prevJobBreak" (or null if no 
prevJob) 
I would then add 2 rules for your 2 criteria : 

rule "min_small_breaks" 
when 
$small_breaks : Number from accumulate( Job($break : prevJobBreak != null && <= 
20), sum($break) ) // not sure of exact syntax, see accumulate doc) 
then 
// insert soft with : $small_breaks 
end 

rule "max_big_breaks" 
when 
$big_breaks : Number from accumulate( Job($break : prevJobBreak != null && > 
20), sum($break) ) 
then 
// insert soft with : -1 * $big_breaks (or anything else with a suitable weigth 
according to the other criteria) 
end 


Note that I only use prev, but nextJob can be used to add rules (contraints or 
criterion) over consecutives jobs (forbidden/mandatory sequences for instance). 
I also sum over all big breaks. I don't know if you have a constraint that 
limits the number of big breaks to 1. If >1, may be you have to find a formula 
to optimise also the number of single 'as big as possible' big breaks in a day. 

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


Re: [rules-users] Drools Planner: Solving a job schedule problem

2012-12-14 Thread mr_moe
Thanks for your answer. 
In PAS, a bed in a room gets assigned to an admission. Adapting this example
on my problem, only the bed is in any interest. The bed would be the machine
to which I’m scheduling my jobs to. A job would be an admission. But in
difference to PAS, in my problem the admissions (jobs) cannot be scheduled
to different beds (machines), because I only have one bed. Also the
admission has no fixed start or end date in my problem. Therfore the planner
has to go through the different start dates instead of going through the
different beds. Furthermore it is relevant, how many days the bed is not
occupied. Both constraints don’t get considered in the PAS example.




--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-Planner-Solving-a-job-schedule-problem-tp4021192p4021203.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


Re: [rules-users] Drools Planner: Solving a job schedule problem

2012-12-13 Thread Geoffrey De Smet

  
  
Does the pas (patient admission scheduling AKA hospital bed
planning) example behave similar as you need it?
One pas night = 30 minutes for you. One pas admission (several
nights) = 1 job (several times 30 minutes).

Op 13-12-12 16:16, mr_moe schreef:

Hey,
  I want to solve the following problem using drools planner:
  There are several jobs which should be worked through by a machine
  on one day. Each job has a length and a constraint that it only
  can be worked of between a fixed start and end date.
  For example there are three tasks
  

  
Job
first possible start date
last possible start date
length
  
  
A
7:00 am
8:30 am
60 min
  
  
B
7:30 am
10:00 am
30 min
  
  
C
10:30 am
12:00 pm
60 min
  

  
  The jobs should be organized in the following way, that there is
  as less time between tasks as possible. If it is due to
  restrictions not possible to order the tasks without a break and
  also the break is longer than, say, 20 minutes, the tasks should
  be organized with a long break as possible.
  Tasks cannot overlap.
  A good solution would be:
  

  
Job
Start date
End date
  
  
A
7:00 am
8:00 am
  
  
B
8:00 am
8:30 am
  
  
C
12:00 am
1:00 pm
  

  
  First, the planning variable
  (ValueRangeType.FROM_PLANNING_ENTITY_PROPERTY) of each task is its
  start date, which can takes a value which is between the first
  possible start date and the last possible start date. E.g.
  possible start dates for job A are between 7:00 am and 8:30 am. 
  To make sure, that tasks aren’t scheduled at the same time, I’ve
  written a hard constraint rule, which checks if one task overlaps
  with another one. And running the planner with hard constraints
  only, it works fine.
  But now I’m getting problems, writing the soft constraints. 
  At the moment, every job (planning entity) has variables, called
  “nextJob” und “prevJob”, which points to the jobs which are
  scheduled before and after that job. 
  In my example, it would look like this:
  

  
Job
prevJob
nextJob
  
  
A
null
Job B
  
  
B
Job A
Job C
  
  
C
Job B
null
  

  
  My intention of these variables is that I can check with a soft
  constraint rule, if the current chosen job and the job with which
  it gets compared are consecutive jobs, and if so, how much time
  between these jobs is left.
  In the soft constraint rule, I check if the “nextJob” Variable
  points to the job, with which I’m currently comparing the job. If
  this is the case, then there is no other job scheduled between
  those jobs and I can check how much time between these jobs is
  left.
  Every time drools planner reschedules a job, I have to check if
  nextJob and prevJob of each job are still pointing to their right
  predecessor and successor.
  For example, if Job A gets moved to 8:00 the sequence could look
  like this:
  

  
Job
Start date
End date
  
  
A
8:00 am
9:00 am
  
  
B
7:30 am
8:00 am
  
  
C
12:00 am
1:00 pm
  

  
  Therefore the variables preJob and nextJob have to be adjusted for
  each job:
  

  
Job
prevJob
nextJob
  
  
Job A
Job B
Job C
  
  
Job B
null
Job A
  
  
Job C
Job A
null
  

  
  To achieve that, I use a list in which I save the current order of
  the jobs.
  Furthermore I’ve written my own mover that, besides assigning the
  current job to its new start date, updates the list and each job
  if a job gets rescheduled.
  You’ve probably got the punch line by now: It’s not working. 
  And besides from getting a scoreCurroption exception, I truly
  doubt that this is the perfect solution for solving this planning
  

[rules-users] Drools Planner: Solving a job schedule problem

2012-12-13 Thread mr_moe
Hey,
I want to solve the following problem using drools planner:There are several
jobs which should be worked through by a machine on one day. Each job has a
length and a constraint that it only can be worked of between a fixed start
and end date.
For example there are three tasks 
Job first possible start date   last possible start datelength
A   7:00 am 8:30 am 60 min
B   7:30 am 10:00 am30 min
C   10:30 am12:00 pm60 min
The jobs should be organized in the following way, that there is as less
time between tasks as possible. If it is due to restrictions not possible to
order the tasks without a break and also the break is longer than, say, 20
minutes, the tasks should be organized with a long break as possible.Tasks
cannot overlap.
A good solution would be:

Job Start date  End date
A   7:00 am 8:00 am
B   8:00 am 8:30 am
C   12:00 am1:00 pm
First, the planning variable (ValueRangeType.FROM_PLANNING_ENTITY_PROPERTY)
of each task is its start date, which can takes a value which is between the
first possible start date and the last possible start date. E.g. possible
start dates for job A are between 7:00 am and 8:30 am. To make sure, that
tasks aren’t scheduled at the same time, I’ve written a hard constraint
rule, which checks if one task overlaps with another one. And running the
planner with hard constraints only, it works fine.
But now I’m getting problems, writing the soft constraints. At the moment,
every job (planning entity) has variables, called “nextJob” und “prevJob”,
which points to the jobs which are scheduled before and after that job. In
my example, it would look like this:
Job prevJob nextJob
A   nullJob B
B   Job A   Job C
C   Job B   null
My intention of these variables is that I can check with a soft constraint
rule, if the current chosen job and the job with which it gets compared are
consecutive jobs, and if so, how much time between these jobs is left.
In the soft constraint rule, I check if the “nextJob” Variable points to the
job, with which I’m currently comparing the job. If this is the case, then
there is no other job scheduled between those jobs and I can check how much
time between these jobs is left.
Every time drools planner reschedules a job, I have to check if nextJob and
prevJob of each job are still pointing to their right predecessor and
successor.
For example, if Job A gets moved to 8:00 the sequence could look like this:
Job Start date  End date
A   8:00 am 9:00 am
B   7:30 am 8:00 am
C   12:00 am1:00 pm
Therefore the variables preJob and nextJob have to be adjusted for each job:
Job prevJob nextJob
Job A   Job B   Job C
Job B   nullJob A
Job C   Job A   null
To achieve that, I use a list in which I save the current order of the
jobs.Furthermore I’ve written my own mover that, besides assigning the
current job to its new start date, updates the list and each job if a job
gets rescheduled.
You’ve probably got the punch line by now: It’s not working. And besides
from getting a scoreCurroption exception, I truly doubt that this is the
perfect solution for solving this planning problem.Have any of you an idea,
what a better way for solving this problem could be?
I’ve tried to find a similar problem in the examples, but none of them has
similar restrictions as mine. The curriculumcourse example has only fixed
time slots instead of a variable length and in the nurserostering, nurses
(jobs) get assigned to fixed shifts (time periods) and not the other way
around. 
Thanks!



--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-Planner-Solving-a-job-schedule-problem-tp4021192.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


Re: [rules-users] Drools Planner: what if possible values of a PlanningVariable are dependent of another one?

2012-12-12 Thread Geoffrey De Smet

Op 11-12-12 22:25, Willem van Asperen schreef:
> (Alternatively I do not use the constructionHeuristic and just start 
> of my solution with a randomly (but correct) generated solution)
It could take tabu search minutes to recover from that.

Any reason you're not using constructionHeuristics?
For 6.0 I am working on making them more scalability and configurable.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Drools Planner: what if possible values of a PlanningVariable are dependent of another one?

2012-12-12 Thread Geoffrey De Smet

  
  

Op 11-12-12 22:25, Willem van Asperen
  schreef:


  
  Hi All,
  
  I have a PlanningEntity that has several planning variables, say A
  and B. Now, if A is O then B can be X or Y and when A is P then B
  can be Y or Z.
  
  I see two routes:
  
create a solution property that generates X, Y and Z as
  alternatives for B and rely on the score rules to dismiss
  improper values, depending on the value of A
  

I recommend this (not just because of [1], but because it allows
certain heuristics (SA for example) to temporary break the hard
constraint to "tunnel through those hard constraints").

Several ways to implement:
- generate all valid A-B combinations in getProblemFacts() (see
manual section "cached problem facts") and do something like
when
  MyEntity(a, b)
  not ABCombo(same a, same b)
then
  // bad, possibly get weight from ABCombo
end
- add a method on my MyEntity:
when
  MyEntity(a, b, aAndBCompatible = false)
then
  // bad
end

Dependending on the difficulty of the domain, moveSelectionFilter
and/or moveSelectionProbability could be helpful to optimize the
selected moves.
The default swap move already swaps all vars by default, so that's
good.


  
create an entity property that only generates the possible
  values for B (i.e. X,Y for A=O and Y,Z for A=P)
  

[1] Entity property is supported in 5.5 currently. (see
documentation warning at the start of that section).

  
  
  What is the best route?
  
  (Alternatively I do not use the constructionHeuristic and just
start of my solution with a randomly (but correct) generated
solution)
  
  Regards,
Willem
  
  
  
  
  ___
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] Drools Planner: what if possible values of a PlanningVariable are dependent of another one?

2012-12-11 Thread Willem van Asperen
Hi All,

I have a PlanningEntity that has several planning variables, say A and
B. Now, if A is O then B can be X or Y and when A is P then B can be Y or Z.

I see two routes:

  * create a solution property that generates X, Y and Z as alternatives
for B and rely on the score rules to dismiss improper values,
depending on the value of A
  * create an entity property that only generates the possible values
for B (i.e. X,Y for A=O and Y,Z for A=P)

What is the best route?

(Alternatively I do not use the constructionHeuristic and just start of
my solution with a randomly (but correct) generated solution)

Regards,
Willem

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


Re: [rules-users] Drools Planner: Planning variable gets assigned value out of valueRange => primitive types problem

2012-11-30 Thread Geoffrey De Smet
Yes, FROM_PLANNING_ENTITY_PROPERTY works in 5.4.0.Final.
You're suffering from a different problem:

Change your planning variable type from long to Long and default it null.
Planner presumes that a variable == null is uninitialized, but a 
variable == 0 it considers initialized.
As a result, the construction heuristic won't bother to initialize the 
variables that are == 0.
The local search heuristic will change it, but there's no guarantee it 
won't change all of them.

For Planner 6.0, there will be 
@PlanningVariable(uninitializedEntityFilter = ...),
which will make it easy to tell Planner that 0 means uninitialized.

Op 30-11-12 10:00, mr_moe schreef:
> I've now downgraded to Drools 5.4.0.Final, but the planning variable still
> gets assigned the value 0 sometimes.
> Shouldn't ValueRangeType.FROM_PLANNING_ENTITY_PROPERTY work in 5.4?
>
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Drools-Planner-Planning-variable-gets-assigned-value-out-of-valueRange-tp4020984p4021034.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 Planner: Planning variable gets assigned value out of valueRange

2012-11-30 Thread mr_moe
I've now downgraded to Drools 5.4.0.Final, but the planning variable still
gets assigned the value 0 sometimes.
Shouldn't ValueRangeType.FROM_PLANNING_ENTITY_PROPERTY work in 5.4?




--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-Planner-Planning-variable-gets-assigned-value-out-of-valueRange-tp4020984p4021034.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


Re: [rules-users] Drools Planner: Planning variable gets assigned value out of valueRange

2012-11-28 Thread mr_moe
Damn.
But thank you anyway.



--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-Planner-Planning-variable-gets-assigned-value-out-of-valueRange-tp4020984p4020995.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


Re: [rules-users] Drools Planner: Planning variable gets assigned value out of valueRange

2012-11-28 Thread Geoffrey De Smet

Op 27-11-12 14:16, mr_moe schreef:
> Hey,
>
> I have a planning entity, which has one planning variable called startDate.
> This variable has a defined discrete value range which is a list of numbers
> of the type long. Every number represents a timestamp, which is in between
> the number firstPossibleStartDate and lastPossibleStartDate.
>
> During the planning process, the number 0 is sometimes assigned to the
> planning variable which is definitely not part of the valueRange. I’ve
> printed the list to the console, but all values in the list are fine.
>
> Because every planning entity has its own valueRange, the range is defined
> in the entity itself.
>
> At the moment I’ve implemented my own mover, but the problem occurs also
> with pre-configured mover.
>
> During my research I’ve stumbled upon the following note in the Planner
> Documentation:
> ValueRange from planning entity is currently not yet supported by the new
> MoveSelectors.
> Does this has something to do with my problem?
Yes, this is the one known issue (regression even) with the new selector 
architecture (which has brought many benefits):
It basically breaks @ValueRange(type = 
ValueRangeType.FROM_PLANNING_ENTITY_PROPERTY, ...) currently.
I should probably have failed-fast that for 5.5 if that gets used.

I am hoping to resolve this for 6.0 so FROM_PLANNING_ENTITY_PROPERTY 
does work in the new selector architecture.
To do that properly, I need to put the construction heuristics on the 
new selector architecture first.
>
> Enclosed you will find the code of the planning entity.
>
> @PlanningEntity
> public class DroolTask {
>   private List startDateList;
>   private int id;
>   private String name;
>   private long duration;
>   private long firstPossibleStartDate;
>   private long lastPossibleStartDate;
>   private String nextTask = "";
>   private String previousTask = "";
>   
>   // Planning variables: changes during planning, between score 
> calculations.
>   private long startDate;
>   
>   @PlanningVariable
>   @ValueRange(type = ValueRangeType.FROM_PLANNING_ENTITY_PROPERTY,
> planningEntityProperty = "startDateList")
>   public long getStartDate(){
>   return startDate;
>   }
>   
>   public void setStartDate(long startDate){
>   this.startDate = startDate;
>   }
>   
>   
>   public List getStartDateList(){
>   return this.startDateList;
>   }
>   
>   public void setStartDateList(){
>   startDateList = getPossibleStartDate();
>   }
>   
>   public List getPossibleStartDate(){
>   startDateList = new ArrayList();
>   for(long i = firstPossibleStartDate; i<=lastPossibleStartDate; 
> i = i +
> 60){
>   startDateList.add(i);
>   }
>   return startDateList;
>   }
>   
>   public Long getFirstPossibleStartDate(){
>   return firstPossibleStartDate;
>   }
>   
>   public void setFirstPossibleStartDate(long firstPossibleStartDate){
>   this.firstPossibleStartDate = firstPossibleStartDate;
>   }
>   
>   public Long getLastPossibleStartDate(){
>   return lastPossibleStartDate;
>   }
>   
>   public void setLastPossibleStartDate(long lastPossibleEndDate){
>   this.lastPossibleStartDate = lastPossibleEndDate;
>   }
>   
> [...]
>
>   
>   public DroolTask clone(){
>   DroolTask clone = new DroolTask();
>   
>   clone.name = name;
>   clone.duration = duration;
>   clone.firstPossibleStartDate = firstPossibleStartDate;
>   clone.lastPossibleStartDate = lastPossibleStartDate;
>   clone.startDate = startDate;
>   clone.nextTask = nextTask;
>   clone.previousTask = previousTask;
>   clone.startDateList = startDateList;
>   
>   return clone;
>   }
>
> [...]
> }
>
> It would be great, if someone could give me a hint.
> Many thanks,
>
> Moe
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Drools-Planner-Planning-variable-gets-assigned-value-out-of-valueRange-tp4020984.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] Drools Planner: Planning variable gets assigned value out of valueRange

2012-11-27 Thread mr_moe
Hey,

I have a planning entity, which has one planning variable called startDate.
This variable has a defined discrete value range which is a list of numbers
of the type long. Every number represents a timestamp, which is in between
the number firstPossibleStartDate and lastPossibleStartDate.

During the planning process, the number 0 is sometimes assigned to the
planning variable which is definitely not part of the valueRange. I’ve
printed the list to the console, but all values in the list are fine.

Because every planning entity has its own valueRange, the range is defined
in the entity itself.

At the moment I’ve implemented my own mover, but the problem occurs also
with pre-configured mover.

During my research I’ve stumbled upon the following note in the Planner
Documentation: 
ValueRange from planning entity is currently not yet supported by the new
MoveSelectors.
Does this has something to do with my problem?

Enclosed you will find the code of the planning entity.

@PlanningEntity
public class DroolTask {
private List startDateList;
private int id;
private String name;
private long duration;
private long firstPossibleStartDate;
private long lastPossibleStartDate;
private String nextTask = "";
private String previousTask = "";

// Planning variables: changes during planning, between score 
calculations.
private long startDate;

@PlanningVariable
@ValueRange(type = ValueRangeType.FROM_PLANNING_ENTITY_PROPERTY,
planningEntityProperty = "startDateList")
public long getStartDate(){
return startDate;
}

public void setStartDate(long startDate){
this.startDate = startDate;
}


public List getStartDateList(){
return this.startDateList;
}

public void setStartDateList(){
startDateList = getPossibleStartDate();
}

public List getPossibleStartDate(){
startDateList = new ArrayList();
for(long i = firstPossibleStartDate; i<=lastPossibleStartDate; 
i = i +
60){
startDateList.add(i);
}
return startDateList;
}

public Long getFirstPossibleStartDate(){
return firstPossibleStartDate;
}

public void setFirstPossibleStartDate(long firstPossibleStartDate){
this.firstPossibleStartDate = firstPossibleStartDate;
}

public Long getLastPossibleStartDate(){
return lastPossibleStartDate;
}

public void setLastPossibleStartDate(long lastPossibleEndDate){
this.lastPossibleStartDate = lastPossibleEndDate;
}

[...]


public DroolTask clone(){
DroolTask clone = new DroolTask();

clone.name = name;
clone.duration = duration;
clone.firstPossibleStartDate = firstPossibleStartDate;
clone.lastPossibleStartDate = lastPossibleStartDate;
clone.startDate = startDate;
clone.nextTask = nextTask;
clone.previousTask = previousTask;
clone.startDateList = startDateList;

return clone;
}

[...]
}

It would be great, if someone could give me a hint.
Many thanks,

Moe



--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-Planner-Planning-variable-gets-assigned-value-out-of-valueRange-tp4020984.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


Re: [rules-users] [Drools Planner] Multi depot CVRP / CVRPTW

2012-11-20 Thread Mats Norén
Ok, so on the first rule should fire for all occurrences of a Customer
since each Customer should have at least one visit?

It's not another planning variable,
> instead,
> do something like
>
> when
>   ...
> then
>insertLogical(new CustomerVisitArrivalTime(...));
> end
>
> when
> CustomerVisitArrivalTime($c : customer, $a : arrival)
> not CustomerTimeWindow(customer == $c, $a > start, $a < end)
> then
> insertLogical(new IntConstraintOccurrence(...))
> end
>
> See nurseRosteringScoreRules.drl for an example of use of
> insertLogical's like that
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>

Btw, thanks for your help and thanks for a great product!

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


Re: [rules-users] [Drools Planner] Multi depot CVRP / CVRPTW

2012-11-20 Thread Geoffrey De Smet

Op 19-11-12 19:33, Mats Norén schreef:
> Interesting. You mean that I could add another rule in the vrp example
> that checks the vehicle TimeWindow of the customer against
> CustomerVisitArrivalTime?
>
> In that case is the CustomerVisitArrivalTime a planning variable and
> in which domain class does it belong?
> I'm still trying to wrap my head around the concepts. :-)
It's not another planning variable,
instead,
do something like

when
  ...
then
   insertLogical(new CustomerVisitArrivalTime(...));
end

when
CustomerVisitArrivalTime($c : customer, $a : arrival)
not CustomerTimeWindow(customer == $c, $a > start, $a < end)
then
insertLogical(new IntConstraintOccurrence(...))
end

See nurseRosteringScoreRules.drl for an example of use of 
insertLogical's like that
>
> /M
>
> On Mon, Nov 19, 2012 at 5:39 PM, Geoffrey De Smet
>  wrote:
>> Op 19-11-12 17:17, Mats Norén schreef:
>>
>> Hi,
>> I've been looking at the VRP example in Drools and I'm thinking about using
>> it for multi depot cvrp and / or capacitated vrp with time windows.
>> Has anyone else tried planner for these use cases and can maybe shed some
>> light on their implementation?
>>
>> The VRP example is already capacitated.
>>
>> Multi-depot is pretty easy: just assign different a different starting
>> Location for every Vehicle.
>> Unless you want Vehicles to change Depot sometimes, then it's a bit more
>> complex.
>>
>> Time windows is more difficult if you don't want to break incremental score
>> calculation.
>> Doing an insertLogical() for the arrival time of every CustomerVisit should
>> work.
>> Then it's just a matter of checking if that logically inserted fact
>> CustomerVisitArrivalTime falls within the TimeWindow of the customer.
>>
>>
>> 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] [Drools Planner] Multi depot CVRP / CVRPTW

2012-11-19 Thread Mats Norén
Interesting. You mean that I could add another rule in the vrp example
that checks the vehicle TimeWindow of the customer against
CustomerVisitArrivalTime?

In that case is the CustomerVisitArrivalTime a planning variable and
in which domain class does it belong?
I'm still trying to wrap my head around the concepts. :-)

/M

On Mon, Nov 19, 2012 at 5:39 PM, Geoffrey De Smet
 wrote:
>
> Op 19-11-12 17:17, Mats Norén schreef:
>
> Hi,
> I've been looking at the VRP example in Drools and I'm thinking about using
> it for multi depot cvrp and / or capacitated vrp with time windows.
> Has anyone else tried planner for these use cases and can maybe shed some
> light on their implementation?
>
> The VRP example is already capacitated.
>
> Multi-depot is pretty easy: just assign different a different starting
> Location for every Vehicle.
> Unless you want Vehicles to change Depot sometimes, then it's a bit more
> complex.
>
> Time windows is more difficult if you don't want to break incremental score
> calculation.
> Doing an insertLogical() for the arrival time of every CustomerVisit should
> work.
> Then it's just a matter of checking if that logically inserted fact
> CustomerVisitArrivalTime falls within the TimeWindow of the customer.
>
>
> 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


Re: [rules-users] [Drools Planner] Multi depot CVRP / CVRPTW

2012-11-19 Thread Geoffrey De Smet

  
  

Op 19-11-12 17:17, Mats Norén schreef:

Hi,
  I've been looking at the VRP example in Drools and I'm thinking
  about using it for multi depot cvrp and / or capacitated vrp with
  time windows. 
  Has anyone else tried planner for these use cases and can maybe
  shed some light on their implementation?

The VRP example is already capacitated.

Multi-depot is pretty easy: just assign different a different
starting Location for every Vehicle.
Unless you want Vehicles to change Depot sometimes, then it's a bit
more complex.

Time windows is more difficult if you don't want to break
incremental score calculation.
Doing an insertLogical() for the arrival time of every CustomerVisit
should work.
Then it's just a matter of checking if that logically inserted fact
CustomerVisitArrivalTime falls within the TimeWindow of the
customer.


  
  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] [Drools Planner] Multi depot CVRP / CVRPTW

2012-11-19 Thread Mats Norén
Hi,
I've been looking at the VRP example in Drools and I'm thinking about using
it for multi depot cvrp and / or capacitated vrp with time windows.
Has anyone else tried planner for these use cases and can maybe shed some
light on their implementation?

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


Re: [rules-users] Drools Planner: Negative and Positive constraints

2012-11-18 Thread Amelie
Yes it's clearer in the new documentation, I should have read it before,
sorry and thanks.



--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-Planner-Negative-and-Positive-constraints-tp4020871p4020879.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


Re: [rules-users] Drools Planner: Negative and Positive constraints

2012-11-18 Thread Geoffrey De Smet
Does this documentation answer your question sufficiently?
http://docs.jboss.org/drools/release/5.5.0.Final/drools-planner-docs/html_single/index.html#d0e3308

Op 17-11-12 17:24, Amelie schreef:
> Hi all,
>
> I'm new with Planner and I just wanted to know what are the differences
> between the negative and positive constraints and in which cases it is
> necessary to to use them
>
> Thank you for your help.
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Drools-Planner-Negative-and-Positive-constraints-tp4020871.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] Drools Planner: Negative and Positive constraints

2012-11-17 Thread Amelie
Hi all,

I'm new with Planner and I just wanted to know what are the differences
between the negative and positive constraints and in which cases it is
necessary to to use them

Thank you for your help.



--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-Planner-Negative-and-Positive-constraints-tp4020871.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


Re: [rules-users] Drools Planner: Linear programming with drools?

2012-11-16 Thread Geoffrey De Smet

Op 15-11-12 14:26, oliver.rolle schreef:
> Hi,
> I am writing a paper about route optimizations for fire trucks through
> influencing the traffic control system. The idea is to give fire trucks a
> green wave under the restriction of the flow of traffic.
Interesting.
>
> I want to compare the solutions of different methods for the problem:
> 1. Linear programming / Simplex: best solution
Simplex will give only give you the optimal solution if you have enough 
time to let it run that long.
For medium/large cases with a real number of constraints, this can 
easily be years.

In practice, it is never about finding the optimal solution,
it's about finding the best solution in a fixed amount of time.
> 2. Heuristic / Drools: good solution
> 3. Real-time / Drools: good solution
>
> The simplex algorithm is not implemented in Drools. Can Drools emulate the
> simplex algorithm?
No. Planner doesn't force you to use only linear constraints.
>   Does Drools metaheuristic approach solve linear models as
> good as simplex does? always?
In the experiments and competitions I 've been involved with [1], I 've 
seen the following:
- Simplex is better at scaling down (< 100 variables, < 100 values)
- Drools Planner is far better at scaling up (> 10 000 variables, > 10 
000 values) (Simplex goes out of memory)
- In the range between, they average out.
- Drools Planner can do real-time planning: good solutions in ms after 
the last problem change.

[1] Google Roadef 2012, ITC 2007, INRC 2010, ...
>
> best regards
> Oli
>
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Drools-Planner-Linear-programming-with-drools-tp4020844.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] Drools Planner: Linear programming with drools?

2012-11-15 Thread oliver.rolle
Hi,
I am writing a paper about route optimizations for fire trucks through
influencing the traffic control system. The idea is to give fire trucks a
green wave under the restriction of the flow of traffic.

I want to compare the solutions of different methods for the problem:
1. Linear programming / Simplex: best solution
2. Heuristic / Drools: good solution
3. Real-time / Drools: good solution

The simplex algorithm is not implemented in Drools. Can Drools emulate the
simplex algorithm? Does Drools metaheuristic approach solve linear models as
good as simplex does? always?

best regards
Oli




--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-Planner-Linear-programming-with-drools-tp4020844.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


Re: [rules-users] Drools planner: unbreakable constraint question

2012-10-27 Thread ge0ffrey
mvermand wrote
> drools planner to forcefully reject any "solution" that breaks this one
> rule, 
> continue searching for other solutions and guarantee that the "best
> solution" will not propose a combination that fails this rule?

Use  See manual section termination
for more information, combine it in AND like with your current termination.


If you need to separate this constraint out from the other hard constraints,
instead of giving it just a high weight, you need to make it an extra score
level. Currently there is no build-in ScoreDefinition with 3 score levels,
so you 'll need to create a custom one (which isn't too hard). All this is
explained in the manual chapter score calculation.

Make sure you'r reading the latest manual 5.5.0.CR1



--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-Drools-planner-unbreakable-constraint-question-tp4020483p4020526.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


Re: [rules-users] Drools planner: unbreakable constraint question

2012-10-26 Thread cheikh dhib
I'm not sure that this email was well received on the list. So i resend 
it and add also the personal address which sent the first mail

Le 26/10/2012 17:19, cheikh dhib a écrit :

Hello,

I'm not a good Drools user. But i think what you can do, is to use a 
high value(a value that is greater than the sum of all other possible 
values associated with the soft constraints). By this way you will be 
sure that a solution with this constraint violated will not be 
accepted if there is another one  in which the constraint is not 
violated. In opposite if all your solutions violate this constraint, 
you will have one with the less number of violation and that can be 
enhanced through the steps of research, which can lead finally to a 
feasible solution.


Good luck, any way.

Le 26/10/2012 15:03, Michiel Vermandel a écrit :

Hi,

Any one an idea?

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

*From:* Michiel Vermandel 
*To:* Rules lists.jboss.org 
*Sent:* Thursday, October 25, 2012 10:27 AM
*Subject:* [rules-users] Drools planner: unbreakable constraint question

Hi,

I have a planning project that is determined by quite some constraints.
Translated in rules this results in a number of hard constraints and 
a number of soft constraints.
Now I have one rule (hard constraint) that simply many not be broken, 
never, ever.

If a planning that fails this rule would be executed, we face a lawsuit.

Of course I can (and will) do a post-evaluation to find out if this 
rule is broken,
but I want to know if there is a possibility in drools planner to 
forcefully reject any "solution" that breaks this one rule,
continue searching for other solutions and guarantee that the "best 
solution" will not propose a combination that fails this rule?


Is this possible?

Thanks,

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

___
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] Drools planner: unbreakable constraint question

2012-10-26 Thread cheikh dhib

Hello,

I'm not a good Drools user. But i think what you can do, is to use a 
high value(a value that is greater than the sum of all other possible 
values associated with the soft constraints). By this way you will be 
sure that a solution with this constraint violated will not be accepted 
if there is another one  in which the constraint is not violated. In 
opposite if all your solutions violate this constraint, you will have 
one with the less number of violation and that can be enhanced through 
the steps of research, which can lead finally to a feasible solution.


Good luck, any way.

Le 26/10/2012 15:03, Michiel Vermandel a écrit :

Hi,

Any one an idea?

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

*From:* Michiel Vermandel 
*To:* Rules lists.jboss.org 
*Sent:* Thursday, October 25, 2012 10:27 AM
*Subject:* [rules-users] Drools planner: unbreakable constraint question

Hi,

I have a planning project that is determined by quite some constraints.
Translated in rules this results in a number of hard constraints and a 
number of soft constraints.
Now I have one rule (hard constraint) that simply many not be broken, 
never, ever.

If a planning that fails this rule would be executed, we face a lawsuit.

Of course I can (and will) do a post-evaluation to find out if this 
rule is broken,
but I want to know if there is a possibility in drools planner to 
forcefully reject any "solution" that breaks this one rule,
continue searching for other solutions and guarantee that the "best 
solution" will not propose a combination that fails this rule?


Is this possible?

Thanks,

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

___
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] Drools planner: unbreakable constraint question

2012-10-26 Thread Michiel Vermandel
Hi,

Any one an idea?


Thanks

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



 From: Michiel Vermandel 
To: Rules lists.jboss.org  
Sent: Thursday, October 25, 2012 10:27 AM
Subject: [rules-users] Drools planner: unbreakable constraint question
 

Hi,

I have a planning project that is determined by quite some constraints.
Translated in rules this results in a number of hard constraints and a number 
of soft constraints.
Now I have one rule (hard constraint) that simply many not be broken, never, 
ever.
If a planning that fails this rule would be executed, we face a lawsuit.

Of course I can (and will) do a post-evaluation to find out if this rule is 
broken, 
but I want to know if there is a possibility in drools planner to forcefully 
reject any "solution" that breaks this one rule, 
continue searching for other solutions and guarantee that the "best solution" 
will not propose a combination that fails this rule?

Is this possible?


Thanks,

Michiel

 
-
http://www.codessentials.com - Your essential software, for free!
Follow us at http://twitter.com/#!/Codessentials
___
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] Drools planner: unbreakable constraint question

2012-10-25 Thread Michiel Vermandel
Hi,

I have a planning project that is determined by quite some constraints.
Translated in rules this results in a number of hard constraints and a number 
of soft constraints.
Now I have one rule (hard constraint) that simply many not be broken, never, 
ever.
If a planning that fails this rule would be executed, we face a lawsuit.

Of course I can (and will) do a post-evaluation to find out if this rule is 
broken, 
but I want to know if there is a possibility in drools planner to forcefully 
reject any "solution" that breaks this one rule, 
continue searching for other solutions and guarantee that the "best solution" 
will not propose a combination that fails this rule?

Is this possible?


Thanks,

Michiel

 
-
http://www.codessentials.com - Your essential software, for free!
Follow us at http://twitter.com/#!/Codessentials___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Drools Planner configuration schema

2012-10-23 Thread ge0ffrey
Jon L wrote
> Is there a schema for the drools planner configuration file?
> I'd like to validate a configuration file at the beginning of my
> application.  It would also help in knowing the possible values for some
> of the configuration entities.
> 
> Thanks,
> 
> Jonathan

Currently no xsd schema file exists. If there isn't a jira for it yet, feel
free to open one, it would make usage a lot easier indeed.
To know the possible values for some of the configuration entities, take a
look at SolverConfig and the other Config classes.
https://github.com/droolsjbpm/drools-planner/blob/master/drools-planner-core/src/main/java/org/drools/planner/config/solver/SolverConfig.java#L44
Although the best info is in the reference manual of course.



--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-Planner-configuration-schema-tp4020446p4020450.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


Re: [rules-users] [Drools Planner] understand the drl content of the TSP example

2012-10-16 Thread ge0ffrey
> softConstraintsBroken" : calculate the total length of the tour, right ?
Yes, but they use the occurrences injected by "distanceToPreviousAppearance"
and "distanceFromLastVisitToDomicile".

"distanceToPreviousAppearance" adds the distance from a Visit to the
previous visit or Domicile (= starting point).
"distanceFromLastVisitToDomicile" add the distance from the last visit back
to the Domicile.

Look for "insertLogical" in the drools expert manual



--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-Planner-understand-the-drl-content-of-the-TSP-example-tp4020247p4020303.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


Re: [rules-users] Drools Planner for purchasing optimization - good fit for problem?

2012-10-12 Thread Schneider, Bill
Geoffrey,
Thanks, this was very helpful.
--Bill

From: rules-users-boun...@lists.jboss.org 
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Geoffrey De Smet
Sent: Friday, October 12, 2012 11:11 AM
To: Rules Users List
Subject: Re: [rules-users] Drools Planner for purchasing optimization - good 
fit for problem?


Op 11-10-12 21:34, Schneider, Bill schreef:
Geoffrey,
Thanks for the quick response.

As I'm learning more about my scenario, it feels more like a mixed-integer 
problem than a combinatorial problem.  The objective function is linear in the 
decision variables.  I would model the decision variables as the quantities of 
each item from each vendor.
This might be the biggest hurdle in Planner. A variable that represents a 
quantity, for which is it's unrealistic to make a pool of all values is 
currently difficult (but not impossible) in Planner. Future work will improve 
support for this - but currently you 'll likely need to implement custom moves 
(see manual).

The conditional offers I could model as a separate vendor/bid, with a binary 
decision variable for "condition met?" and inequalities to constrain the 
quantities that depend on the binary variable.   Some of the global constraints 
can be modeled in the same way, like "at most two vendors."
It sounds like there are some advantages to using Drools Planner in terms of 
readability and maintainability of the relationships and constraints - you have 
the full expressive power of DRL (or Java), and are not limited to 
inequalities.   That could make it easier to program for new types of rules or 
constraints later.

Are there any advantages to using Drools Planner from a 
computational-complexity standpoint as well?  Would it *hurt* to use in terms 
of CPU/memory, or even learning curve, for a problem that is possibly not 
combinatorial, and might be solvable with other means?
In my experience, if it scales beyond 10 000 values (= bids) and 10 000 
purchases, LP and MIP's memory requirements are impossible today and 
metaheuristics are the only way.
See Google roadef 2012 competition: 
http://blog.athico.com/2012/06/roadef-2012-first-results-for-dataset-b.html
And that's even without scaling out the number of constraints (= score rules).


Also - are you aware of any case studies or examples of Drools Planner being 
used in the purchasing domain like this?
Not in the purchasing domain - I suspect the quantity complexity is hindering 
adoption in that area currently.


Thanks again!

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


Re: [rules-users] Drools Planner for purchasing optimization - good fit for problem?

2012-10-12 Thread Geoffrey De Smet

  
  

Op 11-10-12 21:34, Schneider, Bill
  schreef:


  
  
  
  
Geoffrey, 
Thanks for the
quick response.  

 
As I’m learning
more about my scenario, it feels more like a mixed-integer
problem than a combinatorial problem.  The objective
function is linear in the decision variables.  I would model
the decision variables as the quantities of each item from
each vendor. 
  
  

This might be the biggest hurdle in Planner. A variable that
represents a quantity, for which is it's unrealistic to make a pool
of all values is currently difficult (but not impossible) in
Planner. Future work will improve support for this - but currently
you 'll likely need to implement custom moves (see manual).

  
 The
conditional offers I could model as a separate vendor/bid,
with a binary decision variable for “condition met?” and
inequalities to constrain the quantities that depend on the
binary variable.   Some of the global constraints can be
modeled in the same way, like “at most two vendors.”

It sounds like
there are some advantages to using Drools Planner in terms
of readability and maintainability of the relationships and
constraints – you have the full expressive power of DRL (or
Java), and are not limited to inequalities.   That could
make it easier to program for new types of rules or
constraints later. 

 
Are there any
advantages to using Drools Planner from a
computational-complexity standpoint as well?  Would it *hurt*
to use in terms of CPU/memory, or even learning curve, for a
problem that is possibly not combinatorial, and might be
solvable with other means?
  

In my experience, if it scales beyond 10 000 values (= bids) and 10
000 purchases, LP and MIP's memory requirements are impossible today
and metaheuristics are the only way.
See Google roadef 2012 competition:
http://blog.athico.com/2012/06/roadef-2012-first-results-for-dataset-b.html
And that's even without scaling out the number of constraints (=
score rules).

  

 
Also – are you
aware of any case studies or examples of Drools Planner
being used in the purchasing domain like this? 
  
  

Not in the purchasing domain - I suspect the quantity complexity is
hindering adoption in that area currently.

  

 
Thanks again!
 
--Bill
 

  
From:
rules-users-boun...@lists.jboss.org
[mailto:rules-users-boun...@lists.jboss.org]
On Behalf Of Geoffrey De Smet
Sent: Thursday, October 11, 2012 10:35 AM
To: Rules Users List
    Subject: Re: [rules-users] Drools Planner for
purchasing optimization - good fit for problem?
  

 
[…]
- If you want to upscale, go Metaheuristics (for example
with Planner). If you want to downscale, linear programming
might be a better fit. (Compo's like ROADEF 2012 assert this
statement).
- LP will require you to write your constraints as
mathematical equitations based on arrays and primitives, for
example "x < y * 1.21". Planner uses a declarative OO
approach using drools rules (or even just plain Java), for
example "Invoice ($x < yWithVAT)".
- If you have different conditional price types, you might
want to look into using a drools decision table to easily
declare that conditional logic - and use that as in Planner.
Especially if those rules change often.


 
Thanks for any help you can give.
--Bill




___
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] Drools Planner for purchasing optimization - good fit for problem?

2012-10-11 Thread Schneider, Bill
Geoffrey,
Thanks for the quick response.

As I'm learning more about my scenario, it feels more like a mixed-integer 
problem than a combinatorial problem.  The objective function is linear in the 
decision variables.  I would model the decision variables as the quantities of 
each item from each vendor.  The conditional offers I could model as a separate 
vendor/bid, with a binary decision variable for "condition met?" and 
inequalities to constrain the quantities that depend on the binary variable.   
Some of the global constraints can be modeled in the same way, like "at most 
two vendors."
It sounds like there are some advantages to using Drools Planner in terms of 
readability and maintainability of the relationships and constraints - you have 
the full expressive power of DRL (or Java), and are not limited to 
inequalities.   That could make it easier to program for new types of rules or 
constraints later.

Are there any advantages to using Drools Planner from a 
computational-complexity standpoint as well?  Would it *hurt* to use in terms 
of CPU/memory, or even learning curve, for a problem that is possibly not 
combinatorial, and might be solvable with other means?

Also - are you aware of any case studies or examples of Drools Planner being 
used in the purchasing domain like this?

Thanks again!

--Bill

From: rules-users-boun...@lists.jboss.org 
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Geoffrey De Smet
Sent: Thursday, October 11, 2012 10:35 AM
To: Rules Users List
Subject: Re: [rules-users] Drools Planner for purchasing optimization - good 
fit for problem?

[...]
- If you want to upscale, go Metaheuristics (for example with Planner). If you 
want to downscale, linear programming might be a better fit. (Compo's like 
ROADEF 2012 assert this statement).
- LP will require you to write your constraints as mathematical equitations 
based on arrays and primitives, for example "x < y * 1.21". Planner uses a 
declarative OO approach using drools rules (or even just plain Java), for 
example "Invoice ($x < yWithVAT)".
- If you have different conditional price types, you might want to look into 
using a drools decision table to easily declare that conditional logic - and 
use that as in Planner. Especially if those rules change often.




Thanks for any help you can give.

--Bill




___

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


Re: [rules-users] Drools Planner for purchasing optimization - good fit for problem?

2012-10-11 Thread Geoffrey De Smet

  
  

Op 11-10-12 16:19, Schneider, Bill
  schreef:


  
  
  
  
I'm trying to understand whether Drools
  Planner is a good fit for a purchasing optimization problem.
  
 
The problem is something like this:
  there are X different items, each of which can be purchased
  from Y different vendors at different prices.  The objective
  variable/function to minimize is the total amount purchased
  (sum(qty_i * price_i)).
 
Some vendor prices are conditional -
  only valid if you purchase more than some minimum threshold,
  or if you purchase more than some total quantity from that
  vendor.  There are some additional constraints like
  dual-sourcing
- for some item x_i, exactly two vendors
  must be selected. 
  
 
I feel like you *could* probably solve
  this problem in Drools Planner,
  

Yes

  
 but I'm not sure if it's the best way,
  or if a more traditional solver approach would be better.  It
  feels more like a linear programming problem at its core, and
  I'm having a hard time figuring out where the boundary is -
  what kind of constraint would make the problem "non-convex" or
  "non-smooth" to the point where a local search (tabu,
  evolutionary etc.) is required?
  

That's hard to tell from this distance.

- If you want to upscale, go Metaheuristics (for example with
Planner). If you want to downscale, linear programming might be a
better fit. (Compo's like ROADEF 2012 assert this statement).
- LP will require you to write your constraints as mathematical
equitations based on arrays and primitives, for example "x < y *
1.21". Planner uses a declarative OO approach using drools rules (or
even just plain Java), for example "Invoice ($x < yWithVAT)".
- If you have different conditional price types, you might want to
look into using a drools decision table to easily declare that
conditional logic - and use that as in Planner. Especially if those
rules change often.

  

 
Thanks for any help you can give.
--Bill
  
  
  
  
  ___
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] Drools Planner for purchasing optimization - good fit for problem?

2012-10-11 Thread Schneider, Bill
I'm trying to understand whether Drools Planner is a good fit for a purchasing 
optimization problem.



The problem is something like this: there are X different items, each of which 
can be purchased from Y different vendors at different prices.  The objective 
variable/function to minimize is the total amount purchased (sum(qty_i * 
price_i)).



Some vendor prices are conditional - only valid if you purchase more than some 
minimum threshold, or if you purchase more than some total quantity from that 
vendor.  There are some additional constraints like dual-sourcing

- for some item x_i, exactly two vendors must be selected.



I feel like you *could* probably solve this problem in Drools Planner, but I'm 
not sure if it's the best way, or if a more traditional solver approach would 
be better.  It feels more like a linear programming problem at its core, and 
I'm having a hard time figuring out where the boundary is - what kind of 
constraint would make the problem "non-convex" or "non-smooth" to the point 
where a local search (tabu, evolutionary etc.) is required?



Thanks for any help you can give.

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


[rules-users] Drools-Planner consulting on rule-set

2012-10-04 Thread drools

Hi,
 
in drools planner I have built an application that has a rule-set with 6 
hard-constraint rules and 6 soft-constraint rules. I am optimizing this 
rule-set now and then already for a very long time (around 2 years).
 
Currently I am having difficulty with solving local optima problem for this 
rule-set and am stuck for 2-3 weeks already without any improvement (I think I 
am missing some POSITIVE soft constraints to achieve score improvement within 
short number of steps).
 
So I would like to ask you, guys, if someone would consult me and help me to 
unstuck. I would gladly pay for your effort and estimate that approx. 8 
man-hours should be enough for a drools rules professional to help me to move 
on.
 
If you are interested, please contact me with your quotes.
 
If we reach an agreement, I will send you domain model and rule-set and then we 
hold 1-2 phone calls to discuss changes in rule-set and domain model. If you 
would take a look on rule-set before you quote, please let me know.
 
Thank you and kind regards
Reinis

 




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


Re: [rules-users] Drools Planner - Vehicle Routing, but a little different

2012-09-24 Thread Geoffrey De Smet

Op 23-09-12 17:10, jimirn schreef:
> Hi,
>
> I hope someone can tell me what I am doing wrong.
>
> I am trying to kind of do the same as the Vehicle Routing example.
Relative to the Vehicle Routing example, this domain would be:
>
> My domain is:
> - Consultant (the person that will drive to a DeliveryPlace and spent some
> time there, each Consultant has a max total time available)
VrpVehicle
> - DeliveryPlace (the place where a Consultant will drive to and spent some
> time making a delivery)
VrpCustomer (=> planning entity)
> - Location (a Consultant has a home and a DeliveryPlace has a location)
VrpLocation
>
> So basicly there could be X Consultants who has to make deliveries to Y
> DeliveryPlace's. And I want to figure out the best way of doing that.
>
> Right now my code does not find any doable moves:
> 16:51:57.654 [main] INFO  o.d.p.c.c.g.DefaultGreedyFitSolverPhase - Phase
> constructionHeuristic ended: step total (0), time spend (86), best score
> (0hard/0soft).
0 steps means that non of the planning entities's variables are null and 
therefore there is nothing to initialize.
> 16:51:57.658 [main] WARN  o.d.p.c.l.DefaultLocalSearchSolverPhase -
> Cancelled step index (0), time spend (89): there is no doable move.
> Terminating phase early.
> 16:51:57.658 [main] INFO  o.d.p.c.l.DefaultLocalSearchSolverPhase - Phase
> localSearch ended: step total (0), time spend (90), best score
> (0hard/0soft).
>
>
>
> Here is the source code, modified from the Vehicle Routing example:
> src.tar.gz 
Diff your code with the vehicle routing example.
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Drools-Planner-Vehicle-Routing-but-a-little-different-tp4019907.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] Drools Planner - Vehicle Routing, but a little different

2012-09-23 Thread jimirn
Hi,

I hope someone can tell me what I am doing wrong.

I am trying to kind of do the same as the Vehicle Routing example.

My domain is:
- Consultant (the person that will drive to a DeliveryPlace and spent some
time there, each Consultant has a max total time available)
- DeliveryPlace (the place where a Consultant will drive to and spent some
time making a delivery)
- Location (a Consultant has a home and a DeliveryPlace has a location)

So basicly there could be X Consultants who has to make deliveries to Y
DeliveryPlace's. And I want to figure out the best way of doing that.

Right now my code does not find any doable moves:
16:51:57.654 [main] INFO  o.d.p.c.c.g.DefaultGreedyFitSolverPhase - Phase
constructionHeuristic ended: step total (0), time spend (86), best score
(0hard/0soft).
16:51:57.658 [main] WARN  o.d.p.c.l.DefaultLocalSearchSolverPhase -
Cancelled step index (0), time spend (89): there is no doable move.
Terminating phase early.
16:51:57.658 [main] INFO  o.d.p.c.l.DefaultLocalSearchSolverPhase - Phase
localSearch ended: step total (0), time spend (90), best score
(0hard/0soft).



Here is the source code, modified from the Vehicle Routing example:
src.tar.gz   



--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-Planner-Vehicle-Routing-but-a-little-different-tp4019907.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


Re: [rules-users] drools-planner move question - move generation by DRL

2012-08-23 Thread Geoffrey De Smet
Op 23-08-12 21:52, Ricardo schreef:
> How to do a move generation by DRL? is this available in which version?
>
>
I haven't done it yet at this time (no examples, no docs), but it should 
be relatively easy to do in the new selector architecture (5.5.0.Beta1+),
by implementing a MoveIteratorFactory, a stronger alternative to a 
simple MoveListFactory:

public class ... extends MoveIteratorFactory {

 public Iterator createOriginalMoveIterator(ScoreDirector 
scoreDirector) {
  ((DroolsScoreDirector) 
scoreDirector).getWorkingMemory().getQueryResults(...)
  ...
 }

 ... // implement other 2 methods correct too

}

There's a big pitfall however:
That WorkingMemory is used for to do and undo every step that is 
evaluated (to enable the huge speed bonus of incremental score calculation).
So when you add a (forward chained) rule for move generation in that 
WM's RuleBase,
it can (and will) slow down every score calculation...
However, if you add (backward chained) queries instead, that should have 
no performance impact.
I haven't experimented with this yet and I welcome any feedback if 
you're doing experiments with this.

Long term solution:
When I implement multi-threaded solvers (depending on how much time I 
get for Planner this will be sooner or later - it is a massive change), 
there will be a WM that is used for move selection only. So, we 'll be 
able to add (forward chained) rules on that, without slowing down the 
score calculation.
After the feature "multi-threaded solvers", I 'll add official support 
for "move generation by DRL".

>
> -
> with kind regards,
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/drools-planner-move-question-tp4019375.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   >