Calculate Inventory Utilization Over Time with Tableau - date

I would like to use Tableau to display how well different programs are utilizing their bed inventory over time. Each program has a set number of beds that can be made available to people who need them. People enroll with programs at different times, so each client has a unique enrollment start and end date (e.g., Client 1 enrolls with a program and has a bed from 1/1/2020 and leaves the program on 9/1/2020). At the same time, the program has dynamic inventory, meaning that the number of beds available can change throughout the year (e.g., 10 beds are available from 1/1/2020 through 1/31/2020, but 20 beds are available from 2/1/2020 to 6/1/2020).
The way I calculate utilization is to look at the number of nights a bed was used by a client versus the number of nights a bed is available through a program. For example, let's say a program has 10 beds available from 1/1/2020 to 1/31/2020. That means there were 10 beds available for 30 nights, or 300 "bed nights" in the period. During that period, there were 8 clients with enrollment start and end dates overlapping with this inventory period in different ways. One client was in the program from 1/1/2020 and left on 1/11/2020 (10 bed nights used), another client was in the program from 1/15/2020 and left on 1/20/2020 (4 bed nights used), and so forth for the other 6 clients. Let's say that in total, clients used 250 bed nights between 1/1/2020 and 1/31/2020. That results in 250 bed nights used out of 300 bed nights available in the given period, or a utilization rate of 83.3%. This utilization rate is what I want to calculate and display over time in Tableau.
The complicated part of this effort is that client enrollments and inventory availability both change over time. That means that I can have a client actively using a bed for several months while the available inventory is changing. Also, clients and inventories may have NULL end dates because they are currently active (or at least were active at the point the data was collected).
How can I dynamically calculate utilization rates for this use case? I have explored date scaffolding, but all of the examples I've found so far rely on only 2 dates, not 4 (as is the case with my data).
Here are some example client data (that should be paste-able within text document):
client id,program id,enroll_start,enroll_end
1,1,1/1/2020,9/1/2020
2,1,6/1/2020,
3,1,1/1/2021,7/1/2021
4,1,6/1/2021,3/1/2022
5,1,6/1/2022,
6,1,1/1/2020,
7,1,6/1/2020,9/1/2020
8,1,1/1/2021,
9,1,6/1/2021,12/1/2021
10,1,6/1/2022,
11,2,1/31/2020,10/1/2020
12,2,7/1/2020,
13,2,1/31/2021,7/31/2021
14,2,7/1/2021,3/31/2022
15,2,7/1/2022,
16,2,1/31/2020,
17,2,7/1/2020,10/1/2020
18,2,1/31/2021,
19,2,7/1/2021,12/31/2021
20,2,7/1/2022,
21,3,1/11/2021,
22,3,1/1/2020,6/5/2020
23,3,3/1/2020,6/5/2020
24,3,4/1/2020,6/5/2020
25,3,5/1/2020,6/5/2020
26,3,1/1/2022,
27,3,2/1/2022,
28,3,3/1/2022,
29,3,4/1/2022,
30,3,5/1/2022,
Here are some example program inventory data:
program id,inventory_start,inventory_end,beds
1,1/1/2020,12/31/2021,8
1,1/1/2021,12/31/2022,10
1,1/1/2022,,8
2,1/15/2020,12/15/2020,15
2,1/1/2021,,10
3,1/1/2020,6/5/2020,5
3,1/2/2022,,10
Any help would be much appreciated!

Related

AnyLogic -- How run production line 15 hours per day & machine show malfunctioning 3 times in 10 days?

Part one:
How can I run a production line only for 15 hours per day?
My logic
Part Two:
How to implement a machine malfunctioning 3 times in 10 days?
I achieved the malfunctioning of a machine using this logic.
if(countAssembler==10){
self.suspend(agent);
create_MyDynamicEvent(2, HOUR,agent);
}
But malfunctioning is occurring on item count (i.e. countAssembler==10) right now. I want it to occur after 3 days.
part 1
To make the services work for a period of time every day, you need resources to be used in those services, and the resources to be subjected to a schedule. The schedule is an object that you can find in the process modeling library and there's a ton of documentation and examples on how to use them. Review the help documentation.
part 2
There's a block in the process modeling library called downtime. Again there's a ton of documentation and examples on how to use this for any model. Then you don't need any java code

How to create an hourly arrival rate schedule based on route costs and agent choices?

