[rules-users] Planner: What is a good example/algo to chain entities?

2013-02-05 Thread Michiel Vermandel
Hi,

I need to keep some Planning entities (Tasks) together and I am looking for 
some insights/ideas/examples in how to tackle this.
Tasks are grouped by a groupId (Groups are problem facts).

The Tasks do not have to be grouped like a pillar but more like an accordion.
One of the planning variables is "Period", a Period typically is 3 weeks and we 
have 12 Periods to plan the tasks into.


The requirement is that all tasks within  a group need to be kept together in 
such a way that:
- the spread (nr of periods) of the tasks is minimal
- the spread is never more than the sum of the duration of the separate tasks 
in the group.

So given a group of 3 tasks:

1)This is good:

Period 12345789ABC

T1:  xxx
T2: xx
T3:   x

2)This is better:

Period 12345789ABC

T1:  xxx
T2:   xx
T3: x

3)This is (one of) the best:

Period 12345789ABC

T1:  xxx
T2:   xx
T3:    x

4)This is bad:

Period 12345789ABC

T1:  xxx
T2:   xx
T3:  x

Of course 3 is favorite, but maybe not possible due to other planning variables 
(-> availability of people to execute the tasks).
I need to plan a few hundred of such groups of tasks which all share the same 
Period space and list of available people.
(A person can only do one task per period)


I have got the DRL rule that keeps the tasks together (rule counts the gaps) , 
but giving penalty for making gaps (by shifting a single task) makes it hard to 
find a good solution.
What would be the best approach to solve this problem?

- A combination of custom mover and swapper which moves/swaps groups instead of 
single tasks?
- The above in combination with a group shuffle factory (swapping tasks in a 
single group)?


Other ideas?

Thanks a lot!

-
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] How to pass a "global" reference date to rules

2013-02-05 Thread pdario
I'm following your suggestions, I think I can go with them.

Thank you



--
View this message in context: 
http://drools.46999.n3.nabble.com/How-to-pass-a-global-reference-date-to-rules-tp4022057p4022082.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] Can get "not equal" (!=) to work but not "equal" (==) in LHS

2013-02-05 Thread Davide Sottara
Are you setting the focus on the agenda group appropriately?
Remember that, with lock-on-active, you'll also have to TOGGLE the focus

I tested the rules on 5.5.1-snapshot and everything seems to work,
which version are you using?
Davide

On 02/05/2013 09:50 AM, BenjaminWolfe wrote:
> Background: I’m a business user.  Dev wrote the fact model and the initial
> rule set.  I can’t configure the fact model, the agenda groups, or the java
> code that fires the rules.  I can change the rules within the .drl file.  My
> question has to do with those rules.
>
> The application is run as a web service.  Each call has just one Autopolicy
> in its own stateless session.  An Autopolicy has one or more Vehicles, and a
> Vehicle has one or more Package of insurance coverages.  Autopolicy objects
> come in with a random float (RandomGenId) between 0 and 1.  Based on that
> random float we assign the object to an experiment group (RuleFlowId).
> Based on the experiment group we then set the value of the packages.  (See
> the code below.)
>
> Below, rules 0A and 0B work when I use ruleFlowId != “test” and ruleFlowId
> !=“control” respectively, but they don’t work with the much more
> straightforward approach of ruleFlowId == “control” and ruleFlowId == “test”
> (respectively).  Does anybody have an idea why?
>
> Thank you!
>
> ---
>
> rule "control group"
> agenda-group "Rules-Recommendation"
> salience 98
> no-loop true
> lock-on-active true
> dialect "mvel"
>   when
>   $autoPolicy : Autopolicy(randomGenId<  0.5)
>   then
>   modify($autoPolicy) {setRuleFlowId("control")};   // Default 
> ruleFlowId is
> “1”
>   logger.debug("control group set");
>   end
>
> rule "test group"
> agenda-group "Rules-Recommendation"
> salience 97
> no-loop true
> lock-on-active true
> dialect "mvel"
>   when
>   $autoPolicy : Autopolicy(randomGenId>= 0.5)
>   then
>   modify($autoPolicy) {setRuleFlowId("test")};   // Default 
> ruleFlowId is
> “1”
>   logger.debug("test group set");
>   end
>
> rule "Rule 0A: Set Packages for Control Group"
> agenda-group "Rules-Recommendation"
> no-loop true
> lock-on-active true
> dialect "mvel"
>   when
>   $autoPolicy : Autopolicy(ruleFlowId != "test")
>   $vehicles : Vehicles()
>   $packages : Packages()
>   $vehicle : Vehicle() from $vehicles.Vehicle
>   then
>   // set $packages
>   logger.debug("Rule 0A fired");
>   end
>
> rule "Rule 0B: Set Packages for Test Group"
> agenda-group "Rules-Recommendation"
> no-loop true
> lock-on-active true
> dialect "mvel"
>   when
>   $autoPolicy : Autopolicy(ruleFlowId != "control")
>   $vehicles : Vehicles()
>   $packages : Packages()
>   $vehicle : Vehicle() from $vehicles.Vehicle
>   then
>   // set $packages
>   logger.debug("Rule 0B fired");
>   end
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Can-get-not-equal-to-work-but-not-equal-in-LHS-tp4022074.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] Can get "not equal" (!=) to work but not "equal" (==) in LHS

