I would like to create a cyclic event that every 24 hours at a certain hour removes all the agents (in my case Person which are part of the population called Customers) from the flowchart in order to start the next morning whit noone in the loop.
Thanks in advance
I tried to put in the Action of the event : Object Customer=null;
This should do the trick, be sure to name your customers population with a lowercase initial c:
List <Customer> tempCustomers=findAll(customers,t->true);
for(Customer c : tempCustomers){
remove_customers(c);
}
But if your agents are in a process modeling block or other library, i'm not sure if it will work in 100% of the cases and won't cause erratic behaviors... i would try instead to be sure that your model is robust, to remove them through the sink block
Related
I want to test a simple strategy based on time: every day at fixed time check some conditions and go long. every day at fixed time exit.
Whatever I try to get timeOpenCondition I get syntax error.
Tried things similar to:
EntryTime = if hour=0800 and minute=0
ExitTime = if hour=1400 and minute=0
It feels like I don't get the concept of how this works. Appreciate any help!
I try to update a projection from event store. The following line will load all events:
$events = $this->eventStore->load(new StreamName('mystream'));
Currently i try to load only not handled events by passing the fromNumber parameter:
$events = $this->eventStore->load(new StreamName('mystream'), 10);
This will load all events eg from 15 to 40. But i found no way to figure out which is the current/highest "no" of the results. But this is necessary for me to load only from this entry on the next time.
If the database is truncated (with restarted sequences) this is not a real problem cause i know that the events will start with 1. But if the primary key starts with a number higher than 1 can not figure out which event has which number in the event store
When you are using pdo-event-store, you have a key _position in the event metadata after loading, so your read model can track which position was the last you were working on. Other then that, if you are working with proophs event-store projections, you don't need to take care of that at all. The projector will track the current event position for all needed streams internally, you just need to provide callbacks for each event where you need to do something.
I am following the documentation for Apache open-nlp. I was able to understand the sentence detection, tokenizer, name-finder. But I got stuck for Categorizer. The reason, I can not understand, how to create a model for Categorization.
I do understand that I need to create a file. The format is very clear, it needs to be a category space and a document in a single line. Save the file with .train extension.
So I created the following file:
Refund What is the refund status for my order #342 ?
NewOffers Are there any new offers for your products ?
I gave this command-
opennlp DoccatTrainer -model en-doccat.bin -lang en -data en-doccat.train -encoding UTF-8
It starts doing something and then returns with an error. These are the contents in the command prompt:
Indexing events using cutoff of 5
Computing event counts... done. 2 events
Indexing... Dropped event Refund:[bow=What, bow=is, bow=the, bow=refund, bow=status, bow=for, bow=my, bow=order, bow=#342, bow=?]
Dropped event NewOffers:[bow=Are, bow=there, bow=any, bow=new, bow=offers, bow=for, bow=your, bow=products, bow=?]
done.
Sorting and merging events... Done indexing.
Incorporating indexed data for training...
Exception in thread "main" java.lang.NullPointerException
at opennlp.maxent.GISTrainer.trainModel(GISTrainer.java:263)
at opennlp.maxent.GIS.trainModel(GIS.java:256)
at opennlp.model.TrainUtil.train(TrainUtil.java:184)
at opennlp.tools.doccat.DocumentCategorizerME.train(DocumentCategorizerME.java:162)
at opennlp.tools.cmdline.doccat.DoccatTrainerTool.run(DoccatTrainerTool.java:61)
at opennlp.tools.cmdline.CLI.main(CLI.java:222)
I am just not able to figure out why is this giving a null pointer exception here? I also tried to increase two more lines, but no result.
Refund What is the refund status for my order #342 ?
NewOffers Are there any new offers for your products ?
Refund Can I place a refund request for electronics ?
NewOffers Is there any new offer on buying worth 5000 ?
I found this blog, but here also pretty much the same thing is done. On trying his training file it works with a charm. What is wrong in my file? How do I resolve the error.
When I try opennlp DoccatTrainer it opens help for me, so path is not an issue. Any help is appreciated.
EDIT: I changed the file to
Refund What is the refund status for my order #342 ? Can I place a refund request for clothes ?
NewOffers Are there any new offers for your products ? what are the offers on new products or new offers on old products?
Refund Can I place a refund request for electronics ?
NewOffers Is there any new offer on buying worth 5000 ?
and it works, I thought it has got to do something with the document (apparently should be two sentences) and removed the last two lines.
to make it
Refund What is the refund status for my order #342 ? Can I place a refund request for clothes ?
NewOffers Are there any new offers for your products ? what are the offers on new products or new offers on old products?
But then again it fails, the question now summarizes to what kind of data/ format/document does it need?
Thanks
you have to add more than 5 samples from each category. because default cutoff mark size is 5,
Please refer this blog post
http://madhawagunasekara.blogspot.com/2014/11/nlp-categorizer.html
You can use the -cutoff flag in your DoccatTrainer command to change the default. In your case, you would add -cutoff 1 to set the minimum number of documents per category to 1.
I really like the tool, but I haven't been able to find any guidelines to help with interpreting the results of the mini profiler. I seem to get one expandable tab per action method, and I can plainly figure out the durations of my manually-created profiler steps, but I cannot intuitively (or with the help of google) figure out the difference between "duration" and "with children." Typing this question I have come up with a guess: Does "duration" mean "excluding children?"
Duration is the executing time of that monitored code minus any reported children. The MVC Mini Profiler uses a hierarchy to track timings of different paths of code. That hierarchy is not created based on functions but on how you log the calls.
Here is a sample example from a project. There is a page which calls "ListService", which executes "getList", then "FilListWithOptions", and so on.
http://www.temppage.com:80/something.aspx
ListService
getList
FillListWithOptions
QtyBreakPrices
FillProductDataWithOptions
GetProducts
ProductService
These don't have to be individual functions, just nested code that's wrapped in the monitoring code:
using (profiler.Step("ListService"))
{
using (profiler.Step("getList"))
{ // something more interesting here
}
using (profiler.Step("FillListWithOptions"))
{ // and here
}
}
using (profiler.Step("ProductService"))
{
// blah
}
The duration of http://www.temppage.com:80/something.aspx might be 615.2ms, with children is 2222.5ms.
Duration of "ListService" is 3ms, with children is 807ms.
So from those stats we can determine that you are correct; duration is only the code executed, excluding reported children. With children combines duration and childrens time to get a total.
But "ProductService" doesn't have any reported children and it's duration and with children are the same at 400ms. I know the ProductService does call other functions which call other functions. The profiler doesn't count those as children because it doesn't know about them. It reports the same for both unless you wrap them with the using statements.
In general I am writing rules for events which equal (by attributes values) events can occur any time in consecutive manner (every second). I want to fire rules for matched events only on an hourly bases.
In more details:
I want to fire a rule when an event is inserted for the first time (not exist yet) OR when an event is inserted and if and only if equal events are already inserted to the working memory BUT the newest of them is at least one hour ago old.
What is a reasonable way of writing a rule of that kind, taking events duration will be 24H?
rule X
when
$e : MyEvent() from entry-point "s"
not( MyEvent( this != $e, id == $e.id, this before[0s,1h] $e ) from entry-point "s" )
then
// $e arrived and there is no other event with the same
// id that happened during the last hour
end
Replace "id == $e.id" by whatever constraints you use to decide two events are related to each other.
You could create a global queue like this:
global java.util.List eventQueue;
Your also need to access your global queue from java, so just use:
session.getGlobals();
session.setGlobal(name, value);
In this queue save an event and related time. Then check hourly form java code this queue, and execute rules based on timestamp. This is not poor drools approach, but is straightforward.