Re: [rules-users] Using java to score solutions in drools planner

2012-01-31 Thread Geoffrey De Smet

Op 30-01-12 21:22, babsher schreef:
  From what I have read in the user documentation the DRL format is just one
 way to score a solution.
   I already have a java library that will develop
 scores for my domain.

 Is there a way to skip creating rules and use the existing code I have? Is
 it as simple as just overriding the getScore function in my solution class?
Currently, out-of-the-box, DRL is the only way, but there's been more 
and more demand of providing a plain old java alternative.
Here's the issue: https://issues.jboss.org/browse/JBRULES-3367 
(watch/vote if it's important to you)

It's not that hard to hack it:
- Overwrite SolutionDescriptor and return a dummy WorkingMemory in 
SolutionDescriptor.getWorkingMemory().
- Call your java code in SolutionDescriptor.calculateScore().

Make sure you understand the concept of delta score calculation, the 
main reason why DRL as score calculation is a good idea:
   
http://docs.jboss.org/drools/release/5.4.0.Beta1/drools-planner-docs/html_single/index.html#deltaBasedScoreCalculation
Not doing delta's kills scalability.

 Thanks,
 Bryan

 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Using-java-to-score-solutions-in-drools-planner-tp3701137p3701137.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


-- 
With kind regards,
Geoffrey De Smet


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


Re: [rules-users] [planner] Where do I code the calculation for a derieved property of the planning entity?

2012-01-31 Thread Geoffrey De Smet


Op 31-01-12 07:51, aitchnyu schreef:
 I am making a 2X2 sudoku game, modeled after Nqueens example. A `Digit` class
 is assigned a `column` and `row` object. The `row` is the planning entity.

 But a sudoku game also has a `block`, which is to be calculated from `row`
 and `column`. Two digits cannot share a block. A block is null when the row
 is null, and a numerical value that will be equal for all digits in the row.

 Question: where do I tell the `Digit` object to recalculate it's `block`?
Don't.
A move just changes the value of a Digit: it's up to the score rules to 
use score rules to calculate the effect to the Block.

you could do a score rule like this:

when
   Digit($v : value, $b: block, $id)
   Digit(value == $v, block == $b, id  $id)
then
   // the value $v twice in the same block
   I
 did it in doMove, but it is misses most places the object is updated (as per
 my attempts at logging). Must I set it to update itself when the `row`
 property of the object changes, say at `setRow()`?

 A 2X2 sudoku: http://mypuzzle.org/sudoku/kid.html

  private integer block;
  ...
  public Integer getBlock(){
   return block;
  }
  public void setBlock(int not_used){
   if(this.row==null)
   this.block=null;
   else
   this.block=10*(this.row.getIndex()/2)+this.column.getIndex()/2;
  }

 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Where-do-I-code-the-calculation-for-a-derieved-property-of-the-planning-entity-tp3702411p3702411.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


-- 
With kind regards,
Geoffrey De Smet


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


Re: [rules-users] Accumulate function, events and stream processing

2012-01-31 Thread juankera
Thanks for your help.

This sentence is working properly (i've tried it out of this rule) and
count(1) doesn't give me anything.

when
Number( $total : doubleValue ) from accumulate(
StateEvent(itemName==Temperatura, $val : newState) over
window:length( 5 ),
count ( 1 ))
then

Always returning 0.0, with every fact i put in the working memory.

Any idea?



--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-Accumulate-function-events-and-stream-processing-tp3700577p3702702.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] Accumulate function, events and stream processing

2012-01-31 Thread Wolfgang Laun
If count() returns 0 then you don't have any matching StateEvent facts
in Working Memory.

- Do you enter via an entry point?

- Does a rule using
  StateEvent(itemName==Temperatura)
  fire?

-W

On 31/01/2012, juankera juank...@gmail.com wrote:
 Thanks for your help.

 This sentence is working properly (i've tried it out of this rule) and
 count(1) doesn't give me anything.

 when
   Number( $total : doubleValue ) from accumulate(
 StateEvent(itemName==Temperatura, $val : newState) over
 window:length( 5 ),
 count ( 1 ))
 then

 Always returning 0.0, with every fact i put in the working memory.

 Any idea?



 --
 View this message in context:
 http://drools.46999.n3.nabble.com/rules-users-Accumulate-function-events-and-stream-processing-tp3700577p3702702.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] Comparisions

2012-01-31 Thread bathakaraithangam
Hi,
  Please to tell what is the difference between update and modify method
in drools?

--
View this message in context: 
http://drools.46999.n3.nabble.com/Comparisions-tp3702956p3702956.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] Guvnor Global Area Usage Restirictions

2012-01-31 Thread Jervis Liu
On 2012/1/28 7:00, domingo wrote:
 I imported some pakages into Guvnor and I want to put it into Global Area.
 The following are my observation...
 1. Import action create new package into *'Packages' *section do not have
 option like want to put *Global Area* or *Packages*.
 2. After import into Packages I want to move the packages to Global Area but
 package level is not possible.
Hi, the global area itself is actually a special package whose assets 
can be shared among packages. The idea is to encourage users to reuse 
common assets across packages. Thus I do not see it is a valid case to 
import packages into the Global area or move packages into the global area.
 3. To move my  rules files into Global area..I have to open the individual
 rules then only Edit menu shows the Promote to Global option.

 If I have 20 or 30 rules in the package I have to the same thing 30 times.
 It is very timetaking and think not good idea. what happen If have 30
 packages and each package having 30 rules.
Yes, a bulk promote function will be helpful. Please raise a jira for 
this. Thanks. As a side note, I doubt you will run into a scenario where 
you need to promote 30X30 assets to the Global area. Please remember, 
the Global area should only contain assets that are designed to shared 
among all packages.

Cheers,
Jervis

 I am not sure I am using *Guvnor5.3* effectively or not. *In the
 documentation(Guvnor5.3) I noticed two lines only about the Global
 area.*Please some one can guide me.

 -
 with kind regards,

 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Guvnor-Global-Area-Usage-Restirictions-tp3694809p3694809.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] Comparisions

2012-01-31 Thread Wolfgang Laun
The Expert manual, in the section on The Right Hand Side (then)
discusses both the modify statement and the update() method call. If
you still have doubts after reading this, email again.
-W


On 31/01/2012, bathakaraithangam bathaka...@gmail.com wrote:
 Hi,
   Please to tell what is the difference between update and modify method
 in drools?

 --
 View this message in context:
 http://drools.46999.n3.nabble.com/Comparisions-tp3702956p3702956.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] DSL for multiple 'OR'

2012-01-31 Thread Michael Anstis
Hi,

Starting from 5.4.0.beta2 you can use BRL fragments in decision tables.

This will allow you to define a column like this:-

$c : Cucumber()
Cucumber( this == $c, numberOfWormHoles  {@holes} )
Cucumber( this == $c, curvaturePerLengthUnit  {@curvature} )
Cucumber( this == $c, hue  {@minHue} ||  {@maxHue} )

You will then be presented with columns for each of the variables ({@XXX}
in the above).

If you do not specify *all* values for a pattern the pattern will not be
included in the generated rules. For example:-

@holes=0, @curvature=empty, @minHue=90, @maxHue=150 would generate:-

$c : Cucumber()
Cucumber( this == $c, numberOfWormHoles  0 )
Cucumber( this == $c, hue  90 ||  150 )

You could equally define multiple BRL fragment columns like this:-

Column 1 - $c : Cucumber()
Column 2 - Cucumber( this == $c, numberOfWormHoles  {@holes} )
Column 3 - Cucumber( this == $c, curvaturePerLengthUnit  {@curvature} )
Column 4 - Cucumber( this == $c, hue  {@minHue} ||  {@maxHue} )

Resulting in the same operation.

The || requirement makes using a decision table pre-5.4.0.beta2 impossible,
however if you could re-think your logic to use 's it is possible but
messier.

With kind regards,

Mike

2012/1/30 Stephen Masters stephen.mast...@me.com

 Hi folks,

 I'm trying to create a DSL (to drive a Guvnor guided editor), for which a
 rule could be written as:
 Given a cucumber
 - containing one or more worm holes
 - or with a curvature greater than 10mm per 10 cm length
 - or with a hue of less than 90 degrees
 - or with a hue of greater than 150 degrees
 Do not put that cucumber on the supermarket shelf

 (note: I'm actually developing a banking risk management system looking at
 different types of counterparty ratings, rather than a fruitveg quality
 control system, but hopefully the above example is more readable!)

 Is there a decent metaphor that could be used by a business user in Guvnor
 to manage such rules in one place? Or is it likely to be necessary to
 create multiple rules?

 As far as I understand, every condition added to a rule through such DSLRs
 adds itself to the filter. i.e. They are AND rather than OR.

 The other metaphor I could think of is the decision table as a neat
 interface for generating multiple rules, but that seems to be geared
 towards creating rules based on multiple values of a single attribute
 rather than multiple conditions.

 I'm trying to keep the user interface as simple as possible, so any
 thoughts would be appreciated.

 Cheers,

 Steve


 ___
 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] Adventures example

