Algorithm to schedule weighted events, with different amount of participants to limited set of rooms - scheduled-tasks

I've been reading tons of material about dynamic programming, back tracking, linear programming, etc but cant seem to find or understand what type of algorithm best suits my problem.
The problem:
I have a list of events, each are given a priority based on some condition (irrelevant to the question). Each event has a start & end time, plus the number of participants.
I have a list of meeting rooms and each meeting room has a capacity (number representing how many participants it can hold). Given this constraint, each event has an additional list, which represents the potential meeting rooms it can be assigned to (meeting room capacity - event participants > 0).
The algorithm only runs for the events of the current day, so its constrained to the 24 hours of a day.
Additional constraints:
It doesnt matter if an event cant be assigned
An event cant be assigned if it means another event with greater priority is left with no available room in their potential room list
In conclusion, the idea is to assign the maximum number of events we can, given that no event with greater priority than any of the assigned ones has no room. The return value shouldnt be a number representing this number, but a list for each room that holds the events that were actually assigned to it

Related

Mean statistics about agents in Anylogic

I'm working on a family practitioner model, my goal is to model the population of a city and all of the family practitioners in that given city by taking into account the distribution of the treatment time and the arrival schedule of patients etc... So far i've managed to create an agent that contains a bloc diagram to model the whole process
With a source and a delay bloc to generate patients according to a fixed schedule, a service bloc and two sinks.
Now i've put a population of this agent "process" in the main and i've simulated the model for 3 months.
Lets say i've started with a population of 10 process which represents the number of practitioners. My goal now to to collect some Mean statistics, like the Mean number of treated patients (treated patients goes to the sink "Served") of the 10 practitioners, the Mean waiting time of patients at the service bloc, the mean utilization ratio of the resource of the service bloc...
I want to also know if is it possible to limit the total number of Patients (or to at least count them), for exemple, instead of simulating the model for 3 months, i wanna limit the total number of patients that goes to the 10 process to 10k and i want to know how much time does it take to serve all of them. (is it possible with this architecture of the model or do i have to make major changes)
Thank you

Multi pickup locations for a single delivery

I have a list of orders, each consists of a disjunction of pickup and a disjunction of delivery nodes (using AddDisjunction with a positive penalty and max cardinality of 1).
Some of these orders form groups that must be delivered to the same location at the same time by the same vehicle, or not at all.
AddPickupAndDelivery/AddPickupAndDeliverySets cannot be used on the same node/disjunction twice so I cannot merge the delivery disjunctions into one and link all pickup disjunctions to it.
I have tried setting the NextVar of one delivery disjunction to the other delivery disjunction, however the other disjunction was still sometimes reached without the first one (but not vice versa).
I have tried combining the NextVar method with giving penalty for reaching only part of the delivery nodes, in two different ways:
first by using AddSoftSameVehicleConstraint, however it did not give penalty for unperformed nodes,
second by creating a new dimension with positive arc values for reaching all disjunctions other than the first one in the NextVar chain, and a negative arc value for reaching the latter, which is the only one that can be reached only if all the rest of the disjunctions were reached. Combined with SetSpanCostCoefficientForAllVehicles and a big cumul var start value at the start nodes, the idea was that reaching part of the nodes would induce a positive span, while reaching all of them would reset the span back to 0.
However at this point the algorithm stopped reaching any nodes, I presume due to the fact that the local search operators do not include a single addition of multiple nodes, and each addition of a single node induces a higher cost. Is there a way of implementing multiple pickups to a single delivery which abides the constraints I have stated while using the python version of or-tools?

Is there a way to record when (and how often) Transporters get within a certain distance of each other?

I have an AnyLogic simulation model using trucks and forklifts as agents (Transporter type), and among other things would like to identify each time one of them becomes within a certain distance of another one (example within 5 meters). I will record this count as a variable within the main space of the model. I am using path-guided navigation.
I have seen a method "agentsInRange" which will probably be able to do the trick, but am not sure where to call this from. I assume I should be able to use the AL functionality of "Min distance to obstacle" (TransporterFleet) and "Collision detection timeout" (TransporterControl)?
Thanks in advance!
Since there don't seem to be pre-built functions for this, afaik, the easiest way is to:
add an int variable to your transporter agent type counter
add an event to your transporter type checkCollision that triggers every second or so
in the event, loop across the entire population of transporters and count the number that are closer than X meters (use distanceTo(otherTransporter) and write your own custom code)
add that number to counter
Note that this might be very inefficient computationally as it is quite brute-force. But might be good enough :)

Reporter: Contact duration and gap times

I'm struggling with this for the past week... I would like to build three reporters (so I can extract these info) of:
The duration of contacts between pairs of agents (i and j).
The gap between consecutive contacts between pairs of agents (i and j).
Number of contacts that an agent has.
If you can give a (small) push in the right direction, I would be grateful!
If I have interpreted this correctly, this is something I would probably do with links (though the table suggestion by #Alan may be quicker). Create a link between pairs of agents as they make contact and the link can have attributes such as duration, time (tick) of previous contact, maximum time between contacts, number of contacts.
The problem is that the number of ties is going to be N(N-1)/2 where N is number of agents. For large N, I suspect this would be fairly slow, at least to create the links. If you are expecting a dense network, with most agents contacting each other, then create all the links during setup and simply update the attributes. If a sparse network, with each agent contacting only a limited number of others, create the link at initial contact.

how to make live scoreboard in netlogo?

i am working on the simulation of coalition in agent society. Agents (turtles) form coalition dynamically and after some times they left current coalition and joined other one. Hence, number of members (turtles) in the coalition vary on every tick. Some times because of no member in the coalition, coalition vanishes and some times two or more than two members (turtles) form the new coalition. I want to have live score board in simulation, which gives updated stats about the coalition and its members. For instance, how many coalition currently exist, what are the names of the coalition and how many members in each coalition. Could any one guide me which feature should i use to develop the live score board? Any guidance would be highly appreciated.
The monitor widget is the best option for current count of coalition membership (or plot if you want it over time). For more detailed information, have a look at using the output area with commands such as output-show to provide the information.