2013-02-05 Thread Stephen Masters
Okay … well, without seeing what's been inserted as an Autopolicy in the first 
place, I reckon the best plan is to debug it. It's probably worth changing to 
something like this:

when 
$autoPolicy : Autopolicy($ruleFlowId: ruleFlowId)
then
logger.debug("Rule flow ID = " + $ruleFlowId);
end

That should show you what value is held in the Autopolicy ruleFlowId property.

If you're comparing using != then the value could be just about anything. It 
could be a String with a value other than "test" or "control". It could also be 
null or a non-String object. When you use == "test", then you are saying that 
the value must be a String with the value "test".

Steve


On 5 Feb 2013, at 17:21, Stephen Masters  wrote:

> Going by the example provided, the code is a constraint on the left hand side 
> … so it's valid to use == or !=. It's not Java code, it's MVEL and is 
> automatically converted to use the appropriate .equals("") method on the Java 
> objects.
> 
> You would only need to use .equals("") inside an eval or in Java code on the 
> RHS.
> 
> So the answer is something else … but I haven't worked out what yet. :)
> 
> Steve
> 
> 
> On 5 Feb 2013, at 17:11, rjr201  wrote:
> 
>> It may be because in Java you have to compare strings using .equals("");
>> 
>> So in your case it would be: 
>> 
>> ruleFlowId.equals("test") == true
>> 
>> It's because Strings are objects, and ==  tests to see if the String is
>> literally the same object as the other String, not just a String with the
>> same value. != works because they aren't the same object.
>> 
>> Hope that works,
>> Rich. 
>> 
>> 
>> 
>> --
>> View this message in context: 
>> http://drools.46999.n3.nabble.com/Can-get-not-equal-to-work-but-not-equal-in-LHS-tp4022074p4022076.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] Can get "not equal" (!=) to work but not "equal" (==) in LHS

2013-02-05 Thread Stephen Masters
Going by the example provided, the code is a constraint on the left hand side … 
so it's valid to use == or !=. It's not Java code, it's MVEL and is 
automatically converted to use the appropriate .equals("") method on the Java 
objects.

You would only need to use .equals("") inside an eval or in Java code on the 
RHS.

So the answer is something else … but I haven't worked out what yet. :)

Steve


On 5 Feb 2013, at 17:11, rjr201  wrote:

> It may be because in Java you have to compare strings using .equals("");
> 
> So in your case it would be: 
> 
> ruleFlowId.equals("test") == true
> 
> It's because Strings are objects, and ==  tests to see if the String is
> literally the same object as the other String, not just a String with the
> same value. != works because they aren't the same object.
> 
> Hope that works,
> Rich. 
> 
> 
> 
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Can-get-not-equal-to-work-but-not-equal-in-LHS-tp4022074p4022076.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] Can get "not equal" (!=) to work but not "equal" (==) in LHS

2013-02-05 Thread rjr201
It may be because in Java you have to compare strings using .equals("");

So in your case it would be: 

ruleFlowId.equals("test") == true

It's because Strings are objects, and ==  tests to see if the String is
literally the same object as the other String, not just a String with the
same value. != works because they aren't the same object.

Hope that works,
Rich. 



--
View this message in context: 
http://drools.46999.n3.nabble.com/Can-get-not-equal-to-work-but-not-equal-in-LHS-tp4022074p4022076.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] Found solution vs actual optimum [planner]

2013-02-05 Thread Geoffrey De Smet

Op 05-02-13 17:24, john poole schreef:
> Better than other algorithms is what I'm after.
>
> The output from the sample data sets is excellent. So easy to scan through
> and understand all the results immediately. Anyone that hasn't used it
> should give it a try.
Thanks for the kind words :)
>
>   I'm running the benchmarker on my inputs and rules now. I'm just using the
> Nurse Rostering example with different inputs and a few more rules, but it's
> been taking me around 6 hours to get the score I expect.
That's long indeed. Could be the difficulty of your dataset. Or could be 
the performance of your score rules.
What's your average calculate count per second (see log or benchmarker 
report).
It should be 2 000 - 10 000 at least.
>
> I'm also using planner to try and show cases where an acceptable solution
> can't be found, and I'll be more confident knowing I'm tried all the
> methods.
>
> Thanks.

