[rules-users] Facing Problem with this exception

2014-03-04 Thread Mallikarjun Kohalli (mkohalli)
Hi All,
We are getting the following exceptions when drools is executing some rules.

Exception:

Caused by: java.lang.NullPointerException
at 
org.drools.core.util.LeftTupleIndexHashTable.remove(LeftTupleIndexHashTable.java:251)
at org.drools.reteoo.NotNode.retractLeftTuple(NotNode.java:226)
at 
org.drools.reteoo.SingleLeftTupleSinkAdapter.doPropagateRetractLeftTuple(SingleLeftTupleSinkAdapter.java:217)
at 
org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateRetractRightTuple(SingleLeftTupleSinkAdapter.java:124)
at org.drools.reteoo.JoinNode.retractRightTuple(JoinNode.java:151)
at 
org.drools.reteoo.ObjectTypeNode.retractObject(ObjectTypeNode.java:232)
at 
org.drools.reteoo.ReteooWorkingMemory$WorkingMemoryReteExpireAction.execute(ReteooWorkingMemory.java:412)
at 
org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:1471)
... 51 more



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

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

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

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


On 05-03-14 08:11, Nadim wrote:
> ge0ffrey wrote
>> Sounds weird to me.
>> It's sounds like you're assigning the pigeon holes to the pigeons,
>> instead of assigning the pigeons to the pigeon holes.
>> [...]
>> @PlanningEntity
>> class SessionAttendance {
>>  Session session;
>>  @PlanningVariable boolean attending;
>> }
>>
>> Based on that, your start and end times can be calculated.
>> Either in the score calculation itself (insertLogicals etc like in nurse
>> rostering)
>> Or with shadow variables (like in vehicle routing and project job
>> scheduling)
>> http://blog.athico.com/2013/06/shadow-variables-planningvariablelisten.html
>> Shadow variables is probably more efficient.
> Exactly why I asked...there's a certain art to framing the problem in a way
> that makes it work well with the engine.  I tried restructuring the problem
> the other way around...I hadn't thought of calculating the windows on the
> fly, but it does make a lot of sense.  The engine now seems to be giving
> much better answers faster.  I'm still just determining the windows directly
> in the score calculation, but now that it looks like it's functioning
> better, I'll explore more efficient approaches like shadow variables or
> using rules-based calculation.
>
> I still haven't found the construction phase to be of any use...it seems to
> just end right away with an initial solution of "all sessions off", but
> maybe I just need to play with the configuration file some.
>
> Lots to learn, but looks like a powerful and flexible tool framework.
> Thanks again for the suggestion!
>
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/OptaPlanner-best-strategy-for-variable-number-of-planning-entities-tp4028470p4028513.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>


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


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

2014-03-04 Thread Nadim
ge0ffrey wrote
> Sounds weird to me.
> It's sounds like you're assigning the pigeon holes to the pigeons,
> instead of assigning the pigeons to the pigeon holes.
> [...]
> @PlanningEntity
> class SessionAttendance {
> Session session;
> @PlanningVariable boolean attending;
> }
> 
> Based on that, your start and end times can be calculated.
> Either in the score calculation itself (insertLogicals etc like in nurse 
> rostering)
> Or with shadow variables (like in vehicle routing and project job 
> scheduling)
> http://blog.athico.com/2013/06/shadow-variables-planningvariablelisten.html
> Shadow variables is probably more efficient.

Exactly why I asked...there's a certain art to framing the problem in a way
that makes it work well with the engine.  I tried restructuring the problem
the other way around...I hadn't thought of calculating the windows on the
fly, but it does make a lot of sense.  The engine now seems to be giving
much better answers faster.  I'm still just determining the windows directly
in the score calculation, but now that it looks like it's functioning
better, I'll explore more efficient approaches like shadow variables or
using rules-based calculation.

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

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




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


Re: [rules-users] I give up, where is drools:execution-node defined??

2014-03-04 Thread scarlettxu
You can change to use 



--
View this message in context: 
http://drools.46999.n3.nabble.com/I-give-up-where-is-drools-execution-node-defined-tp3583659p4028511.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] 6.0.1.F How to use @role and @expires with DSL

2014-03-04 Thread SrjTx
I searched the forum and found some stuff from 2010 related to this - but no
final answer, but was wondering if this has been added to 6.0.1.F

I want to put 

declare Foo
@role(event)
@expires( 5m )
end

into a Guided Rule - what is the proper way to do this?







--
View this message in context: 
http://drools.46999.n3.nabble.com/6-0-1-F-How-to-use-role-and-expires-with-DSL-tp4028510.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] Some basic questions/assumptions on Drools Work-bench/Guvnor

2014-03-04 Thread mattmadhavan
Hello,
I have some basic questions on the Drools workbench. Can some one please
validate my assumptions?

1) Drools workbench/Guvnor is not a replacement for Eclipse.
2) Geeks like me develop the applications in Eclipse
3) Drools workbench will be mainly used by the Rule authors (Business
Analysts etc) once I set it up for them.
4) The anslysts will author the rules and test it in the workbench.
5) They will build the DRLs into a jar  and I include it as a dependency in
my POM.xml.

How close am I to these assumptions?

Thanks
Matt'M