2012-01-31 Thread tomschut
Hi, 

I've been trying to get the drools examples from the 5.3 final zip to work,
but I seem to be stuck on the adventures example, the one I'm trying to
understand because of the use of the query syntax. 

All other examples work, but as for Adventures eclipse reports errors on
importing declarations and analyzing expressions in e.g. Commands.drl.

When I run the examples from command line or even eclipse it does compile
and run the adventures example, so the problem seems to be related to the
plugin.

Thanks,

Tom Schut

--
View this message in context: 
http://drools.46999.n3.nabble.com/Adventures-example-tp3703045p3703045.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] DSL for multiple 'OR'

2012-01-31 Thread Stephen Masters
Hi Mike,I watched your blog/video about the BRL fragment functionality in decision tables (http://blog.athico.com/2012/01/guided-decision-table-supports-brl.html) a few weeks back. It sounds like it provides some of the template capabilities I remember from working with Fico Blaze Adviser a little while back. I was wondering why I was struggling to reproduce it, butI guess I need to wait for 5.4 to go live as I don't think using a beta version would be a great idea here!I think that for now I'll opt for multiple rules, as there *should* not be too many. With some sensible use of categories and work items, hopefully I can keep the interface clean enough for now.However I reckon I'll have a go at running up a 5.4.0.beta2 environment to try this out. I'd like to see whether I can take advantage of it to improve things ready for an update when things go final.Thanks for the pointers.SteveOn Jan 31, 2012, at 12:00 PM, Michael Anstis michael.ans...@gmail.com wrote:Hi,Starting from 5.4.0.beta2 you can use BRL fragments in decision tables.This will allow you to define a column like this:-$c : Cucumber()Cucumber( this == $c, numberOfWormHoles  {@holes} ) Cucumber( this == $c, curvaturePerLengthUnit  {@curvature} )Cucumber( this == $c, hue  {@minHue} ||  {@maxHue} )You will then be presented with columns for each of the "variables" ({@XXX} in the above). If you do not specify *all* values for a pattern the pattern will not be included in the generated rules. For example:-@holes=0, @curvature=empty, @minHue=90, @maxHue=150 would generate:-$c : Cucumber() Cucumber( this == $c, numberOfWormHoles  0 ) Cucumber( this == $c, hue  90 ||  150 ) You could equally define multiple BRL fragment columns like this:- Column 1 - $c : Cucumber() Column 2 - Cucumber( this == $c, numberOfWormHoles  {@holes} ) Column 3 - Cucumber( this == $c, curvaturePerLengthUnit  {@curvature} ) Column 4 - Cucumber( this == $c, hue  {@minHue} ||  {@maxHue} ) Resulting in the same operation.The || requirement makes using a decision table pre-5.4.0.beta2 impossible, however if you could re-think your logic to use 's it is possible but messier. With kind regards,Mike2012/1/30 Stephen Masters stephen.mast...@me.comHi folks,I'm trying to create a DSL (to drive a Guvnor guided editor), for which a rule could be written as:Given a cucumber- containing one or more worm holes- or with a curvature greater than 10mm per 10 cm length- or with a hue of less than 90 degrees- or with a hue of greater than 150 degreesDo not put that cucumber on the supermarket shelf(note: I'm actually developing a banking risk management system looking at different types of counterparty ratings, rather than a fruitveg quality control system, but hopefully the above example is more readable!)Is there a decent metaphor that could be used by a business user in Guvnor to manage such rules in one place? Or is it likely to be necessary to create multiple rules?As far as I understand, every condition added to a rule through such DSLRs adds itself to the filter. i.e. They are AND rather than OR.The other metaphor I could think of is thedecision table as a neat interface for generating multiple rules, but that seems to be geared towards creating rules based on multiple values of a single attribute rather than multiple conditions.I'm trying to keep the user interface as simple as possible, so any thoughts would be appreciated.Cheers,Steve___ 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] How to use the xls file as decision table?

2012-01-31 Thread ponmanirajan
I create an xls file as follows,

http://drools.46999.n3.nabble.com/file/n3703234/xlsData.jpg 

how to use this decision table in drools eclipse plugin?

thanks in advance.

--
View this message in context: 
http://drools.46999.n3.nabble.com/How-to-use-the-xls-file-as-decision-table-tp3703234p3703234.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] Accumulate function, events and stream processing

2012-01-31 Thread juankera
So no entry-point (using default) is OK.

I've declared this Fact as event, like this:

declare StateEvent
@role( event )
end


And I have changed a property in drools.default.rulebase.conf
(drools.eventProcessingMode = STREAM) to make the engine works in stream
mode.

I'm opening a stateful session too (newStatefulKnowledgeSession();)

Is that ok? 
May i set stream mode in code like config.setOption(
EventProcessingOption.STREAM );?
May i use any specific clock type?

Thanks





--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-Accumulate-function-events-and-stream-processing-tp3700577p3703245.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] Comparisions

