Hi Mark,<br>After all the hard work you guys have put into drools recently I hope you had a good holiday.<br>Has anybody had a chance to look at this?<br><br>Simon<br><br><div><span class="gmail_quote">On 20/07/07, <b class="gmail_sendername">
Mark Proctor</b> <<a href="mailto:mproctor@codehaus.org">mproctor@codehaus.org</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div bgcolor="#ffffff" text="#000000">
we'll look into this to see where the memory is going. but won't be for
another week or so - I'm currently on holiday.<br>
<br>
Mark<br>
Simon French wrote:
<blockquote type="cite"><div><span class="e" id="q_113e3fc883bd586e_1">Hi,<br>
After attending a session with Mark Proctor in London I was inspired to
play around with Drools in a slightly different way than we use it for
in the workplace, and try and solve a puzzle.<br>
Unfortunately I couldn't get Drools to solve it as I kept getting
memory problems (I believe are cartesian joins being the problem),
<br>
so I decided to extend the golfer example to see if I got the same
problem<br>
I added two new names and a new integer property, club<br>
<br>
// create all possible Golfer objects<br>
String[] names = new String[] { "Fred", "Joe", "Bob",
"Tom", "Des", "Terry" };
<br>
String[] colors = new String[] { "red", "blue",
"plaid", "orange","black", "white" };<br>
int[] positions = new int[] { 1, 2, 3, 4, 5, 6 };
<br>
int[] clubs = new int[] {9,8,7,4,5,5};<br>
<br>
for ( int n = 0; n < names.length; n++ ) {<br>
for ( int c = 0; c < colors.length; c++ ) {<br>
for ( int p = 0; p < positions.length; p++
) {<br>
for ( int q = 0; q < clubs.length; q++
) {<br>
session.insert(new Golfer( names[n],
colors[c], positions[p], clubs[q]) );<br>
<br>
....<br>
<br>
<br>
Then changed the golder.drl to:<br>
<br>
package com.sample<br>
<br>
import com.sample.Golfer;<br>
<br>
<br>
rule "Golfer Riddle" <br>
when<br>
// A golfer named Fred, <br>
<br>
Golfer( name == "Fred", <br>
$fredsPosition : position, $fredsColor : color,
$fredsClub : club )<br>
<br>
// Der Golfer hinter Fred trägt blau<br>
Golfer( $unknownsName : name != "Fred", <br>
$unknownsPosition : position == ( $fredsPosition + 1
),
<br>
$unknownsColor : color == "blue", color != $fredsColor,<br>
$unknownsClub : club == 5 )<br>
<br>
// Joe steht an zweiter Stelle <br>
Golfer( name == "Joe", $joesPosition : position == 2, <br>
position != $fredsPosition,<br>
$joesColor : color != $fredsColor,<br>
$joesClub : club == 5 )<br>
<br>
// Bob traegt Karo <br>
Golfer( name == "Bob", <br>
name != $unknownsName,<br>
$bobsPosition : position != $fredsPosition,<br>
position != $unknownsPosition, position !=
$joesPosition, <br>
$bobsColor : color == "plaid",<br>
color != $fredsColor, color != $joesColor,<br>
color != $unknownsColor, <br>
$bobsClub : club < $joesClub )<br>
<br>
// Tom ist nicht 1. oder 4., traegt kein Orange<br>
Golfer( $tomsName : name == "Tom", <br>
$tomsPosition : position != 1, position != 4,<br>
position != $fredsPosition, position != $joesPosition, <br>
position !=
$bobsPosition, <br>
$tomsColor : color != "orange", color != "blue",<br>
color != $fredsColor, color != $joesColor,
<br>
color != $bobsColor ) <br>
<br>
Golfer ( $des : name == "Des", $desPosition : position <
$fredsPosition, $desColor : color != "blue",<br>
color != $fredsColor, color != $joesColor,
<br>
color != $bobsColor )<br>
Golfer ( $terry : name == "Terry", $terryPosition : position
< $desPosition, $terryColor : color != "blue",<br>
color != $fredsColor, color != $joesColor,
<br>
color != $bobsColor )<br>
then<br>
System.out.println( "Fred " + $fredsPosition + " " +
$fredsColor );<br>
System.out.println( "Joe " + $joesPosition + " " + $joesColor
);
<br>
System.out.println( "Bob " + $bobsPosition + " " + $bobsColor );<br>
System.out.println( "Tom " + $tomsPosition + " " + $tomsColor
); <br>
System.out.println
( "Des " + $desPosition + " " + $desColor ); <br>
System.out.println( "terry " + $terryPosition + " " +
$terryColor ); <br>
end <br>
<br>
<br>
After a couple of minutes of processing I got:-
<br>
<br>
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space<br>
<br>
I also changed java memory allocation with -Xms1640M -Xmx1640M (The
most I can allocate on my PC), and tried running it as a stateless
session too.
<br>
<br>
Is there anything else I can do, or is this simply pushing drools too
far (surely not!!) ?<br>
<br>
I'm very keen on pushing this technology as much as possible in our
workplace and I'd really appreciate any help.
<br>
<br>
Thanks in advance<br>
<br>
Simon<br>
<br>
</span></div><pre><hr size="4" width="90%">
_______________________________________________<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">rules-users@lists.jboss.org
</a>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">https://lists.jboss.org/mailman/listinfo/rules-users</a>
</pre>
</blockquote>
<br>
</div>
<br>_______________________________________________<br>rules-users mailing list<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br><a onclick="return top.js.OpenExtLink(window,event,this)" href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">
https://lists.jboss.org/mailman/listinfo/rules-users</a><br><br></blockquote></div><br>