--
View this message in context: 
http://drools.46999.n3.nabble.com/Some-basic-questions-assumptions-on-Drools-Work-bench-Guvnor-tp4028509.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 6.0.1 Workbench - How to import existing drl files?

2014-03-04 Thread mattmadhavan
Hi Manstis,
Thank very much for your reply! Please bear with me if I repeat my self with
my questions.

This is the scenario! 
* We are moving away from a custom rule engine to Drools
* We are converting the existing rules to .drl using a parser
* I have an standard eclipse project which I am using to test the rules by
loading bunch of facts (Stateless Session) from the Database. All looking
good.

Now I want to set up the Drools-workbench so that my analysts can take over
and start adding new rules and test them.

I am new to  drools/Guvnor/Workbench. But i have mastered the standard .DRL
syntax, have written my own custom operator (Which I am going to share
because its really useful for others too) and the project is working great.
I am really strong with Maven but with Git kind'a newbie.

I have gone thro' the docs and able to create a Project, import my model
jars and related jars.  Now I want to import the DRL file from my eclipse
project, set it up and test the individual rules.

I do not really understand your second point!

*2) In order to manipulate a project outside of the workbench (I.e. add your
rule files) you will need to clone it with the ssh protocol. The workbench
will display the url in the Administration perspective. *

Could you please elaborate how do I suck the .drl file from my eclipse
project to the Drools Wrokbench ?

Thanks
Matt'M




--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-6-0-1-Workbench-How-to-import-existing-drl-files-tp4028495p4028508.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] Workbench on tomcat

2014-03-04 Thread john poole
I'm sure I'm being dense, but I can't reconcile the readme instructions with
the file I see in the workbench app:

1. Copy kie-tomcat-integration jar into TOMCAT_HOME/lib
*Where is this file?

2. Copy jacc lib into TOMCAT_HOME/lib (javax.security.jacc-api in jboss
maven repository)
*What is the file name for "jacc lib" and where is it?

3. Add valve configuration into TOMCAT_HOME/conf/server.xml inside Host
element as last valve definition

4. Edit TOMCAT_HOME/conf/tomcat-users.xml to include roles and users, make
sure there will be 'analyst' or 'admin' roles defined as it's required to be
authorized to use kie-wb
5. Edit web.xml and uncomment all entries that are marked with
TOMCAT-JEE-SECURITY
*There are no entries marked with TOMCAT-JEE-SECURITY in that file.

6. Rename org.uberfire.security.auth.AuthenticationSource to
org.uberfire.security.auth.AuthenticationSource-ORIGIN and
rename  org.uberfire.security.auth.AuthenticationSource-TOMCAT-JEE-SECURITY
to org.uberfire.security.auth.AuthenticationSource
inside WEB-INF/classes/META-INF/services
*There isn't an "uberfire" folder under the "org" folder there.




--
View this message in context: 
http://drools.46999.n3.nabble.com/Workbench-on-tomcat-tp4028507.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] 6.0.1.F EXTENDS in Guided Rule Editor does not work

2014-03-04 Thread SrjTx
Any time I have tried to create a new RDSLR and select an [Extends] class I
get:

Unable to resolve parent rule, please check that both rules are in the
same package

The are both certainly in the same package.

I am trying to extend from a DRL, should that matter?





--
View this message in context: 
http://drools.46999.n3.nabble.com/6-0-1-F-EXTENDS-in-Guided-Rule-Editor-does-not-work-tp4028506.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 6.0.1 Workbench - How to import existing drl files?

2014-03-04 Thread Michael Anstis
1) When you upload a JAR to the workbench's maven repository you will be
prompted for Group ID, Artifact ID and version; as required by maven, if
the JAR does not already have a pom.

2) In order to manipulate a project outside of the workbench (I.e. add your
rule files) you will need to clone it with the ssh protocol. The workbench
will display the url in the Administration perspective.

3) If you downloaded the drools workbench distribution from the drools
download page it contains a zip with examples.

Drools workbench 6.0 is based upon maven standards and a git repository. If
you are unfamiliar with these please read up on them.

I would also urge you to run the workbench, read the user guide and
familiarise yourself with its operation.

Sent on the move
On 4 Mar 2014 22:24, "mattmadhavan"  wrote:

> Hi Alexandre,
> Could you please elaborate on couple of points below or point me to the rt
> documentation?
>
> * What do you mean by "*prompt for GAV info* " ?
> * What do you mean by  "*clone using ssh git, add your rules*" ?
> * Where can I get the demo?
>
> Thanks
> Matt'M
>
>
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Drools-6-0-1-Workbench-How-to-import-existing-drl-files-tp4028495p4028503.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 template declaration in kmodule.xml

2014-03-04 Thread david.berkman
Is there any way to declare a drools template (*.drt) and its data files (in
tab delimited or csv or whatever) in a kmodule.xml for publication via
Maven? I realize I can use the Workbench to create a 'similar' web template
and deploy that as a consumable .jar file, but I get the impression that
this web template is not quite the same as a drools template, and if I
publish like that and disassemble the resulting jar, that the kmodule.xml
present there (if there is one), would not reverse engineer and be
applicable to my .drt + .csv files I'm currently loading programmatically.
And although programmatic loading works, it's not available to monitoring by
a KieScanner, and of dynamically loading any changes thereby. I can create
my own monitoring and reloading system, but I'd rather not be reinventing
the wheel.