2012-01-31 Thread bathakaraithangam
Thank u Laune..

--
View this message in context: 
http://drools.46999.n3.nabble.com/Comparisions-tp3702956p3703271.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] Comparisions

2012-01-31 Thread bathakaraithangam
Thank you Laune. Now it's clear.

--
View this message in context: 
http://drools.46999.n3.nabble.com/Comparisions-tp3702956p3703279.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] Accumulate function, events and stream processing

2012-01-31 Thread Wolfgang Laun
On 31/01/2012, juankera juank...@gmail.com wrote:
 So no entry-point (using default) is OK.

 I've declared this Fact as event, like this:

 declare StateEvent
   @role( event )
 end

OK - another thing excluded.




 And I have changed a property in drools.default.rulebase.conf
 (drools.eventProcessingMode = STREAM) to make the engine works in stream
 mode.

 I'm opening a stateful session too (newStatefulKnowledgeSession();)

 Is that ok?
 May i set stream mode in code like config.setOption(
 EventProcessingOption.STREAM );?

The property setting looks OK, but who knows. Try and use this:

KnowledgeBaseConfiguration config =
KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
config.setOption( EventProcessingOption.STREAM );
... kSession = newStatelessKnowledgeSession(config);

 May i use any specific clock type?

window:length should not depend on the clock.

If all of this fails, you'll have to provide a complete minimum
example demonstrating the problem, and which Drools version you are
using.

-W



 Thanks

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


[rules-users] Drools 5.3 DSL Or conditions

2012-01-31 Thread gboro54
I am just curious if there is a way to use the - appending format for
appending OR conditions to an object. For example:

There exist object a
   -where property1 is Value1
   -or where property2 is Value2


This would equate to the drl:

Object(property1==Value1 || property2==Value2)

Is this possible or a trick to get something similar? Worst case I can just
separate to two individual rules.

--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-5-3-DSL-Or-conditions-tp3703338p3703338.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 use the xls file as decision table?

2012-01-31 Thread Swindells, Thomas
Write a java program that loads and use the spreadsheet - in the same way that 
you use would do so for a DRL file.
The eclipse plugin is just an environment to help development and testing, it 
doesn't actually run anything -
Afterall having rules is just half the picture, you also need to insert facts.

Thomas

 -Original Message-
 From: rules-users-boun...@lists.jboss.org [mailto:rules-users-
 boun...@lists.jboss.org] On Behalf Of ponmanirajan
 Sent: 31 January 2012 13:16
 To: rules-users@lists.jboss.org
 Subject: [rules-users] How to use the xls file as decision table?

 I create an xls file as follows,

 http://drools.46999.n3.nabble.com/file/n3703234/xlsData.jpg

 how to use this decision table in drools eclipse plugin?

 thanks in advance.

 --
 View this message in context: http://drools.46999.n3.nabble.com/How-to-use-
 the-xls-file-as-decision-table-tp3703234p3703234.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