>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Found-solution-vs-actual-optimum-tp4022027p4022073.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] Found solution vs actual optimum [planner]

2013-02-05 Thread john poole
Better than other algorithms is what I'm after.

The output from the sample data sets is excellent. So easy to scan through
and understand all the results immediately. Anyone that hasn't used it
should give it a try.

 I'm running the benchmarker on my inputs and rules now. I'm just using the
Nurse Rostering example with different inputs and a few more rules, but it's
been taking me around 6 hours to get the score I expect.

I'm also using planner to try and show cases where an acceptable solution
can't be found, and I'll be more confident knowing I'm tried all the
methods.

Thanks.



--
View this message in context: 
http://drools.46999.n3.nabble.com/Found-solution-vs-actual-optimum-tp4022027p4022073.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] Ruleflow not working with stateless session in drools-server 5.5.0.Final

2013-02-05 Thread tslonaker
I found a much easier way to recreate the problem described in my previous
post.  I believe I have also found the root cause of the problem.  Below are
the steps to recreate the issue: 

- Create a simple ruleflow and rules and compile them into a rule package.
- In code create a stateless session
- In a loop
o Create a fact
o Create a new execution batch with the following commands
- Insert the fact from above
- Start Process 
- Fire All Rules
- Get Objects
o Execute the batch
o Check the results (number of rules that ran)

I posted before that the problem didn’t happen while executing locally (not
in drools server).  I didn’t realize this before, but adding a loop that
executes the rules multiple times with the same session recreates the
problem.  

Below is code that will recreate the issue.  Notice that the code below
creates one instance of ksession and reuses it in the loop.  

//Setup
KnowledgeBuilder kbuilder = 
KnowledgeBuilderFactory.newKnowledgeBuilder();

//The package includes the ruleflow
kbuilder.add( ResourceFactory.newFileResource(
("YourRulePackage_WithRuleflow.pkg") ), ResourceType.PKG );
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );

*   //Create the stateless knowledge session outside the for loop
StatelessKnowledgeSession ksession = 
kbase.newStatelessKnowledgeSession();*

//Loop through executing the rules with the same data 3 times
for (int x = 0; x < 3; x++)
{
//Create a new instance of the input fact 
FactType inputDataType = 
kbase.getFactType("SimpleRuleflowTest", 
"Input");
Object inputData = inputDataType.newInstance();
inputDataType.set(inputData, "Name", "Test data");

//Create a new instance of the command list
List cmds = new ArrayList();
cmds.add( CommandFactory.newInsert( inputData ));
cmds.add( CommandFactory.newStartProcess( "TestRuleflow"));
cmds.add( CommandFactory.newFireAllRules("rules"));
cmds.add( CommandFactory.newGetObjects("output"));  
  

//Execute the rules
ExecutionResults results = ksession.execute(
CommandFactory.newBatchExecution( cmds ) );

//Get the number of rules that ran
Object rules = results.getValue("rules");
System.out.println("Rules that ran:  " + rules.toString());
}



Each iteration through the loop should fire 3 rules.  Running the code above
you should get the following output:

   Rules that ran:  3
   Rules that ran:  1
   Rules that ran:  1
 

I spent several hours researching the drools source code and I believe I
have found the problem.  What I have found is related to  Issue 2718
  .  
Check out the change made for this issue:   2718 fix

 
.  

Below is a snippet from the code that was modified for issue 2718.  The “if
(!initialized)” block was added.  The code loops through event listeners on
the wm object and adds them to the stateless session’s listeners.  This
works fine for the first rule execution.  But the next rule execution
creates a new instance for wm.  Therefore it also creates new instances of
listeners for wm.  So we have a new instance of wm and the stateless session
is pointing to the old listeners from the first instance of wm.  I believe
that is why it only runs correctly one time. It seems that that the “if
(!initialized)” block of code needs to execute every time newWorkingMemory()
is called.  

