Re: [rules-users] Monte Carlo and additional Optimisers forOptaPlanner
by sirinath
Option pricing and calculating the Greeks.
Why is GP/GA poor in performance? Best is to find a way to make it gain
performance. Otherwise what is the use of adding just for the sake of
adding it.
Also it would be good to have journaling / event sourcing option for the
engine along side logging.
On 25 Oct 2013 19:48, "ge0ffrey [via Drools]" <
ml-node+s46999n4026500h69(a)n3.nabble.com> wrote:
> [image: Boxbe] <https://www.boxbe.com/overview> ge0ffrey [via Drools] (
> ml-node+s46999n4026500h69(a)n3.nabble.com) is not on your Guest List<https://www.boxbe.com/approved-list?tc_serial=15501950199&tc_rand=5259622...>| Approve
> sender<https://www.boxbe.com/anno?tc_serial=15501950199&tc_rand=525962296&utm_so...>| Approve
> domain<https://www.boxbe.com/anno?tc_serial=15501950199&tc_rand=525962296&utm_so...>
>
>
> On 25-10-13 16:08, sirinath wrote:
>
> Where is Drools chance hosted?
>
> https://github.com/droolsjbpm/drools-chance
>
> Perhaps GA/GP can be a part of this?
>
> Yes, here's a Genetic Algoritms prototype for OptaPlanner:
> https://github.com/elsam/optaplanner
> Results with GA's were poor, but we're going to add it sooner or later.
> Here's the relevant issue to add it:
> https://issues.jboss.org/browse/PLANNER-154
>
> Also Monte Carlo.
>
> Maybe the current way to do is awkward? Is this covered in the
> documentation?
>
> simulation isn't covered in the documentation.
>
> What kind of simulation do you want to do?
> What's the problem definition?
>
> On 25 Oct 2013 17:54, "ge0ffrey [via Drools]" <[hidden email]<http://user/SendEmail.jtp?type=node&node=4026499&i=0>>
> wrote:
>
>>
>> On 25-10-13 12:50, sirinath wrote:
>> > Hi,
>> >
>> > Is it possible to provide more out of the box optimisers and solvers as
>> part
>> > of OptaPlanner.
>> Yes, we're trying to add more every major release.
>> For 6.1 we 'll probably add the CH's "cheapest insertion" and "regret
>> insertion".
>> If you want to add one yourself, start by looking at
>> DefaultLocalSearchSolverPhase.java.
>> >
>> > Also add functionality for simulations (Monte Carlo) which would be a
>> good
>> > addition and fit.
>> Simulation support would be great indeed - but the requirements aren't
>> clearly definied yet (feedback, examples or use cases welcome).
>>
>> It's already possible to do simulation + optimization
>> by doing the simulation inside the score function (for example by
>> running a monte carlo simulation)
>> and doing the optimization with optaplanner.
>>
>> drools-chance (very experimental currently) has a lot of constructs that
>> can help in simulation (bayes stuff etc).
>>
>> >
>> > Suminda
>> >
>> >
>> >
>> > --
>> > View this message in context:
>> http://drools.46999.n3.nabble.com/Monte-Carlo-and-additional-Optimisers-f...
>> > Sent from the Drools: User forum mailing list archive at Nabble.com.
>> > _______________________________________________
>> > rules-users mailing list
>> > [hidden email] <http://user/SendEmail.jtp?type=node&node=4026497&i=0>
>> > https://lists.jboss.org/mailman/listinfo/rules-users
>> >
>>
>>
>> _______________________________________________
>> rules-users mailing list
>> [hidden email] <http://user/SendEmail.jtp?type=node&node=4026497&i=1>
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>> ------------------------------
>> If you reply to this email, your message will be added to the
>> discussion below:
>>
>> http://drools.46999.n3.nabble.com/Monte-Carlo-and-additional-Optimisers-f...
>> To unsubscribe from Monte Carlo and additional Optimisers for
>> OptaPlanner, click here.
>> NAML<http://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=macro_vi...>
>>
>
> ------------------------------
> View this message in context: Re: [rules-users] Monte Carlo and
> additional Optimisers for OptaPlanner<http://drools.46999.n3.nabble.com/Monte-Carlo-and-additional-Optimisers-f...>
> Sent from the Drools: User forum mailing list archive<http://drools.46999.n3.nabble.com/Drools-User-forum-f47000.html>at Nabble.com.
>
>
> _______________________________________________
> rules-users mailing list[hidden email] <http://user/SendEmail.jtp?type=node&node=4026500&i=0>https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
> _______________________________________________
> rules-users mailing list
> [hidden email] <http://user/SendEmail.jtp?type=node&node=4026500&i=1>
> https://lists.jboss.org/mailman/listinfo/rules-users
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://drools.46999.n3.nabble.com/Monte-Carlo-and-additional-Optimisers-f...
> To unsubscribe from Monte Carlo and additional Optimisers for
> OptaPlanner, click here<http://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscr...>
> .
> NAML<http://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=macro_vi...>
>
>
--
View this message in context: http://drools.46999.n3.nabble.com/Re-rules-users-Monte-Carlo-and-addition...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 4 months
Cannot use ViewChangeEventListener in tests
by mreynolds
I am testing an application using Fusion with Cucumber. I create a knowledge
session with the pseudo clock such that I have control over how the clock
advances.
I insert events built from Cucumber data tables with a loop that also
advances the pseudo clock the approriate amount of time. Some of my
scenarios involve complex events being inserted and then retracted before an
external action is taken. From what I read I can use a LiveQuery and a
ViewChangeEventListener in my tests for running my assertions at the end of
the test case.
In my test case, the warnings list is always 0 in length, none of the log
messages get triggered, and the debug view of the LiveQueryImpl is mostly
uninteresting. I can see from the Audit log however that in this case there
was indeed a Warning object added and thus I believe rowAdded should have
been invocated.
I have the following query:
query "Collect Warnings"
$warnings : Warning()
end
And the following support code in the @Setup method of my cucumber step
definitions:
// parts have been truncated for relevance and possibly brevity
private LiveQuery query; // this is declared as a variable
private List<Warning> warnings = new ArrayList<Warning>();
@Before
public void setup() {
session = getKnowledgeSession(); // truncated for brevity
ViewChangedEventListener listener = new ViewChangedEventListener() {
public void rowUpdated( Row row ) {
logger.info( "rowUpdated" );
warnings.add( (Warning) row.get( "$warnings" ) );
}
public void rowRemoved( Row row ) {
logger.info( "rowRemoved" );
warnings.add( (Warning) row.get( "$warnings" ) );
}
public void rowAdded( Row row ) {
logger.info( "rowAdded" );
warnings.add( (Warning) row.get( "$warnings" ) );
}
};
// Open the LiveQuery
query = application.getKnowledgeSession().openLiveQuery( "Collect
Warnings", new Object[] { "$warnings" }, listener );
}
--
View this message in context: http://drools.46999.n3.nabble.com/Cannot-use-ViewChangeEventListener-in-t...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 4 months
Error deploying knowledge-base.war on tomcat6
by xat
I have CentOS6.4 with tomcat 6.0.24 and jdk1.7.21.
I've successfully launched Guvnor 5.5.0-Final, created some facts, rules and
knowledgebase. Generated WAR file for knowledgebase as described here
http://docs.jboss.org/drools/release/5.5.0.Final/drools-guvnor-docs/html/...
When deploying this file on tomcat I have the following in tomcat logs:
Oct 24, 2013 3:26:58 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive drools-service.war
log4j:WARN No appenders could be found for logger
(org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for
more info.
Oct 24, 2013 3:28:00 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
Oct 24, 2013 3:28:00 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/drools-service] startup failed due to previous errors
Oct 24, 2013 3:28:00 PM org.apache.catalina.loader.WebappClassLoader
clearThreadLocalMap
SEVERE: A web application created a ThreadLocal with key of type
[org.springframework.core.NamedThreadLocal] (value [XML bean definition
resources currently being loaded]) and a value of type [null] (value [null])
but failed to remove it when the web application was stopped. To prevent a
memory leak, the ThreadLocal has been forcibly removed.
What could be the reason of this?
--
View this message in context: http://drools.46999.n3.nabble.com/Error-deploying-knowledge-base-war-on-t...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 4 months
Guvnor 5.5 convert excel decision table to web error
by gboro54
In guvnor 5.5, when trying to convert an excel based decision table to a web
based one, using the convert button, we get the following exception:
.drools.guvnor.client.rpc.AssetService.convertAsset(java.lang.String,java.lang.String)
throws com.google.gwt.user.client.rpc.SerializationException' threw an
unexpected exception: java.lang.IndexOutOfBoundsException: Index: 8, Size: 4
at
com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:385)
[gwt-servlet-2.4.0.jar:]
at
com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:588)
[gwt-servlet-2.4.0.jar:]
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)
[gwt-servlet-2.4.0.jar:]
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
[gwt-servlet-2.4.0.jar:]
at
com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
[gwt-servlet-2.4.0.jar:]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
[jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
[jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
[jbossweb-7.0.13.Final.jar:]
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
[jbossweb-7.0.13.Final.jar:]
at
org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62)
[weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
[jbossweb-7.0.13.Final.jar:]
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
[jbossweb-7.0.13.Final.jar:]
at
org.jboss.solder.servlet.exception.CatchExceptionFilter.doFilter(CatchExceptionFilter.java:65)
[solder-impl-3.1.1.Final.jar:3.1.1.Final]
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
[jbossweb-7.0.13.Final.jar:]
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
[jbossweb-7.0.13.Final.jar:]
at
org.jboss.solder.servlet.event.ServletEventBridgeFilter.doFilter(ServletEventBridgeFilter.java:74)
[solder-impl-3.1.1.Final.jar:3.1.1.Final]
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
[jbossweb-7.0.13.Final.jar:]
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
[jbossweb-7.0.13.Final.jar:]
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
[jbossweb-7.0.13.Final.jar:]
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
[jbossweb-7.0.13.Final.jar:]
at
org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)
[jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
[jbossweb-7.0.13.Final.jar:]
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
[jbossweb-7.0.13.Final.jar:]
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
[jbossweb-7.0.13.Final.jar:]
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)
[jbossweb-7.0.13.Final.jar:]
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
[jbossweb-7.0.13.Final.jar:]
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)
[jbossweb-7.0.13.Final.jar:]
at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)
[jbossweb-7.0.13.Final.jar:]
at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_31]
Caused by: java.lang.IndexOutOfBoundsException: Index: 8, Size: 4
at java.util.ArrayList.addAll(ArrayList.java:497) [rt.jar:1.6.0_31]
at
org.drools.guvnor.server.converters.decisiontable.builders.GuidedDecisionTableLHSBuilder.addPatternColumn(GuidedDecisionTableLHSBuilder.java:293)
[classes:]
at
org.drools.guvnor.server.converters.decisiontable.builders.GuidedDecisionTableLHSBuilder.populateDecisionTable(GuidedDecisionTableLHSBuilder.java:168)
[classes:]
at
org.drools.guvnor.server.converters.decisiontable.GuidedDecisionTableGeneratorListener.populateDecisionTable(GuidedDecisionTableGeneratorListener.java:244)
[classes:]
at
org.drools.guvnor.server.converters.decisiontable.GuidedDecisionTableGeneratorListener.finishRuleTable(GuidedDecisionTableGeneratorListener.java:233)
[classes:]
at
org.drools.guvnor.server.converters.decisiontable.GuidedDecisionTableGeneratorListener.processRuleCell(GuidedDecisionTableGeneratorListener.java:301)
[classes:]
at
org.drools.guvnor.server.converters.decisiontable.GuidedDecisionTableGeneratorListener.newCell(GuidedDecisionTableGeneratorListener.java:181)
[classes:]
at
org.drools.decisiontable.parser.xls.ExcelParser.newCell(ExcelParser.java:187)
[drools-decisiontables-5.5.0.Final.jar:5.5.0.Final]
at
org.drools.decisiontable.parser.xls.ExcelParser.processSheet(ExcelParser.java:140)
[drools-decisiontables-5.5.0.Final.jar:5.5.0.Final]
at
org.drools.decisiontable.parser.xls.ExcelParser.parseFile(ExcelParser.java:82)
[drools-decisiontables-5.5.0.Final.jar:5.5.0.Final]
at
org.drools.guvnor.server.converters.decisiontable.DecisionTableXLSToDecisionTableGuidedConverter.parseAssets(DecisionTableXLSToDecisionTableGuidedConverter.java:135)
[classes:]
at
org.drools.guvnor.server.converters.decisiontable.DecisionTableXLSToDecisionTableGuidedConverter.convert(DecisionTableXLSToDecisionTableGuidedConverter.java:94)
[classes:]
at
org.drools.guvnor.server.converters.decisiontable.DecisionTableXLSToDecisionTableGuidedConverter$Proxy$_$$_WeldClientProxy.convert(DecisionTableXLSToDecisionTableGuidedConverter$Proxy$_$$_WeldClientProxy.java)
[classes:]
at
org.drools.guvnor.server.converters.GuvnorDroolsConversionService.convert(GuvnorDroolsConversionService.java:74)
[classes:]
at
org.drools.guvnor.server.converters.GuvnorDroolsConversionService$Proxy$_$$_WeldClientProxy.convert(GuvnorDroolsConversionService$Proxy$_$$_WeldClientProxy.java)
[classes:]
at
org.drools.guvnor.server.RepositoryAssetService.convertAsset(RepositoryAssetService.java:638)
[guvnor-webapp-core-5.5.0.Final.jar:5.5.0.Final]
at
org.drools.guvnor.server.RepositoryAssetService$Proxy$_$$_WeldClientProxy.convertAsset(RepositoryAssetService$Proxy$_$$_WeldClientProxy.java)
[guvnor-webapp-core-5.5.0.Final.jar:5.5.0.Final]
at
org.drools.guvnor.server.AssetServiceServlet.convertAsset(AssetServiceServlet.java:215)
[guvnor-webapp-core-5.5.0.Final.jar:5.5.0.Final]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[rt.jar:1.6.0_31]
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[rt.jar:1.6.0_31]
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[rt.jar:1.6.0_31]
at java.lang.reflect.Method.invoke(Method.java:597)
[rt.jar:1.6.0_31]
at
com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:569)
[gwt-servlet-2.4.0.jar:]
Any ideas what may be causing this?
--
View this message in context: http://drools.46999.n3.nabble.com/Guvnor-5-5-convert-excel-decision-table...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 4 months
Drools memory consumption
by Elran Dvir
Hi all,
I am using Drools Fusion. I am getting OutOfMemoryError rather fast. My JVM is running with -Xmx4g flag.
I have rules defined in another (not Drools) language.
Every rule is translated programmatically to a drl file. This is because the user can add and remove rules (in the other language) dynamically.
The default configuration contains 125 rules.
For example, one rule is supposed to identify a port scan event.
The basic fact is connection log. For each combination of src (source IP) and dst (destination IP) , detect a port scan event, if over 60 seconds there were at least 20 connection logs with different service and protocol.
The event will stay closed for 10 minute - no event will be sent during this time for this combination of src and dst. The event the connection logs' ids (markers).
(other rules are very similar in structure, but different in logic, of course)
This is its programmatic drl file:
package com.checkpoint.correlation.impl.drools.package30;
import java.util.Date
import java.util.HashMap
import java.util.Set
import com.checkpoint.correlation.impl.drools.Log
import com.checkpoint.correlation.impl.drools.CorrelatedEvent
global com.checkpoint.correlation.server.EventsHandler externalEventsHandler;
import function com.checkpoint.correlation.impl.utils.UserDefinedFunctions.isInDayHourRange
import function com.checkpoint.correlation.impl.utils.UserDefinedFunctions.isInIpRange
function boolean filter(Log log) {
return (!((log.fieldsMap.get("src")!= null && isInIpRange(log.fieldsMap.get("src").toString(), "10.80.0.0", "10.80.255.255")) || (log.fieldsMap.get("src")!= null && isInIpRange(log.fieldsMap.get("src").toString(), "124.0.0.0", "124.255.255.255")) || (log.fieldsMap.get("src")!= null && isInIpRange(log.fieldsMap.get("src").toString(), "192.168.0.0", "192.168.255.255")) || (log.fieldsMap.get("src")!= null && isInIpRange(log.fieldsMap.get("src").toString(), "195.158.7.0", "195.158.7.255")) || (log.fieldsMap.get("src")!= null && isInIpRange(log.fieldsMap.get("src").toString(), "11.25.0.0", "11.25.255.255")) || (log.fieldsMap.get("src")!= null && isInIpRange(log.fieldsMap.get("src").toString(), "128.157.0.0", "128.157.255.255")) || (log.fieldsMap.get("src")!= null && isInIpRange(log.fieldsMap.get("src").toString(), "213.114.0.0", "213.114.255.255"))));
}
function String markersToString(Set markersSet) {
int i = 0;
String markersString = "";
for (Object marker : markersSet) {
if (i == 25) break;
String markerStr = marker.toString();
if (i > 0) markersString += "\n";
markersString += markerStr;
}
return markersString;
}
function String calcSeverity(Log log) {
return "High";
}
function String getUniqueId(Log log) {
String uniqueId="";
uniqueId += (log.fieldsMap.get("service") != null ? log.fieldsMap.get("service").toString() : "null");
uniqueId += (log.fieldsMap.get("proto") != null ? log.fieldsMap.get("proto").toString() : "null");
return uniqueId;
}
declare Log
@role(event)
end
declare CorrelatedEvent
@role(event)
@expires(600s)
end
rule "Port scan from external network"
enabled true
dialect "java"
no-loop
when
$log : Log(eval(filter($log)))
not CorrelatedEvent(getId() == "{8AC52BA8-1EE8-4f18-9BB4-54492116501C}", groupByFieldsMap.get("src") == $log.fieldsMap.get("src"), groupByFieldsMap.get("dst") == $log.fieldsMap.get("dst"))
accumulate($accumulatedLog : Log(eval(filter($accumulatedLog)), this after[0s,60s] $log, fieldsMap.get("src") == $log.fieldsMap.get("src"), fieldsMap.get("dst") == $log.fieldsMap.get("dst"), $id : getUniqueId(this));
$idSet : collectSet($id);
$idSet.size > 19)
accumulate($accumulatedLog : Log(eval(filter($accumulatedLog)), this after[0s,60s] $log, fieldsMap.get("src") == $log.fieldsMap.get("src"), fieldsMap.get("dst") == $log.fieldsMap.get("dst"), $idSet.contains(getUniqueId(this)), $marker : fieldsMap.get("marker"));
$markerSet : collectSet($marker))
then
CorrelatedEvent $ce = new CorrelatedEvent("{8AC52BA8-1EE8-4f18-9BB4-54492116501C}");
$ce.groupByFieldsMap.put("src", $log.fieldsMap.get("src"));
$ce.groupByFieldsMap.put("dst", $log.fieldsMap.get("dst"));
insert($ce);
HashMap<String,Object> fieldsMap = new HashMap<String,Object>();
fieldsMap.put("cu_rule_id", "{8AC52BA8-1EE8-4f18-9BB4-54492116501C}");
fieldsMap.put("event_name", "Port scan from external network");
fieldsMap.put("cu_rule_severity", calcSeverity($log));
fieldsMap.put("cu_rule_category", "Scans");
fieldsMap.put("cu_log_count", $markerSet.size());
fieldsMap.put("time", new Date());
fieldsMap.put("cu_markers_list", markersToString($markerSet));
fieldsMap.put("src", $log.fieldsMap.get("src"));
fieldsMap.put("src_machine_name", $log.fieldsMap.get("src_machine_name"));
fieldsMap.put("src_user_name", $log.fieldsMap.get("src_user_name"));
fieldsMap.put("dst", $log.fieldsMap.get("dst"));
fieldsMap.put("dst_machine_name", $log.fieldsMap.get("dst_machine_name"));
fieldsMap.put("dst_user_name", $log.fieldsMap.get("dst_user_name"));
fieldsMap.put("service", $log.fieldsMap.get("service"));
fieldsMap.put("proto", $log.fieldsMap.get("proto"));
fieldsMap.put("product", $log.fieldsMap.get("product"));
externalEventsHandler.handleEvent(fieldsMap);
end
I am sending logs in a rate of up to 200 logs/sec. After about 3 minutes, my application starts to be unresponsive.
I monitored the JVM with VisualVM. Two snapshots of VisualVM are attached.
I found out that the class consuming most memory is FromNodeLeftTuple of drools (as can be seen in "instances.png").
1) Is my inserting rate is too high?
2) Is There a way I can make my rules more memory efficient?
Thanks.
Inserting logs:
public void insertEvents(Collection<Map<String, Object>> logs)
{
for (Map<String, Object> map : logs) {
Log log = new Log();
Log.fieldsMap.putAll(map);
session.insert(log);
session.fireAllRules();
}
}
Log class:
public class Log
{
public HashMap<String, Object> fieldsMap = new HashMap<>();
}
CorrelatedEvent class:
public class CorrelatedEvent
{
public Map<String, Object> groupByFieldsMap;
private String id;
public CorrelatedEvent(String id)
{
groupByFieldsMap = new HashMap<>();
this.id = id;
}
public String getId()
{
return id;
}
}
12 years, 4 months
Help on writing a rule
by calcacuervo
Hi Guys. I have one quesiton on how could I implement my rule.
I have this rule:
when
t : PriceChange() over window:length(1)
signal : Signal( id == "1234" ) over window:length(1)
not OrderCreated( id == "1234" ) over window:time (1m)
then
insert(new OrderCreated("1234));
Basically, when there is some signal and some price change, create a new
order if there has no been any other order in the last minute.
But this sometimes is being fired twice:
12:31:01,121 INFO [org.drools.audit.WorkingMemoryConsoleLogger] (Camel
(camel-1) thread #4 - JmsConsumer[marketDataTopic]) ACTIVATION CREATED
rule:ertetr activationId:ertetr [393, 392, 0] declarations: t=PriceChange
[](392); signal=Signal@1413ddef(393)
12:31:01,160 INFO [org.drools.audit.WorkingMemoryConsoleLogger] (Camel
(camel-1) thread #4 - JmsConsumer[marketDataTopic]) ACTIVATION CREATED
rule:ertetr activationId:ertetr [393, 394, 0] declarations: t=PriceChange
[](394); signal=Signal@1413ddef(393)
I think that, when the 1m window have passed, it creates twice the
activations, as I have not called fire all rules yet. Does is make sense? Do
you have some idea on how could I implement this rule? "when there has been
some price change and some signal, and I did not create a new order in the
last minute, just create a new order".
Thanks in advance!
Demian
--
View this message in context: http://drools.46999.n3.nabble.com/Help-on-writing-a-rule-tp4026461.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 4 months