**
This message is confidential and intended only for the addressee. If you have 
received this message in error, please immediately notify the 
postmas...@nds.com and delete it from your system as well as any copies. The 
content of e-mails as well as traffic data may be monitored by NDS for 
employment and security purposes. To protect the environment please do not 
print this e-mail unless necessary.

NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, 
United Kingdom. A company registered in England and Wales. Registered no. 
3080780. VAT no. GB 603 8808 40-00
**

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


Re: [rules-users] How to use the xls file as decision table?

2012-01-31 Thread ponmanirajan
Please check this code, Edit and reply me.

package com.sample;

import java.io.StringReader;
import org.drools.KnowledgeBase;
import org.drools.KnowledgeBaseFactory;
import org.drools.builder.DecisionTableConfiguration;
import org.drools.builder.DecisionTableInputType;
import org.drools.builder.KnowledgeBuilder;
import org.drools.builder.KnowledgeBuilderError;
import org.drools.builder.KnowledgeBuilderErrors;
import org.drools.builder.KnowledgeBuilderFactory;
import org.drools.builder.ResourceType;
import org.drools.compiler.PackageBuilder;
import org.drools.io.Resource;
import org.drools.io.ResourceFactory;
import org.drools.logger.KnowledgeRuntimeLogger;
import org.drools.logger.KnowledgeRuntimeLoggerFactory;
import org.drools.rule.Package;
import org.drools.runtime.StatefulKnowledgeSession;
import org.drools.decisiontable.ExternalSpreadsheetCompiler;
import org.drools.decisiontable.InputType;
import org.drools.decisiontable.SpreadsheetCompiler;


public class DecisionTable {

public static void main(String[] args) {
try {
// load up the knowledge base
KnowledgeBase kbase = createKnowledgeBaseFromSpreadsheet();
StatefulKnowledgeSession ksession =
kbase.newStatefulKnowledgeSession();
KnowledgeRuntimeLogger logger =
KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, test);
// go !
   Person p=new Person();
   p.setAge(23);
   p.setName(ponmani);
   ksession.insert(p);
   
ksession.fireAllRules();
logger.close();
} catch (Throwable t) {
t.printStackTrace();
}
}

public static KnowledgeBase createKnowledgeBaseFromSpreadsheet() throws
Exception {


DecisionTableConfiguration dtconf
=KnowledgeBuilderFactory.newDecisionTableConfiguration();
dtconf.setInputType( DecisionTableInputType.XLS );
dtconf.setWorksheetName(Sheet1);

KnowledgeBuilder kbuilder = 
KnowledgeBuilderFactory.newKnowledgeBuilder();
Resource r = ResourceFactory.newUrlResource(
file:///D://Auto_Gen_Rules//data.xls);

System.out.println(XLS ResouceBuilder...); 
kbuilder.add(r, ResourceType.DTABLE, dtconf);
System.out.println(Loaded Resource File..);

if (kbuilder.hasErrors()) {
throw new RuntimeException(kbuilder.getErrors().toString());
}
KnowledgeBase knowledgeBase = KnowledgeBaseFactory.newKnowledgeBase();
knowledgeBase.addKnowledgePackages(kbuilder.getKnowledgePackages());
return knowledgeBase;
}

public static class Person {
private String name;
private int age;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
}

}


--
View this message in context: 
http://drools.46999.n3.nabble.com/How-to-use-the-xls-file-as-decision-table-tp3703234p3703544.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] Accumulate function, events and stream processing

2012-01-31 Thread juankera
Tried, but won't work. 

Ok, step by step.

1- DRL File

Event declared, FirstRule won't work and SecondRule is working properly
(neither count or sum)

declare StateEvent
@role( event )
end

rule FirstRule

when
Number( $total : doubleValue ) from accumulate(
StateEvent(itemName==Temperatura, $val : newState) over
window:length( 5 ),
count ( 1 ))
then
System.out.println( + $total);
end

rule SecondRule 

when
StateEvent(itemName==Temperatura, $val : newState)
then
System.out.println( +
((DecimalType)$val).toBigDecimal().doubleValue());
end

2. Important lines from Engine starting (notice that i'm using stateful
session)

KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();

kbuilder.add(ResourceFactory.newClassPathResource(RULES_CHANGESET,
getClass()), ResourceType.CHANGE_SET);

KnowledgeBaseConfiguration kbaseConfig =
KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
kbaseConfig.setOption( EventProcessingOption.STREAM );  
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(kbaseConfig);

StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();

3. Attached you can find the full code 
http://drools.46999.n3.nabble.com/file/n3703619/RuleService.java
RuleService.java 

4. Environment

Drools 5.3.0 FINAL, running on a OSGi environment.





--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-Accumulate-function-events-and-stream-processing-tp3700577p3703619.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] Why is solving a partial puzzle much slower than generating one from scratch?

2012-01-31 Thread aitchnyu
I am making a 3x3 Sudoku solver with Drools planner. The planning entities
are the digits. The problem facts are the rows (planning variable) and
columns.

When I set Drools Planner to solve a problem where no digit is initialized,
it gives a perfect solution in ~15 secs. But when I set a few digits as
initialized, it never finds a solution.  It always lists 8 hard constraints
broken on termination.

I implemented the moves as:

if(digit.getFixed()==false){
moveList.add(new RowChangeMove(digit, toRow));
}
If the digit is fixed, dont make a move object for it.

Earlier, I implemented it in isMoveDoable: if the digit.getFixed() is true,
it returns false. Both do not work.