All help appreciated,

Thanks,
David



--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-template-declaration-in-kmodule-xml-tp4028504.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 6.0.1 Workbench - How to import existing drl files?

2014-03-04 Thread mattmadhavan
Hi Alexandre,
Could you please elaborate on couple of points below or point me to the rt
documentation?

* What do you mean by "*prompt for GAV info* " ?
* What do you mean by  "*clone using ssh git, add your rules*" ?
* Where can I get the demo?

Thanks
Matt'M





--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-6-0-1-Workbench-How-to-import-existing-drl-files-tp4028495p4028503.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 6.0.1 Workbench - How to import existing drl files?

2014-03-04 Thread Alexandre Porcelli
Hi Matt,

 So you'll have to create a new repo and create a new project (check docs). If 
your dependencies are already mavenized, add those dependencies to your 
project, if not... you can upload your jars (check docs) and Workbench will 
prompt for GAV info for each lib.

 After that you can clone using ssh git, add your rules (that should be places 
in proper resource folder - in doubt checkout demo), and push your changes 
back. After that you'll have your project with your project setup as expected.

 (regarding custom operators, sorry I don't have such experience)

Regards,
--- 
Alexandre Porcelli
Principal Software Engineer 
Red Hat Business Systems and Intelligence Group

On Mar 4, 2014, at 3:42 PM, mattmadhavan  wrote:

> HI Alexandre,
> Sorry to say I do not have anything set up. I have a .drl file with about 60
> rules and couple of Jar file off my Eclipse.
> 
> I want to import the drl file and the jars into the work bench inside a
> project. I want to set it up such that the analysts can write additional
> rules and be able to document and test the rules within the workbench.
> 
> Any ideas please?
> 
> And have you had any luck in testing your own custom operators with in the
> Work bench?
> 
> Thanks in advance!
> Matt'M
> 
> 
> 
> 
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Drools-6-0-1-Workbench-How-to-import-existing-drl-files-tp4028495p4028497.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users



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


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

2014-03-04 Thread moltenice
Hi ge0ffrey,

You response actually partially solved my problem :)

I completely removed my own clone/equals/hashCode implementations and the
planner seemed to get results much faster as well as being efficient
(FIT_FIRST actually reduced the score down very well).

I still had the problem of the latest solution showing up and finally after
trying everything possible to understand it I decided to take the ugly path:
storing the best solution myself in the calculator class. This obviously
works but I can't help but feel wrong after doing so :P

In any case, I have posted my working (albeit a horrible Software
Engineering) example as an attachment for anyone in the future stumped and
looking for a dirty solution.

Thanks once again ge0ffrey for your timely and helpful responses! :)

Karan

Timetabler.zip
  



--
View this message in context: 
http://drools.46999.n3.nabble.com/Best-Solution-found-but-latest-solution-does-not-work-tp4028442p4028501.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 - Custom operator problem (Not finding it)

2014-03-04 Thread mattmadhavan
Hi Davide,
Sorry but any idea or point me to the rt direction on how to add custom
operator in Guvnor?

Thanks
Matt'M



--
View this message in context: 
http://drools.46999.n3.nabble.com/Guvnor-Custom-operator-problem-Not-finding-it-tp4028490p4028500.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 - Custom operator problem (Not finding it)

2014-03-04 Thread Davide Sottara
Evaluators are typically registered in the packagebuilder.conf file,
or passed to the packagebuilder. Did you do something equivalent in guvnor?


On 03/04/2014 05:46 PM, mattmadhavan wrote:
> Hello,
> I have written a custom operator called "inlist" and it works great in 5.4.0
> (not in 5.6.0).
>
> When I import the rules to Guvnor my rule validation fails with the
> following error:
>
> /[Administration and Timing of RT - Date RT started unknown, assumed started
> more than 365 days of diagnosis] Unable to determine the Evaluator for ID
> '*inlist*'/
>
> Any ideas please?
>
> Thanks
> Matt
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Guvnor-Custom-operator-problem-Not-finding-it-tp4028490.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] ArrayIndexOutOfBoundsException under high events load in drools CEP

2014-03-04 Thread Davide Sottara
Thanks, we'll look into this as soon as possible!!
Davide

On 03/04/2014 06:46 PM, ters wrote:
> Davide Sottara wrote
>> However, the *deadlock* situation might have exposed a bug.
>> Could you please submit a self-contained reproducer?
> Davide, I've posted on forum new  topic with complete example and
> description
> 
>   
> Hope it helps anyone of us.
>
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/ArrayIndexOutOfBoundsException-under-high-events-load-in-drools-CEP-tp4028071p4028494.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>

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


Re: [rules-users] Drools 6.0.1 Workbench - How to import existing drl files?

2014-03-04 Thread mattmadhavan
HI Alexandre,
Sorry to say I do not have anything set up. I have a .drl file with about 60
rules and couple of Jar file off my Eclipse.

I want to import the drl file and the jars into the work bench inside a
project. I want to set it up such that the analysts can write additional
rules and be able to document and test the rules within the workbench.

Any ideas please?

And have you had any luck in testing your own custom operators with in the
Work bench?

Thanks in advance!
Matt'M




