What is a quick way to filter agents retrieved by Moore2DGridQuery - repast-hpc

I am developing a model on RepastHPC, where I have multiple types of agents inhabiting the same discrete grid projection. On each tick the agents of one of the types need to query the grid projection and find the agents at their current location. However, they need to only consider the agents of a specific type. I use Moore2DGridQuery to get all agents at that grid position, however I cannot find a quick way to filter the set of agents to only get the agents of a specified type. I am currently iterating normally through the vector of agents, however that could result is slow-downs when I have great counts of agents running in the model.
Is there any way I could filter them quicker? Thanks in advance!

Unfortunately, I don't think there's a quick filter you can apply. If you iterate through the vector as part of the model behavior you could check the type there, or use the standard library to copy only the agents you want into another vector. See https://www.cppstories.com/2021/filter-cpp-containers/

Related

How to schedule individual MedicationRequest Administrations?

I am looking to find the best/recommended way to implement the MedicationRequest/MedicationAdministration workflow. Possiblities that I have explored are:
Using the MedicationRequest by itself, and at runtime, determine when the dosages should occur and if they fall withing the boundaries of the current shift, or
Using Tasks to create a limited amount of upcoming dosage Tasks, or
Using MedicationRequests resources based on the original MedicationRequest to indicate each separate dosage
Pros of option 1:
Smallest storage footprint
Cons of option 1:
Requires most run-time work (have to evaluate timing to determine if dosage is required this shift, more work determining missed dosages)
Pros of option 2:
Common use of Tasks could be used against other Orders (ProcedureRequests, etc.) for a common workflow (e.g. show all Tasks this shift)
Cons of option 2:
Default Fhir SearchPararmeters defined do not allow for search on Task.restriction.period (which I believe is how you define the period in which the Task is to be performed).
Only place to link MedicationAdministration to Task is supportingInformation, but the field definition (Additional information (for example, patient height and weight)) doesn't seem like it is appropriate to put the Task there. Possibly use Provenenace, and use that to link Task to MedicationAdministration in eventHistory, but this seems like a stretch.
Pros of option 3:
MedicationRequest.intent has order and instance-order as values. The documentation seems to indicate that this would be a good fit (overall request has intent=order, individual specific dosages would have instance-order)
MedicationRequest has a Fhir-defined search parameter on timing.event that could be used to find events for a specific period.
Cons of option 3:
http://hl7.org/fhir/us/meds/guidance.html#fetching-active-medications-orders states "A MedicationRequest resource query SHALL be all that is required to access the “all active medication orders”." The query example given is GET /MedicationRequest?patient=[id]&status=active{&_include=MedicationRequest:medication}. This kind of hints to me that they expect searches to be more done on status than time period. Not really a strong "con" against this approach, but definitely not a "pro" for using this method.
Any advice about the methods used by other implementations would be greatly appreciated.
The general design expectation is that you would creaste "instance" orders for each administration.

How to use AVAudioPlayerNode with AVMutableComposition

The AVAudioEngine and related AVAudioNode objects seem to be quite powerful for audio processing but it's difficult to see how to automate parameter changes with them. I'm sure there must be something more effective than manually using a Timer to change values, as a crude example.
AVMutableAudioMixInputParameters includes a method setVolumeRampFromStartVolume:toEndVolume:timeRange: but I cannot see how I could integrate that with AVAudioPlayerNode (connected with AVAudioEffectNodes) and use that method to fade the volume over time. Instead, I have only seen examples of AVMutableAudioMixInputParameters working with AVMutableCompositioninstances and none of them include AVAudioNode objects.
Can anyone post or link to some code samples that combine the use of AVAudioNodes with setVolumeRampFromStartVolume:toEndVolume:timeRange: or explain best practices for automating parameter changes on a node over time?
Many thanks
The AVAudioEngine is a real-time engine, but AVMutableComposition seems to be a non-real-time object. Thus incompatible. An alternative is to build and insert your own fader real-time AUAudioUnit node..

Using Graphite/Grafana for non time based data

I have been reading through documentation and have been able to get Graphite to receive data I have been sending it. I can definitely see the benefit in tracking things like concurrent users and network load.
But now I have been tasked with implementing it on the client to show things like RAM, and CPU usage. In addition to this, I must also track actions (users buying things). Maybe I am missing a large chunk of the picture here, but I am not sure how I would do these things. Do I need a timestamp? I've also seen plugins for pie charts and such and this would indicate I could perhaps create graphs from devices with different statistics.
What am I missing?
I don't think you're missing anything.
Any data you send on to, say, InfluxDB (as that's what I've used the most) will be timestamped automatically when it arrives - unless you specify an explicit one yourself.
If you're showing, for example, CPU load you can write your query to pick up the latest value, or perhaps an average (mean value) over time, or the max or min over a period of time as appropriate.
Pie charts can also be used successfully to graph relationships over time.
The key is to create a specific query (I use SQL directly) to craft the data used for the panel type. There are excellent examples in the documentation.

Trying to Make Product Offering Option Selector with Lots of Rules

Summary:
The ultimate use for this workbook is to be able to build a components or bill of materials list. The difficulty comes into play because it is desired to be able to start with any component type and start narrowing down your options on other compatible components to ultimately build a product.
Every component option has it's own rules about which other component options that it is able to interface with. Options within the same component group are mutually exclusive and will never be used together. Each component type will always have one option chosen.
My Attempts:
Doing a bit of research on the www, I started with trying to create lists for the component options. I keep getting stuck with the rules of compatibility. I chose to call out "0" for component options that are compatible so that I could run a check to see if the sum of parts was greater than 0 (aka something wasn't compatible).
I also was starting down the path of using pull down lists under the Data Validation tools, but had trouble when it came to all of the restrictions.
Thank you in advance for any input. I would be happy to elaborate on any part of this request.
An example of how the output might look would be to have the options as pull-downs, but filtered out to not allow you to choose any option that isn't compatible with the other choices that you have already made. Here is an attempt to capture that.
example of output table

How to make directShow to Create graph automatically with available filters

I want to use the Medialooks multisource filter in my application, This has entry in
HKEY_CURRENT_USER\SOFTWARE\Classes\CLSID\
But still i have to Add this filter manually using CLS_ID and AddFilter Function.
Is there any way so that Renderfile function of Dshow will automatically creates a graph by enumerating the filters from registry
Checked in Grphedt tool but if i manually insert and connect Filters I can play the videos properly.Otherwise it wont render automatically by building the graph
Ability yo connect filters and obtain a topology of your interest is one thing, and having this sort of connection taking place during Intelligent Connect is another thing. For Intelligent Connect and RenderFile the filters of interest must be apparently registered, and then they have accurate DirectShow registration details: merit, media types. Quite so often filters are lacking this registration (and at other times they are "over-registrating" themselves so that they are picked up when they are obvious misfit).
Even though you can re-register filter yourself (see IFilterMapper2::RegisterFilter) with alternate registration details, you typically do not do it. It's filter developer's business to register accurately. The better alternative for you is to build graph using AddFilter calls where you have fine control over graph construction. Or you might want to do it as a fallback construction method if RenderFile fails in first place.

Resources