20:31:13.442 [main] INFO  o.d.p.c.l.DefaultLocalSearchSolverPhase - Phase
local search finished: step total (978), time spend (60061), best score
(-8).
20:31:13.442 [main] INFO  o.d.p.core.solver.DefaultSolver - Solved: time
spend (60061), best score (-8), average calculate count per second (7433).


--
View this message in context: 
http://drools.46999.n3.nabble.com/Why-is-solving-a-partial-puzzle-much-slower-than-generating-one-from-scratch-tp3703622p3703622.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] Why is solving a partial puzzle much slower than generating one from scratch?

2012-01-31 Thread Geoffrey De Smet


Op 31-01-12 16:12, aitchnyu schreef:
 I am making a 3x3 Sudoku solver with Drools planner. The planning entities
 are the digits. The problem facts are the rows (planning variable) and
 columns.

 When I set Drools Planner to solve a problem where no digit is initialized,
 it gives a perfect solution in ~15 secs. But when I set a few digits as
 initialized, it never finds a solution.  It always lists 8 hard constraints
 broken on termination.

 I implemented the moves as:

 if(digit.getFixed()==false){
  moveList.add(new RowChangeMove(digit, toRow));
Presuming that your 3x3 looks like this

row1, col1 | row1, col2 | row 1 col3
row2, col1 | row2, col2 | row 2 col3
row3, col1 | row3, col2 | row 3 col3

So when digit 4 starts on row1, col1
it can only move to row2, col1 and row3, col1
but never any of the 6 other points in col2 and col3?
 }
 If the digit is fixed, dont make a move object for it.

 Earlier, I implemented it in isMoveDoable: if the digit.getFixed() is true,
 it returns false. Both do not work.

 20:31:13.442 [main] INFO  o.d.p.c.l.DefaultLocalSearchSolverPhase - Phase
 local search finished: step total (978), time spend (60061), best score
 (-8).
 20:31:13.442 [main] INFO  o.d.p.core.solver.DefaultSolver - Solved: time
 spend (60061), best score (-8), average calculate count per second (7433).


 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Why-is-solving-a-partial-puzzle-much-slower-than-generating-one-from-scratch-tp3703622p3703622.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


-- 
With kind regards,
Geoffrey De Smet


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


Re: [rules-users] Accumulate function, events and stream processing

2012-01-31 Thread Philipp Herzig
Have you ever tried out to insert the events into the
WorkingMemoryEntryPoint EventStream directly that you have commented out
in your execute method?
and read the window from that eventstream in your rule, that is,
window:length( 5 ) from entry-point EvenStream.

Of course, the second rule will fire also if it would be no event but a
simple fact for drools.
Unfortunately, I do not know under which condition the default entrypoint
is populated.

2012/1/31 juankera juank...@gmail.com

 Tried, but won't work.

 Ok, step by step.

 1- DRL File

 Event declared, FirstRule won't work and SecondRule is working properly
 (neither count or sum)

 declare StateEvent
@role( event )
 end

 rule FirstRule

 when
Number( $total : doubleValue ) from accumulate(
StateEvent(itemName==Temperatura, $val : newState) over
 window:length( 5 ),
count ( 1 ))
 then
System.out.println( + $total);
 end

 rule SecondRule 

 when
StateEvent(itemName==Temperatura, $val : newState)
 then
System.out.println( +
 ((DecimalType)$val).toBigDecimal().doubleValue());
 end

 2. Important lines from Engine starting (notice that i'm using stateful
 session)

 KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();

 kbuilder.add(ResourceFactory.newClassPathResource(RULES_CHANGESET,
 getClass()), ResourceType.CHANGE_SET);

 KnowledgeBaseConfiguration kbaseConfig =
 KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
 kbaseConfig.setOption( EventProcessingOption.STREAM );
 KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(kbaseConfig);

 StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();

 3. Attached you can find the full code
 http://drools.46999.n3.nabble.com/file/n3703619/RuleService.java
 RuleService.java

 4. Environment

 Drools 5.3.0 FINAL, running on a OSGi environment.





 --
 View this message in context:
 http://drools.46999.n3.nabble.com/rules-users-Accumulate-function-events-and-stream-processing-tp3700577p3703619.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




-- 

Philipp Herzig, M.Sc.

Mail: pher...@googlemail.com
Cell: 0178 - 6156244
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Accumulate function, events and stream processing

2012-01-31 Thread Wolfgang Laun
Well, I can't reproduce the failure of FirstRule to fire - both
rules fire after the insertion of a single event. Of course, I use a
simplified scenario, and there are only these two rules in my
knowledge base.

Using 5.3.0 final; not OSGi, but I don't see how this should matter.

Check the
   RULES_CHANGESET = org/openhab/core/drools/changeset.xml;
Does it really refer to one DRL with just these two rules?

-W



On 31/01/2012, Philipp Herzig pher...@googlemail.com wrote:
 Have you ever tried out to insert the events into the
 WorkingMemoryEntryPoint EventStream directly that you have commented out
 in your execute method?
 and read the window from that eventstream in your rule, that is,
 window:length( 5 ) from entry-point EvenStream.

 Of course, the second rule will fire also if it would be no event but a
 simple fact for drools.
 Unfortunately, I do not know under which condition the default entrypoint
 is populated.

 2012/1/31 juankera juank...@gmail.com

 Tried, but won't work.

 Ok, step by step.

 1- DRL File

 Event declared, FirstRule won't work and SecondRule is working properly
 (neither count or sum)

 declare StateEvent
@role( event )
 end

 rule FirstRule

 when
Number( $total : doubleValue ) from accumulate(
StateEvent(itemName==Temperatura, $val : newState) over
 window:length( 5 ),
count ( 1 ))
 then
System.out.println( + $total);
 end

 rule SecondRule 

 when