public StatefulKnowledgeSession newWorkingMemory() {
:
:
ReteooWorkingMemory wm = new ReteooWorkingMemory(
this.ruleBase.nextWorkingMemoryCounter(),

  this.ruleBase,

  (SessionConfiguration) this.conf,

  this.environment );
:
:
*if (!initialized) {*
// copy over the default generated listeners that are 
used for internal
stuff once
for (org.drools.event.AgendaEventListener listener:
wm.getAgendaEventSupport().getEventListeners()) {

this.agend

Re: [rules-users] How to import query or class in .drl to another .drl

2013-02-05 Thread mdzaebel
Hi,

may be set "/Allow cross references in DRL files/" in Eclipse Drools
Preferences.

Marc



--
View this message in context: 
http://drools.46999.n3.nabble.com/How-to-import-query-or-class-in-drl-to-another-drl-tp4022069p4022070.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] Extending declared imported type

2013-02-05 Thread mdzaebel
/Hi,/

I just tested the following documented .drl example:

*import org.people.Person
declare Person end
declare Student extends Person end* / // this line leads to NPE /
...

Any tip appreciated.

See also issue  DROOLS-27   .

/Thanks, Marc/




--
View this message in context: 
http://drools.46999.n3.nabble.com/Extending-declared-imported-type-tp4022068.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] How to pass a "global" reference date to rules

2013-02-05 Thread pdario
Moreover, it seems getSessionClock is for Statefull sessions only, but I'm
working with Stateless ones.



--
View this message in context: 
http://drools.46999.n3.nabble.com/How-to-pass-a-global-reference-date-to-rules-tp4022057p4022067.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] How to pass a "global" reference date to rules

2013-02-05 Thread pdario
I see, I'll have a look at the classes you mention.

But what if I need to calculate a time difference from today to another date
(say "order expire date")?
Would a "new Date()" in the rules give me the "pseudo" time?

Thank you!



--
View this message in context: 
http://drools.46999.n3.nabble.com/How-to-pass-a-global-reference-date-to-rules-tp4022057p4022066.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, 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 

Re: [rules-users] How to pass a "global" reference date to rules

2013-02-05 Thread Wolfgang Laun
You can run your session with a pseudo-clock, advanced to the point in
time that corresponds to your reference date.


KnowledgeSessionConfiguration config =
   KnowledgeBaseFactory.newKnowledgeSessionConfiguration();
config.setOption(ClockTypeOption.get("pseudo"));

StatefulKnowledgeSession session =
   knowledgeBase.newStatefulKnowledgeSession(config, null);
SessionPseudoClock clock = session.getSessionClock();
// session clock := NOW
clock.advanceTime( (new java.util.Date()).getTime(), TimeUnit.MILLISECONDS );

// session clock := TOMORROW
clock.advanceTime(1, TimeUnit.DAYS);

This rule would fire, today being the 5-Feb-2013.
rule test
date-effective "6-Feb-2013"
date-expires   "7-Feb-2013"
when
$i: Integer()
then
System.out.println( "Integer " + $i );
end


On 05/02/2013, pdario  wrote:
> Hello, I need to have my rules reason with a reference date different than
> today (so I can't use the rule attributes "date-effective",
> "date-expires").
>
> I declared a global java.utile.Date, I set it in Java, but I cannot reason
> on it...
> I don't want to put in each rule a generic Date fact.
>
> What do you suggest to solve this?
>
> Thank you!
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/How-to-pass-a-global-reference-date-to-rules-tp4022057.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: 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 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
>>

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
>>        
>>
>>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

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?

  

you're set at 1k minimalAcceptedSelection, so 50k is a
l

[rules-users] BRL rule parsing

2013-02-05 Thread arup
Hi,

is there any API using which we can create BRL in XML format  and POST using
REST API and vice versa, i.e an API that can parse the BRL and show it
without any XML tags.



--
View this message in context: 
http://drools.46999.n3.nabble.com/BRL-rule-parsing-tp4022060.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
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] How to pass a "global" reference date to rules

2013-02-05 Thread pdario
Hello, I need to have my rules reason with a reference date different than
today (so I can't use the rule attributes "date-effective", "date-expires").

I declared a global java.utile.Date, I set it in Java, but I cannot reason
on it...
I don't want to put in each rule a generic Date fact.

What do you suggest to solve this?

Thank you!



--
View this message in context: 
http://drools.46999.n3.nabble.com/How-to-pass-a-global-reference-date-to-rules-tp4022057.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] Found solution vs actual optimum [planner]

2013-02-05 Thread Geoffrey De Smet

Op 05-02-13 04:25, john poole schreef:
> Thanks. If the "Best score over time" line doesn't flatline, does that mean
> it needs more time or that the configuration isn't ever going to produce a
> good solution?
Define "good" solution :)
- Close to optimal: impossible to know the optimal for most realistic 
problems (and extrapolating quality from easier, smaller problems is broken)
- Better than other algorithms: that's why planner has the benchmarker.

My advice is to use the benchmarker and configure different algo's (see 
the examples *SolverBenchmark.xml) and a distinct set of datasets.
Then a bad solution should stick out like a sore thumb in the benchmark 
report.

>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Found-solution-vs-actual-optimum-tp4022027p4022053.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: 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