Difficulty determining why I have score corruption
by megwoods
Hi,
I have been at this a couple of days now but I am getting score corruption
from a rule that does the following:
rule "to bigger gap"
when
$res: ResourceInstance()
$resList : ArrayList(size > 1)
from collect( TripAtTimeWithResource(resource == $res) )
then
-- Sort the list using custom comparator.
-- Measure a series of deltas between elements in the list.
-- If the delta is larger than a threshold add a soft constraint.
insertLogical(new IntConstraintOccurrence("to bigger gap",
ConstraintType.NEGATIVE_SOFT,delta * 10, ttrL));
end
The TripAtTimeWithResource is the planning entity.
I have checked the cloning and been through and checked that all equals and
hashcode methods and they are correct.
If I take this rule out the implementation functions as correctly.
Interestingly though I first prototyped this using a simple score and with
the same 'when' and 'then' clause (inserting a different fact) and no score
corruption was observed.
If anyone has any suggestions I would really like to hear from you.
Cheers Megan Woods
Extract from exception:
The workingMemory has 3 ConstraintOccurrence(s) in excess:
to bigger gap/NEGATIVE_SOFT:[TripAtTimeWithResource
[trip=a.c.t.p.p.m.TripInstance@43b, resource=All(17), startTime=TimeUnit
[minute=285]]]=750
to bigger gap/NEGATIVE_SOFT:[TripAtTimeWithResource
[trip=a.c.t.p.p.m.TripInstance@46c, resource=All(17), startTime=TimeUnit
[minute=75]]]=1700
to bigger gap/NEGATIVE_SOFT:[TripAtTimeWithResource
[trip=a.c.t.p.p.m.TripInstance@421, resource=All(17), startTime=TimeUnit
[minute=75]]]=960
The workingMemory has 4 ConstraintOccurrence(s) lacking:
overlapping trips with same
resource/NEGATIVE_HARD:[TripAtTimeWithResource
[trip=a.c.t.p.p.m.TripInstance@43b, resource=All(17), startTime=TimeUnit
[minute=285]]]=100
to bigger gap/NEGATIVE_SOFT:[TripAtTimeWithResource
[trip=a.c.t.p.p.m.TripInstance@421, resource=All(17), startTime=TimeUnit
[minute=75]]]=1710
to bigger gap/NEGATIVE_SOFT:[TripAtTimeWithResource
[trip=a.c.t.p.p.m.TripInstance@43b, resource=All(17), startTime=TimeUnit
[minute=285]]]=1650
to bigger gap/NEGATIVE_SOFT:[TripAtTimeWithResource
[trip=a.c.t.p.p.m.TripInstance@46c, resource=All(17), startTime=TimeUnit
[minute=75]]]=950
--
View this message in context: http://drools.46999.n3.nabble.com/Difficulty-determining-why-I-have-score...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 10 months
[Switchyard RuleService] Rule doesnt fire when in FireAllRules mode
by kurrent93
Im confused about why my rule isnt firing.
Im using Jboss SwitchYard.
This is the only difference from the switchyard perspective:
<rules:action name="sendData" type="FIRE_ALL_RULES"
entryPoint="AccountData"/>
And when I use EXECUTE the rule fires.
When I use FIRE_ALL_RULES, it never gets activated.
This is my rule:
| rule "OpenTrade-Open"
2. | agenda-group "OpenTrade"
3. | no-loop true
4. | dialect "mvel"
5. | when
6. | Tick( ) over window:time (1m) from entry-point "AccountData"
7. | then
8. | TradeOrder newTrade = new TradeOrder();
9. | newTrade.setSymbol( "EURUSD" );
10. | newTrade.setVolume( 1 );
11. | newTrade.setMt4username( "4002642" );
12. | newTrade.setStatus( OrderStatus.OPENING );
13. | newTrade.setOperation( "OP_BUY" );
14. | newTrade.setComment( "From Magick.Rhythm" );
15. | insert( newTrade );
16. | modifiedOrderList.add(newTrade);
17. | end
--
View this message in context: http://drools.46999.n3.nabble.com/Switchyard-RuleService-Rule-doesnt-fire...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 10 months
Web services and Drools
by riri
Hello everyone,
I need to develop a web application that includes Drools as its rule engine
and would like to expose its functionality as web services. I would
appreciate some expert opinion on which framework would be easiest to learn
and to work with. Some of the posts I have seen regarding Drools and OSGi
refer to it as a "nightmare". Is that still true with the current version?
If anyone has had any experience with Spring, EJB or other and would like to
share I would be very interested since I am new to this domain. If there is
a case to be made about not using a framework at all then I would also like
to hear you out.
Best regards,
--
View this message in context: http://drools.46999.n3.nabble.com/Web-services-and-Drools-tp4021509.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 10 months
Stuck on simple testcase
by Michiel Vermandel
Hi,
I wrote a quite simple unit test which I expected to succeed.
But it does not, it ends with a negative score.
Though, it is easy to see on sight that there is a zero-score solution possible.
So... something must be wrong in some of my rules.
I was wondering if it is possible to manually set all planning variables to what I expected them to be and then see which rule(s) break(s)?
So planning variables should not be changed anymore while solving.
I'm using drools planner 5.5.0.Final.
Thanks,
Michiel
-----------------
http://www.codessentials.com - Your essential software, for free!
Follow us at http://twitter.com/#!/Codessentials
11 years, 10 months
Hello and my first question
by Bojan Janisch
Hello everybody,
this is my first post and also my first question to you.
I've searched the net for quite some hours now, but don't get any information regarding optionally conditions.
I'm using drools to annotate some textobjects and I'm stucking with the following rule:
When there are two named entities, one body side and one anatomy in a text (they're defined earlier by a textannotating system, so I'm working on annotated objects) and there is a optionally anatomic side (it contains generally something like "lateral" oder "medial" and so on), then generate me a new annotation.
So up to now I'm on this state:
Rule "Anatomic Side"
when
$NE1 : NE(Type.contains("body"))
$NE2 : NE(Type.contains("anatomy"))
//So here starts the problem
[$NE3 : NE(Type.contains("anatomic"))]
then
...
How can I set a condition as optionally or is there no such way?
Thanks everyone to who reads this.
Janisch
11 years, 10 months
Re: [rules-users] Solution
by Wolfgang Laun
On 14/01/2013, Bojan Janisch <bojan.janisch(a)scai.fraunhofer.de> wrote:
>
> so if someone has the same problem, to get some options how to solve this
> problem.
Posting code that's grossly syntactically invalid isn't going to help.
-W
11 years, 10 months
Solution for reasoning over XML?
by craigparra
Hi,
I was looking around trying to find a solution for reasoning over any XML in
drools, without having to convert the XML into java objects, but couldn't
find any example where this had been done.
I have opted to DOM parse the XML, then recursively wrap every Element node
in a convenience class (XmlElement) and insert as facts. That is every
element is inserted individually as a fact.
My conditionals look like:
$xml : XmlElement(name == 'someName', value == 'someValue')
$xml : XmlElement(path== '/some/xpathlike/path', value == 'someValue')
$xml : XmlElement(attribute['someAttr'] == 'someValue')
or using a DSL:
An XML element exists
- named someName with a value of
- at path /some/xpathlike/path with a value in "someVal","someOtherVal"
Is this a pattern that other drools users have encountered? Or tried to
solve.
It seems to work quite well, at least in my scenario - but clearly it has
limitations based on the DOM parse (ie not great for massive XML files).
Was wondering if anyone else had tried to solve how to use XML as facts?
--
View this message in context: http://drools.46999.n3.nabble.com/Solution-for-reasoning-over-XML-tp40214...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 10 months