StateEvent(itemName==Temperatura, $val : newState)
 then
System.out.println( +
 ((DecimalType)$val).toBigDecimal().doubleValue());
 end

 2. Important lines from Engine starting (notice that i'm using stateful
 session)

 KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();

 kbuilder.add(ResourceFactory.newClassPathResource(RULES_CHANGESET,
 getClass()), ResourceType.CHANGE_SET);

 KnowledgeBaseConfiguration kbaseConfig =
 KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
 kbaseConfig.setOption( EventProcessingOption.STREAM );
 KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(kbaseConfig);

 StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();

 3. Attached you can find the full code
 http://drools.46999.n3.nabble.com/file/n3703619/RuleService.java
 RuleService.java

 4. Environment

 Drools 5.3.0 FINAL, running on a OSGi environment.





 --
 View this message in context:
 http://drools.46999.n3.nabble.com/rules-users-Accumulate-function-events-and-stream-processing-tp3700577p3703619.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




 --
 
 Philipp Herzig, M.Sc.

 Mail: pher...@googlemail.com
 Cell: 0178 - 6156244

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


Re: [rules-users] Accumulate function, events and stream processing

2012-01-31 Thread juankera
Yes, i have only one DRL with these two rules defined.

I have actually these resources:

 resource source='file:configurations/drools/drl/' type='DRL' /
  resource source='file:configurations/drools/xls/' type=DTABLE 
 decisiontable-conf input-type=XLS worksheet-name=Tables/
  /resource

But only a DRL file. Anyway, i've also tried without Decision Tables and
only one specific DRL File, with no luck.

I will try again with entry-points, as Philipp suggests



--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-Accumulate-function-events-and-stream-processing-tp3700577p3703977.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] Accumulate function, events and stream processing

2012-01-31 Thread juankera

laune wrote
 
 Well, I can't reproduce the failure of FirstRule to fire - both
 rules fire after the insertion of a single event. 
 

Sorry, i don't understand what you mean. 

Are you able to put the accumulate function to work?

--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-Accumulate-function-events-and-stream-processing-tp3700577p3703998.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] Adventures example

2012-01-31 Thread Mark Proctor
On 31/01/2012 17:35, tomschut wrote:
 Hi,

 I've been trying to get the drools examples from the 5.3 final zip to work,
 but I seem to be stuck on the adventures example, the one I'm trying to
 understand because of the use of the query syntax.

 All other examples work, but as for Adventures eclipse reports errors on
 importing declarations and analyzing expressions in e.g. Commands.drl.

 When I run the examples from command line or even eclipse it does compile
 and run the adventures example, so the problem seems to be related to the
 plugin.
The eclipse plugin cannot handle dependencies across drl files, because 
it does not know about the ordering. Mario is trying to fix this at the 
moment, we hope it'll be fixed for 5.4 final.

All you can do for now is ignore the eclipse plugin errors.

Btw if you like the text adventure game, checkout the wumpus world I'm 
working on at the moment.

Mark

 Thanks,

 Tom Schut

 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Adventures-example-tp3703045p3703045.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] Activation Firing slow on many events with timer attribute in rule (Drools Fusion)

2012-01-31 Thread Mark Proctor
Every transaction boundary is a full working memory snapshot, it is not 
recommended for wm's with large number of facts or timers when high 
performance is needed.