--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-6-0-1-Workbench-How-to-import-existing-drl-files-tp4028495p4028497.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 6.0.1 Workbench - How to import existing drl files?

2014-03-04 Thread Alexandre Porcelli
I understand import means that you already have a repository and a project 
setup inside Workbench, right?

If so.. the simplest solution would be using external ssh based git access to 
the repository, place files in the proper place, commit and them push. 
Workbench will be automatically notified of your new files and your project 
explorer will have all your new files.

Regards,
--- 
Alexandre Porcelli
Principal Software Engineer 
Red Hat Business Systems and Intelligence Group

On Mar 4, 2014, at 2:54 PM, mattmadhavan  wrote:

> Hiell,
> I want to import existing drl files with about 60 rules to drools
> work-bench. Not sure how to do it. I went through the manula but am not
> clear how to do it.
> 
> Any ideas please?
> 
> Also can some one point me to some additional documentaion?
> 
> Thanks
> Matt
> 
> 
> 
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Drools-6-0-1-Workbench-How-to-import-existing-drl-files-tp4028495.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 6.0.1 Workbench - How to import existing drl files?

2014-03-04 Thread mattmadhavan
Hiell,
I want to import existing drl files with about 60 rules to drools
work-bench. Not sure how to do it. I went through the manula but am not
clear how to do it.

Any ideas please?

Also can some one point me to some additional documentaion?

Thanks
Matt



--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-6-0-1-Workbench-How-to-import-existing-drl-files-tp4028495.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] ArrayIndexOutOfBoundsException under high events load in drools CEP

2014-03-04 Thread ters
Davide Sottara wrote
> However, the *deadlock* situation might have exposed a bug.
> Could you please submit a self-contained reproducer?

Davide, I've posted on forum new  topic with complete example and
description

  
Hope it helps anyone of us.




--
View this message in context: 
http://drools.46999.n3.nabble.com/ArrayIndexOutOfBoundsException-under-high-events-load-in-drools-CEP-tp4028071p4028494.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Drools 6.0.1 CEP stucks during marshaling in fireUntilHalt mode

2014-03-04 Thread ters
Hi drools experts.
We use drools fusion complex event processor (CEP). After migration from
5.4.0 to 6.0.1 I encountered a problem - CEP stucks during marshaling in
fireUntilHalt mode. Below self-contained reproducer.