I am building a model in Anylogic where customers order containers at terminals with a starting hourly rate (which differs per hour), which I load from database to a schedule and then let the customers order at every terminal with the rate of the schedule. When they have ordered, a truck will bring the container from terminal to customer.
However, I want to give each possible route for the trucks (directly or via a hub that is open at night) some costs (depends on time of day and travel time). Depending on these costs, the agents choose which route to take and (as the hub route is partly done at night) at what time to travel. The choices are:
Travel directly (arrive at the terminal at day time)
Travel via hub (arrive at the terminal at night time)
Thus, I want to let the hourly arrival rate schedule change based on the choices agents make after calculations. Does anybody know how to let the arrival rate schedule (different per hour) change depending on agent choices (based on route costs)?
Based on your answers, you don't really need to change the hourly order rate schedule, rather you need to choose when to deliver the containers to the customers. For this, place the arrived orders in a queue and process them with FIFO principle (or LIFO, whichever priority you assign them).
But if you insist on having different hourly order rates, you can use the following approach. So, if you want to distribute 10 arrivals during an hour, you can use exponential(10) as the interarrival distribution. Please see the screenshot below. I update the variable trucks1 dynamically during the simulation to have different number of arrivals for different hours.

Is this an intelligent use case for optaPlanner?

I'm trying to clean up an enterprise BI system that currently is using a prioritized FIFO scheduling algorithm (so a priority 4 report from Tuesday will be executed before priority 4 reports from Thursday and priority 3 reports from Monday.) Additional details:
The queue is never empty, jobs are always being added
Jobs range in execution time from under a minute to upwards of 24 hours
There are 40 some odd identical app servers used to execute jobs
I think I could get optaPlanner up and running for this scenario, with hard rules around priority and some soft rules around average time in the queue. I'm new to scheduling optimization so I guess my question is what should I be looking for in this situation to decide if optaPlanner is going to help me or not?
The problem looks like a form of bin packing (and possibly job shop scheduling), which are NP-complete, so OptaPlanner will do better than a FIFO algorithm.
But is it really NP-complete? If all of these conditions are met, it might not be:
All 40 servers are identical. So running a priority report on server A instead of server B won't deliver a report faster.
All 40 servers are identical. So total duration (for a specific input set) is a constant.
Total makespan doesn't matter. So given 20 small jobs of 1 hour and 1 big job of 20 hours and 2 machines, it's fine that it takes all small jobs are done after 10 hours before the big job starts, given a total makespan of 30 hours. There's no desire to reduce the makespan to 20 hours.
"the average time in the queue" is debatable: do you care about how long the jobs are in the queue until they are started or until they are finished? If the total duration is a constant, this can be done by merely FIFO'ing the small jobs first or last (while still respecting priority of course).
There are no dependencies between jobs.
If all these conditions are met, OptaPlanner won't be able to do better than a correctly written greedy algorithm (which schedules the highest priority job that is the smallest/largest first). If any of these conditions aren't met (for example you buy 10 new servers which are faster), then OptaPlanner can do better. You just have to evaluate if it's worth spending 1 thread to figure that out.
If you use OptaPlanner, definitely take a look at real-time scheduling and daemon mode, to replan as new reports enter the system.

What do we mean by "top percentile" or TP based latency?

When we discuss performance of a distributed system we use the terms tp50, tp90, tp99.99 TPS.
Could someone explain what do we mean by those?
tp90 is a maximum time under which 90% of requests have been served.
Imagine you have times:
10s
1000s
100s
2s
Calculating TP is very simple:
sort all times in ascending order: [2s, 10s, 100s, 1000s]
find latest item in portion you need to calculate. For TP50 it will ceil(4*.5)=2 requests. You need 2nd request. For TP90 it will be ceil(4*.9)=4. You need 4th request.
get time for the item found above. TP50=10s. TP90=1000s
Say if we are referring to in-terms of performance of an API, TP90 is the max time under which 90% of requests have been served.
TPx: Max response time taken by xth percentile of requests.
time taken by 10 requests in ms [2,1,3,4,5,6,7,8,9,10] - there are 10 response times
TP100 = 10
TP90 = 9
TP50 = 5

Mashery Quotas: Calls per "day" or calls per "24-hours"?

I am accessing an API hosted by Mashery with the following rate limit:
5 calls per second
10,000 calls per day
Does that imply that I can make 10,000 requests at 6:00PM, and then make another 10,000 requests at midnight? Or, does it mean I can only make 10,000 requests within any 24-hour period?
For example, does it mean that if I make 10,000 requests between 6:00PM one day, and 6:00PM the next, that I have to wait until 6:00:01PM before I can make another request. And then, at most I can make requests at the same rate I made the day prior (as the 24-hour period continuously shifts)?
I apologize if this is off-topic. I have a support request in for clarification, but I don't think they'll get back to me any time soon, and I figured that someone here would be familiar with the limits.
The limit is set per Calendar date and resets every midnight GMT time.
So for example if you made 10,000 calls at 6pm pacific (which is 2am GMT) you would have to wait 22 hours until 4pm pacific (which is midnight GMT) until you can start using your next batch of 10,000 daily calls.
Hope that answers your question.
Thanks,
Shai Simchi
Mashery Customer Support