Mark
On 31/01/2012 00:20, Philipp Herzig wrote:
 Thanks Wolfgang for testing.

 Well I found something. I am using the JPAKnowledgeService and when
 inserting the bunch of events within a JTA (with BTM) the discussed
 behavior occurs.
 If I am removing the JPA stuff it performs as expected.

 Well, of course, now my question is, how are the events are persisted
 when is timer is present and fetched (lazy, eager?) once the timer
 expires? Unfortunately, I would need session persistence because the
 timers can be long and need to be recreated after an outage.

 Thanks again for your time :)

 Philipp

 2012/1/30 Wolfgang Launwolfgang.l...@gmail.com:
 Hmm, I'm using 5.3.0 and I can't confirm your slow results.

 -W


 On 30/01/2012, Philipp Herzigpher...@googlemail.com  wrote:
 Thanks again,

 yes I call fireAllRules() after insertion.

 My understanding is that the join on mrid reduces the search space
 (actually 2000) (actually canceled du to not) and the remainder can be
 processed as leftover from the outer join.

 Anyhow, when I remove the not join clause the behavior is exactly the
 same.

 (1)  8000 create events are inserted and objects are asserted and
 activations created!
 (2) after 20s the activations are actually fired, but with a
 noticeable delay (30min)

 Now, when I simply remove the timer, all 8000 activations are fired
 super fast (5s !!!)

 Or am I overlooking sth?

 Thanks for your patience,

 Philipp


 2012/1/30 Wolfgang Launwolfgang.l...@gmail.com:

 On 30 January 2012 17:18, Philipp Herzigpher...@googlemail.com  wrote:
 Thanks Wolfgang for your reply.

 doSomething simply persists something with JPA, no events are
 retracted or updated. The behavior does also not change when there is
 a simple println in the then clause.

 OK.


 I thought events are automatically retracted once no rule applied
 anymore.  The EventObject class with the map is used only for
 abstraction within the architecture (actually a property pattern). No
 intention to speed up something.

 There's no information in the (only) rule that would permit an automatic
 retraction.
 Mostly this is possible when temporal operators are used.

 Searching for EventObject/create without matching EventObject/delete is
 causing a lot of work, since each insertion requires an exhaustive linear
 search for the absence of a delete or the presence of a create.

 What do you call after the bunch insert? fireAllRules() ?

 -W


 As I said, the activation firing works fine when no timer is present
 and, of course, deletes are already inserted before the creates,
 otherwise the rule won't fire.


 Do you know how the Scheduler works? According to the observed
 behavior I would guess that there is a background job invoked every
 100ms checking if there are timer delayed activations which has to be
 fired.
 If this is the case, I wonder why only some activations are fired and
 not all. Due to the upper time bound?

 Thanks again,

 Philipp


 2012/1/30 Wolfgang Launwolfgang.l...@gmail.com:
 Does the doSomething() update or retract any EventObject facts and
 notify
 the Drools engine accordingly?

 (So far: Neither using the same class for the create and the delete
 events nor
 using a map (i.e., data) for all properties is helping w.r.t. speed.)

 -W


 On 30 January 2012 15:07, Philipp Herzigpher...@googlemail.com
 wrote:
 Sure, here it is. Sorry for any inconvienience!

 rule new_intent
 timer (20s)
 when
   $evt : EventObject(data['type']=='create') from entry-point
 eventstream
   not ( EventObject(data['type']=='delete',
 data['mrid']==$evt.data['mrid'], data['userid']==$evt.data['userid'])
 from entry-point eventstream)
 then
   SomeAPI.getInstance().doSomething();
 end


 Thank you,

 Philipp




 2012/1/30 Michael Anstismichael.ans...@gmail.com
 It's going to help (probably) if you include the definition of your
 rule
 (or rules).

 2012/1/30 Philipp Herzigpher...@googlemail.com
 Dear Community,

 Drools is pretty fast regarding all my use cases. However, today I
 have
 found a problem where I cannot find any solution. Hopefully someone
 of you
 can help.

 1. I have a rule with a @timer(10s) attribute (should be 24h later
 on
 but doesn't matter). This rule is activated when a create event
 occurs and
 invalidated once a delete event occurs within the timeframe of
 @timer.

 2. I have approx. 9000 create events which are bulk loaded into
 the
 working memory and creating activations for the rule above.

 3. I have approx. 2000 delete events which are bulk loaded into
 my
 entry-point cancelling the respective activations from step (2)

 4. After the timer expired, the first activation is fired
 correctly.
 However, all other activations are fired with some noticeable delay
 (actually it needs 20-30minutes until all activations are fired).


 Do you have an 

[rules-users] Eclipse plugin autocomplete

2012-01-31 Thread Paul Ryan
I appears autocomplete was removed in the last couple of months from the drools 
eclipse plugin (when the plugin was transitioned to jboss tools). This was a 
feature I know my team used heavily was there a reason this was summarily 
removed as it was working fine (reference the thread attached).

http://drools.46999.n3.nabble.com/PackageDescr-getFactTemplates-td2922550.html

Thanks,

-- Paul Ryan

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


[rules-users] Guvnor logo change

2012-01-31 Thread domingo
Hi,
with reference to the following user forum link...

http://drools.46999.n3.nabble.com/Adding-a-custom-logo-to-Drools-Guvnor-td3503516.html

Can I change the Guvnor logo...I am using 5.3...what I learned from the
earlier versions we can customise the logo, but the info from the above link
is bit confusing...

link rel=shortcut icon href=images/drools.gif type=image/gif /
link rel=icon href=images/drools.gif type=image/gif /


I tried by replacing the drools.gif but I still see the drools image..new
image is not pdated...

If any one already did this ...please share your experince with us...

Thanks,


-
with kind regards,

--
View this message in context: 
http://drools.46999.n3.nabble.com/Guvnor-logo-change-tp3704675p3704675.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] Guvnor logo change

2012-01-31 Thread Michael Anstis
It's not entirely clear is it ;)

On review the header section is defined in
PerspectivesPanelViewImpl.ui.xml.

This shows the logo as images/header_logo.gif. If you modify file
/org.drools.guvnor.Guvnor/images/header_logo.gif in your WAR you should be
OK.

With kind regards,

Mike

On 31 January 2012 21:15, domingo sprabak...@gmail.com wrote:

 Hi,
 with reference to the following user forum link...


 http://drools.46999.n3.nabble.com/Adding-a-custom-logo-to-Drools-Guvnor-td3503516.html

 Can I change the Guvnor logo...I am using 5.3...what I learned from the
 earlier versions we can customise the logo, but the info from the above
 link
 is bit confusing...

 link rel=shortcut icon href=images/drools.gif type=image/gif /
 link rel=icon href=images/drools.gif type=image/gif /


 I tried by replacing the drools.gif but I still see the drools image..new
 image is not pdated...

 If any one already did this ...please share your experince with us...

 Thanks,


 -
 with kind regards,

 --
 View this message in context:
 http://drools.46999.n3.nabble.com/Guvnor-logo-change-tp3704675p3704675.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] Unable to start guvnor with no initial repository

2012-01-31 Thread arup
Hi all,

I'm running my Guvnor 5.2 on WAS 6.1. But after deploying the war file when
i'm trying to hit the guvnor link i'm getting the following errors:

[2/1/12 12:41:04:483 IST] 0028 SystemOut O ERROR 01-02 12:41:04,483
(LoggingHelper.java:error:69)Service method 'public abstract
java.lang.String[]
org.drools.guvnor.client.rpc.RepositoryService.listStates() throws
com.google.gwt.user.client.rpc.SerializationException' threw an unexpected
exception: java.lang.IllegalStateException: java.lang.NullPointerException
java.lang.IllegalStateException: java.lang.NullPointerException
at
org.drools.guvnor.server.util.TestEnvironmentSessionHelper.getSession(TestEnvironmentSessionHelper.java:113)
at
org.drools.guvnor.server.RepositoryServiceServlet.getService(RepositoryServiceServlet.java:69)
at
org.drools.guvnor.server.RepositoryServiceServlet.listStates(RepositoryServiceServlet.java:630)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)
at 
com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:569)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
at
com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at
com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1095)
at
com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:569)
at
com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
at
com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:90)
at
com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:748)
at
com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1461)
at
com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:118)
at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:458)
at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:387)
at
com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:102)
at
com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at
com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at
com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:195)
at
com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:743)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:873)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1473)
Caused by: 
java.lang.NullPointerException
at
org.drools.guvnor.server.util.TestEnvironmentSessionHelper.getSession(TestEnvironmentSessionHelper.java:75)
... 30 more
[2/1/12 12:41:04:483 IST] 0021 SystemOut O ERROR 01-02 12:41:04,483
(LoggingHelper.java:error:69)Service method 'public abstract
java.lang.String[]
org.drools.guvnor.client.rpc.CategoryService.loadChildCategories(java.lang.String)'
threw an unexpected exception: java.lang.IllegalStateException:
java.lang.NullPointerException
java.lang.IllegalStateException: java.lang.NullPointerException
at
org.drools.guvnor.server.util.TestEnvironmentSessionHelper.getSession(TestEnvironmentSessionHelper.java:113)
at
org.drools.guvnor.server.RepositoryServiceServlet.getCategoryService(RepositoryServiceServlet.java:120)
at
org.drools.guvnor.server.RepositoryServiceServlet.loadChildCategories(RepositoryServiceServlet.java:188)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)
at 
com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:569)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)
at