/*Event class:*
/public class Test1 {
private Date timestamp;
private String id;
}/

/*Rule drl:*
/package bpmn;
import com.test.event.*;
dialect "mvel"

declare BusinessProcessName
name : String;
end
declare com.test.event.Test1
@role( event )
end

rule "Insert Business Process Name"
salience 10
when
not BusinessProcessName(name == "SomeName")
then
System.out.println("Insert Business Process Name");
insert(new BusinessProcessName("SomeName"));
end

rule "Start event1"
when
   $event1 : Test1()
then
   System.out.println("Start event1 fired.");
end/

/*Test with whole initialization*
/public class TestDrools6CEPDeadLock implements RuleRuntimeEventListener {
private KieSession ksession;
private Marshaller marshaller;

@Test
public void test1() throws Exception {
initSession();
runFireUntilHaltThread();

System.out.println("-= 1 =-");
ksession.insert(new Test1());

System.out.println("-= 2 =-");
ksession.insert(new Test1());
}

private void runFireUntilHaltThread() {
new Thread(new Runnable() {
public void run() {
ksession.fireUntilHalt();
}
}).start();
}

private void initSession() {
KnowledgeBuilder kbuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder();
   
kbuilder.add(ResourceFactory.newClassPathResource("TestDrools6CEPDeadLock.drl"),
ResourceType.DRL);
if (kbuilder.hasErrors())  throw new RuntimeException("Unable to
compile drl\".");
KieBaseConfiguration config =
KieServices.Factory.get().newKieBaseConfiguration();
config.setOption(EventProcessingOption.STREAM);
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(config);
kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
ksession = kbase.newKieSession();

ksession.addEventListener((RuleRuntimeEventListener) this);

marshaller = MarshallerFactory.newMarshaller(kbase);
}

@Override
public void objectInserted(ObjectInsertedEvent event) {
   
System.out.println("--objectInserted---");
marshallSession();
}
@Override
public void objectUpdated(ObjectUpdatedEvent event) {
   
System.out.println("--objectUpdated---");
marshallSession();
}
@Override
public void objectDeleted(ObjectDeletedEvent event) {
   
System.out.println("--objectDeleted---");
marshallSession();
}

private void marshallSession() {
try {
marshaller.marshall(new ByteArrayOutputStream(), ksession);
   
System.out.println("--marshalled---");
} catch (IOException e) {
e.printStackTrace();
}
}
}/

*Output *of test I see only: 
>-= 1 =-
>--objectInserted---
>Insert Business Process Name

Further engine hangs up, looks like dead lock on
ProtobufOutputMarshaller.evaluateRuleActivations() (line 256) > 
RuleExecutor.reEvaluateNetwork().

Notes: 
1) It worked fine on 5.4.0.Final version
2) Current problem not occurs if I run fireAllRules in second thread instad
of filreUntilHalt
private void runFireAllRulesInThread() {
new Thread(new Runnable() {
public void run() {
while(true){
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
LOG.error(e);
}
synchronized (ksLock){
ksession.fireAllRules();
}
}
}
}).start();
}
I need this thread to ensure firing timing rules such like:
$event1 : Test1();
not Test2(this after[0s, 10s ] $event1 );

I hope this can help to resolve either my or drools bug.
Thanks in advance.




--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-6-0-1-CEP-stucks-during-marshaling-in-fireUntilHalt-mode-tp4028493.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 - How to delete assests

2014-03-04 Thread Michael Anstis
IIRC you need to archive them first; and then you can delete them from the
Administration section.


On 4 March 2014 16:47, mattmadhavan  wrote:

> Hello,
> I see o way to delete packages and rules from within Guvnor. Any ideas how
> do I do it?
>
> Thanks
> Matt
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Guvnor-How-to-delete-assests-tp4028491.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] Guvnor - How to delete assests

2014-03-04 Thread mattmadhavan
Hello,
I see o way to delete packages and rules from within Guvnor. Any ideas how
do I do it?

Thanks
Matt



--
View this message in context: 
http://drools.46999.n3.nabble.com/Guvnor-How-to-delete-assests-tp4028491.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] Guvnor - Custom operator problem (Not finding it)

2014-03-04 Thread mattmadhavan
Hello,
I have written a custom operator called "inlist" and it works great in 5.4.0
(not in 5.6.0).

When I import the rules to Guvnor my rule validation fails with the
following error:

/[Administration and Timing of RT - Date RT started unknown, assumed started
more than 365 days of diagnosis] Unable to determine the Evaluator for ID
'*inlist*'/

Any ideas please?

Thanks
Matt



--
View this message in context: 
http://drools.46999.n3.nabble.com/Guvnor-Custom-operator-problem-Not-finding-it-tp4028490.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 Guvnor : Rule validation fails - Not finding any of the fields from the Fact

2014-03-04 Thread mattmadhavan
Hi there,
Sorry don't know your real name. 

Yes I generated the getters and setters and the fields are being found! Not
sure why but it works.

But now I am facing issues with my custom operator. Its not finding it! Any
ideas how I would go solving it?

Thanks
Matt



--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-Guvnor-Rule-validation-fails-Not-finding-any-of-the-fields-from-the-Fact-tp4028472p4028489.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] Best Solution found but latest solution does not work

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

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

On 04-03-14 16:22, moltenice wrote:
> Oh, I actually decided to implement my own cloning methods because without
> them FULL_ASSERT gave me the following error:
>
> 14:46:41.601 [main] INFO  o.o.core.impl.solver.DefaultSolver - Solving
> started: time spend (7), score (-1hard/0soft), new best score
> (-1hard/0soft), random seed (0).
> 14:46:41.620 [main] INFO  o.o.c.i.c.DefaultConstructionHeuristicSolverPhase
> - Phase (0) constructionHeuristic ended: step total (0), time spend (28),
> best score (-1hard/0soft).
> 14:46:41.798 [main] DEBUG o.o.c.i.l.DefaultLocalSearchSolverPhase - Step
> index (0), time spend (207), score (-1hard/0soft), best score
> (-1hard/0soft), accepted/selected move count (1000/1000) for picked step
> (TimetableSlot@44c099ef => Thomas).
> 14:46:41.947 [main] DEBUG o.o.c.i.l.DefaultLocalSearchSolverPhase - Step
> index (1), time spend (356), score (-1hard/0soft), best score
> (-1hard/0soft), accepted/selected move count (1000/1889) for picked step
> (TimetableSlot@5289178b => Thomas).
> 14:46:42.092 [main] DEBUG o.o.c.i.l.DefaultLocalSearchSolverPhase - Step
> index (2), time spend (501), score (0hard/0soft), new best score
> (0hard/0soft), accepted/selected move count (1000/2869) for picked step
> (TimetableSlot@c7b2b3e => Thomas).
> Exception in thread "main" java.lang.IllegalStateException: Score
> corruption: the solution's score (0hard/0soft) is not the uncorruptedScore
> (-1hard/0soft).
>   at
> org.optaplanner.core.impl.score.director.AbstractScoreDirectorFactory.assertScoreFromScratch(AbstractScoreDirectorFactory.java:75)
>   at
> org.optaplanner.core.impl.solver.scope.DefaultSolverScope.assertScoreFromScratch(DefaultSolverScope.java:113)
>   at
> org.optaplanner.core.impl.bestsolution.BestSolutionRecaller.stepEnded(BestSolutionRecaller.java:90)
>   at
> org.optaplanner.core.impl.phase.AbstractSolverPhase.stepEnded(AbstractSolverPhase.java:93)
>   at
> org.optaplanner.core.impl.localsearch.DefaultLocalSearchSolverPhase.stepEnded(DefaultLocalSearchSolverPhase.java:126)
>   at
> org.optaplanner.core.impl.localsearch.DefaultLocalSearchSolverPhase.solve(DefaultLocalSearchSolverPhase.java:83)
>   at
> org.optaplanner.core.impl.solver.DefaultSolver.runSolverPhases(DefaultSolver.java:190)
>   at
> org.optaplanner.core.impl.solver.DefaultSolver.solve(DefaultSolver.java:155)
>   at Main.main(Main.java:29)
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>   at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.lang.reflect.Method.invoke(Method.java:601)
>   at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
>
>
> Also, thanks for pointing me to the doc on cloning, I have tried to
> implement it as follows but now it doesn't seem to be able to update the
> values and just runs without changing original inputted solution until
> timelimit:
> My Solution's clone:
>  @Override
>  public Timetable planningClone() {
>  TimetableSlot[][] clonedTimetableSlotArray = new
> TimetableSlot[Constants.TIME_SLOTS][Constants.NUMBER_OF_STUDENTS];
>  for (int i = 0; i < Constants.TIME_SLOTS; i++) {
>  for (int j = 0; j < Constants.NUMBER_OF_STUDENTS; j++) {
>  try {
>  clonedTimetableSlotArray[i][j] = (TimetableSlot)
> this.timetable[i][j].clone();
>  } catch (CloneNotSupportedException e) {
>  e.printStackTrace();
>  }
>  }
>  }
>
>  Timetable clonedTimetable = new Timetable(clonedTimetableSlotArray);
>  clonedTimetable.setScore(this.getScore());
>  return clonedTimetable;
>  }
>
>
> My Solution's Entity Collection:
>  @PlanningEntityCollectionProperty
>  public Collection getListOfTimetableSlots() {
>  Collection timetableSlotCollection = new
> ArrayList();
>
>  for (int i = 0; i < Constants.TIME_SLOTS; i++) {
>  for (int j = 0; j < Constants.NUMBER_OF_STUDENTS; j++) {
>  try {
>  timetableSlotCollection.add((TimetableSlot)
> timetable[i][j].clone());
>  } catch (CloneNotSupportedException e) {
>  e.printStackTrace();
>  }
>  }
>  }
>
>  

Re: [rules-users] Do events have to be unique in terms of their field values?

2014-03-04 Thread Wolfgang Laun
Copy-pasted from the Expert manual:

kBase Attribute:
equalsBehavior  identityidentity, equality

Defines the behavior of Drools when a new fact is inserted into the
Working Memory. With identity it always create a new FactHandle unless
the same object isn't already present in the Working Memory, while
with equality only if the newly inserted object is not equal
(according to its equal method) to an already existing fact.

-W

PS: Grammar and wording could be improved, but you'll guess what it's
trying to say.

On 04/03/2014, Brecht De Rooms  wrote:
> Dear drools users,
>
> when using a rule to add events such as the rule below, I noticed that
> they are not inserted if the event has identical field values. When I
> change one of the values to another number they are inserted. Is this
> normal behavior? I assumed that the timestamp would determine them to be
> unique.
>
> rule "insertevents0"
>when
>then
>  insert(new (TestFloatEvent(0));
>  insert(new (TestFloatEvent(0));
>end
>
> I figured it might be that the timestamp is equal since they are inserted
> in the same rule. To be sure I waited and entered a second rule to be
> picked up by the scanner.
>
> rule "insertevents1"
>when
>then
>  insert(new (TestFloatEvent(0));
>  insert(new (TestFloatEvent(0));
>end
>
> Yet, the amount of events when I query the factbase is still 1 where I
> thought it would ahave been 4.
> Is the best way to fix this to add an explicit time attribute?
>
> The TestFloatEvents are declared as:
>
> package dynamictypesnetworktest
>
> declare TestFloatEvent
>   @role(event)
>   value : float @key
> end
>
> ---
> Dit e-mailbericht bevat geen virussen en malware omdat avast!
> Antivirus-bescherming actief is.
> http://www.avast.com
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] How to set a the Kiebase generated by a scanner to streaming modus?

2014-03-04 Thread Brecht De Rooms
I received an answer on IRC so I thought I'd share it to close this topic.

The scan just automates the updating of the KieContainer and the  
KieContainer is loaded from the jar itself. The jar contains a  
kmodule.xml. In the kmodule,xml you can set the stream vs cloud modus.


On Mon, 03 Mar 2014 20:23:45 +0100, Brecht De Rooms   
wrote:

> Dear Drools Users,
>
>  When you create you own KieBase you can set the KieBase to streaming
> as follows:
>   KieBaseConfiguration config =
> KieServices.Factory.get().newKieBaseConfiguration();
>   config.setOption( EventProcessingOption.STREAM );
>  However, when you use a scanner you would create a session as  
> follows:
>   KieServices ks = KieServices.Factory.get();
>  KieContainer kieContainer = ks.newKieContainer(releaseId);
>  scanner = ks.newKieScanner(kieContainer);
> You can't set the Streaming option directly on the session and I assume
> the KieBases will change from the moment a change is detected in the  
> Maven
> package. Then how would you set the KieBases that are 'generated' by teh
> scanner to streaming modus?
>
> Kind Regards,
>
>
> -
> Brecht De Rooms
> Phd Student @ WISE
> Department of Computer Science
> Vrije Universiteit Brussel
> Pleinlaan 2, B-1050 Brussels, Belgium
>
> office: 10 G 731f
> phone: +32 2 629 37 49
> email: bdero...@vub.ac.be
> -
>
> ---
> Dit e-mailbericht bevat geen virussen en malware omdat avast!  
> Antivirus-bescherming actief is.
> http://www.avast.com
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users


-- 
-
Brecht De Rooms
Phd Student @ WISE
Department of Computer Science
Vrije Universiteit Brussel
Pleinlaan 2, B-1050 Brussels, Belgium

office: 10 G 731f
phone: +32 2 629 37 49
email: bdero...@vub.ac.be
-

---
Dit e-mailbericht bevat geen virussen en malware omdat avast! 
Antivirus-bescherming actief is.
http://www.avast.com

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


[rules-users] Do events have to be unique in terms of their field values?

2014-03-04 Thread Brecht De Rooms
Dear drools users,

when using a rule to add events such as the rule below, I noticed that  
they are not inserted if the event has identical field values. When I  
change one of the values to another number they are inserted. Is this  
normal behavior? I assumed that the timestamp would determine them to be  
unique.

rule "insertevents0"
   when
   then
 insert(new (TestFloatEvent(0));
 insert(new (TestFloatEvent(0));
   end

I figured it might be that the timestamp is equal since they are inserted  
in the same rule. To be sure I waited and entered a second rule to be  
picked up by the scanner.

rule "insertevents1"
   when
   then
 insert(new (TestFloatEvent(0));
 insert(new (TestFloatEvent(0));
   end

Yet, the amount of events when I query the factbase is still 1 where I  
thought it would ahave been 4.
Is the best way to fix this to add an explicit time attribute?

The TestFloatEvents are declared as:

package dynamictypesnetworktest

declare TestFloatEvent
@role(event)
value : float @key
end

---
Dit e-mailbericht bevat geen virussen en malware omdat avast! 
Antivirus-bescherming actief is.
http://www.avast.com

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


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

2014-03-04 Thread moltenice
Oh, I actually decided to implement my own cloning methods because without
them FULL_ASSERT gave me the following error:

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


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

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


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

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

return timetableSlotCollection;
}


My Planning entity's clone:
@Override
protected Object clone() throws CloneNotSupportedException {
return new TimetableSlot(this.timeSlot, this.student,
this.getLecturer());
}

this.getLecturer() ensures that the Lecturer planning variable IS NOT
cloned. Both timeSlot and student are int.

I think I have met the requirements set out when doing custom cloning as
specified in the documentation.

I am still stumped as to what the problem is, I hope I've provided more
insight.

Thanks,
Karan



--
View this message in context: 
http://drools.46999.n3.nabble.com/Best-Solution-found-but-latest-solution-does-not-work-tp4028442p4028484.html
Sent from the Drools: User

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

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

On 04-03-14 13:18, moltenice wrote:
> Hi ge0ffrey,
>
> I understand. I forgot mentioning I am using OptaPlanner 6.0.1 Final.
>
> Your last email proved useful, I encountered some errors which I tried
> fixing, finally coming to this error:
> Exception in thread "main" java.lang.IllegalStateException: HashCode
> violation: the hashCode of tabu (TimetableSlot@15897e8d) probably changed
> since it was inserted in the tabu Map or Set.
>   at
> org.optaplanner.core.impl.localsearch.decider.acceptor.tabu.AbstractTabuAcceptor.adjustTabuList(AbstractTabuAcceptor.java:108)
>   at
> org.optaplanner.core.impl.localsearch.decider.acceptor.tabu.AbstractTabuAcceptor.stepEnded(AbstractTabuAcceptor.java:98)
>   at
> org.optaplanner.core.impl.localsearch.decider.LocalSearchDecider.stepEnded(LocalSearchDecider.java:159)
>   at
> org.optaplanner.core.impl.localsearch.DefaultLocalSearchSolverPhase.stepEnded(DefaultLocalSearchSolverPhase.java:127)
>   at
> org.optaplanner.core.impl.localsearch.DefaultLocalSearchSolverPhase.solve(DefaultLocalSearchSolverPhase.java:83)
>   at
> org.optaplanner.core.impl.solver.DefaultSolver.runSolverPhases(DefaultSolver.java:190)
>   at
> org.optaplanner.core.impl.solver.DefaultSolver.solve(DefaultSolver.java:155)
>   at Main.main(Main.java:29)
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>   at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.lang.reflect.Method.invoke(Method.java:601)
>   at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
>
> I have run tests to ensure my Timetable (Solution), TimetableSlot (Planning
> Entity), and Lecturer (Planning Variable) all have working clone(),
> equals(), and hashCode().
>
> Clone: I always do a deep clone, so Timetable's TimetableSlots and
> TimetableSlot's Lecturer will be re-instantiated. Same for the other
> classes.
> Equals: I always do deep Equals, so even if all objects and sub-objects are
> different it will equal true if all the base objects are equal.
> hashCode: I ensured that a cloned object using my cloned methods will output
> the SAME hashCode.
>
> My @PlanningEntityCollectionProperty returns non-cloned (so same instances)
> collection of TimetableSlots.
>
> Hopefully this description of my code can help you spot what I'm doing
> wrong.
>
> Thank you for your responses so far!
>
> Karan
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Best-Solution-found-but-latest-solution-does-not-work-tp4028442p4028482.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>


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


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

2014-03-04 Thread moltenice
Hi ge0ffrey,

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

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

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

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

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

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

Thank you for your responses so far!

Karan



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


Re: [rules-users] Drools Guvnor : Rule validation fails - Not finding any of the fields from the Fact

2014-03-04 Thread rjr201
I don't know for certain but I think it is necessary to have getters and
setters on all attributes you want drools to be able to access.

What version of Guvnor are you using? 

In 5.3 you should be able to go to the "Edit" tab of the package and see
your classes under 'imported types'.

To see if your attributes are being picked up, you could create a rule using
the guided editor, add a condition (select one of your classes from the list
provided), and then if you click on the this new condition it should give
you a drop down box of the fields you can add as restrictions (If the list
is empty you know it's not picking up on your attributes).

Hope that's some sort of help. 

  



--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-Guvnor-Rule-validation-fails-Not-finding-any-of-the-fields-from-the-Fact-tp4028472p4028481.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] OptaPlanner - best strategy for variable number of planning entities?

2014-03-04 Thread Geoffrey De Smet

On 03-03-14 23:32, Nadim wrote:
> Hi, I'm new to OptaPlanner, and reading through the planning examples in the
> documentation left me with a question.  One problem I'm trying to model
> involves a variable number of planning entities, which I didn't really see
> addressed by any of the examples; they all seemed to me more focused on
> varying the states of planning variables for a fixed / known number of
> entities.
Yes. Although OptaPlanner has been designed to deal with a variable 
number of entities,
none of the examples do it yet and there are no generic moves for it
- so it's uncharted territory.
>
> To throw out some specifics...let's say I'm trying to optimize my attendance
> schedule for some convention.  I have a set of problem facts, the various
> events going on at the convention, with each having a time (when the event
> happens), and a worth (how much I'd like to be there for that event).
ok
> And I have a set of planning entities, the various times that I'm present at
> the convention.
Sounds weird to me.
It's sounds like you're assigning the pigeon holes to the pigeons,
instead of assigning the pigeons to the pigeon holes.
>   So, I'm trying to model the case where my key constraint is
> the total amount of time I spend at the convention...let's treat that as
> fixed.  I don't care how many separate times I go there, though I will have
> to model constraints like a minimum length per visit (very inefficient to go
> for 10 minutes at a time), and a minimum separation between visits (annoying
> / inefficient to leave, then turn right around and go back, unless I get an
> hour break).
Sounds like the nurse rostering example.
>
> Again, I didn't see a good way to just say "have any number of planning
> entities in the planning entity collection, so long as they meet the
> constraints".  So instead, I modeled the problem as a set of visits,
> calculated as the max possible visits (total conference length / minimum
> visit duration).  Then I defined each visit to have three planning
> variables:  start time, duration, and whether that visit is "active".
I wouldn't model it like this.
3 planning variables, probably each with a minute or second accuracy.
The size of search space must be crazy.
Or you're forced to write complex moves to avoid using minutes like 
10:03 if no session starts at that time.

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

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

Based on that, your start and end times can be calculated.
Either in the score calculation itself (insertLogicals etc like in nurse 
rostering)
Or with shadow variables (like in vehicle routing and project job 
scheduling)
http://blog.athico.com/2013/06/shadow-variables-planningvariablelisten.html
Shadow variables is probably more efficient.
>I'm
> looking forward to 6.1, where it seems there's better support for numeric
> ranges, but for now, just modeled start time as the set of integers
> representing the time range of the convention in minutes.  Finally, I
> constructed a hard score based on the constraints above, and a soft score
> that represents the sum of the worth of the events that occur during the
> visit.
>
> However, I'm not seeing it work out too well...the engine seems to spend a
> lot of time messing around with one visit, and very little time trying out
> multiple visits with different starts and durations to capture event-rich
> times.  I can certainly play around with parameters and engine
> configuration, but I thought I should first ask if I was fundamentally going
> about modeling the problem the wrong way, as I am very new to the
> OptaPlanner engine.
If you see this behavior, it can be well worth to add additional generic 
moves (such as pillarSwapMove)
and "smarter custom moves".
By default it will uses only changeMoveSelector and swapMoveSelector.

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

In the benchmarker, enable the mutation count statistic and best score 
statistic.
Based on those graphs, it's possible to get a better understanding of 
what's happening.
>
> Thanks in advance for any thoughts or suggestions!
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/OptaPlanner-best-strategy-for-variable-number-of-planning-entities-tp4028470.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>


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


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

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

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

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

On 04-03-14 01:30, moltenice wrote:
> Hi Ge0ffrey, thanks for your quick reply.
>
> Actually I'm quite sure it's my code, I just used brute force to enable
> completeness on my small problem. I've attached my problem this time just
> using a first fit heuristic.
>
> If you run my code you will see that the solver hits a 0hard/0soft score
> which is valid, but since it searches for better solutions afterwards it
> seems to replace the best solution with the last solution it received.
>
> I think the TimetableSlot objects' Lecturer planning variable is modified
> when planner is running and since a new instance isn't made of the objects
> they are just replaced by the latest value (and I'm guessing wherever the
> best solution is stored its instances are replaced too since they refer to
> the same point in memory). I feel I haven't implemented the
> Solution/Planning Entities and variables correctly so do take a look at
> those.
>
> I think the best way to understand the problem is to just run the main
> method. It should work out of the box as long as libraries are included!
>
> Thanks a lot and awaiting your reply.
>
> Karan
>
> Timetabler.zip
> 
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Best-Solution-found-but-latest-solution-does-not-work-tp4028442p4028475.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>


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