Re: [rules-users] Why is solving a partial puzzle much slower than generating one from scratch?

2012-01-31 Thread aitchnyu
Sorry if I called it by a misleading name (3x3) . It means a regular sudoku
like http://www.sudoku-solutions.com/ .

And I hacked on NQueens to make it. Only the row is the planning entity.
Each digit has a value, row, column and a fixed status. A fixed digit has
row, column and value assigned and fixed status set to true (you must not
reassign row of this). An unsolved digit has a null row, with column and
value assigned and fixed status set to false.

I included three cases. It solves a completely blank grid, it doesnt solve a
24-digit problem (it gets stuck at a step, see included log snippet), it
solves an easier 8-digit version of same problem in *much longer time*.

*Case*: Output of solving a completely blank grid
12:42:33.977 [main] INFO  o.d.p.c.l.DefaultLocalSearchSolverPhase - Phase
local search finished: step total (148), time spend (5491), best score (0).
12:42:33.977 [main] INFO  o.d.p.core.solver.DefaultSolver - Solved: time
spend (5491), best score (0), average calculate count per second (17598).
 
*Case*: solving problem 1: 24 digits of
http://puzzles.about.com/library/sudoku/blprsudokux01.htm 
12:51:34.279 [main] DEBUG o.d.p.c.l.DefaultLocalSearchSolverPhase - Step
index (10530), time spend (164914), score (-3), best score (-3),
accepted move size (456) for picked step (Digit:4 (Row 5,Column 2) block
code[10]  = Row 3)

It gets *stuck* here forever.
12:59:31.398 [main] DEBUG o.d.p.c.l.DefaultLocalSearchSolverPhase - Step
index (4265), time spend (74003), score (-3), best score (-3), accepted
move size (520) for picked step (Digit:7 (Row 5,Column 7) block code[12]  =
Row 3).
12:59:31.429 [main] DEBUG o.d.p.c.l.DefaultLocalSearchSolverPhase - Step
index (4266), time spend (74034), score (-3), best score (-3), accepted
move size (520) for picked step (Digit:7 (Row 3,Column 4) block code[11]  =
Row 5).
12:59:31.444 [main] DEBUG o.d.p.c.l.DefaultLocalSearchSolverPhase - Step
index (4267), time spend (74049), score (-3), best score (-3), accepted
move size (520) for picked step (Digit:7 (Row 5,Column 4) block code[11]  =
Row 3).
12:59:31.459 [main] DEBUG o.d.p.c.l.DefaultLocalSearchSolverPhase - Step
index (4268), time spend (74064), score (-3), best score (-3), accepted
move size (520) for picked step (Digit:7 (Row 3,Column 7) block code[12]  =
Row 5).
12:59:31.474 [main] DEBUG o.d.p.c.l.DefaultLocalSearchSolverPhase - Step
index (4269), time spend (74079), score (-3), best score (-3), accepted
move size (520) for picked step (Digit:7 (Row 5,Column 7) block code[12]  =
Row 3).
12:59:31.493 [main] DEBUG o.d.p.c.l.DefaultLocalSearchSolverPhase - Step
index (4270), time spend (74098), score (-3), best score (-3), accepted
move size (520) for picked step (Digit:7 (Row 3,Column 4) block code[11]  =
Row 5).
12:59:31.508 [main] DEBUG o.d.p.c.l.DefaultLocalSearchSolverPhase - Step
index (4271), time spend (74113), score (-3), best score (-3), accepted
move size (520) for picked step (Digit:7 (Row 5,Column 4) block code[11]  =
Row 3).


*Case*: reducing predefined digits down to 6
13:02:31.093 [main] INFO  o.d.p.c.l.DefaultLocalSearchSolverPhase - Phase
local search finished: step total (554), time spend (12849), best score (0).
13:02:31.094 [main] INFO  o.d.p.core.solver.DefaultSolver - Solved: time
spend (12850), best score (0), average calculate count per second (25229)


--
View this message in context: 
http://drools.46999.n3.nabble.com/Why-is-solving-a-partial-puzzle-much-slower-than-generating-one-from-scratch-tp3703622p3705805.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