Hungerian Algorithm ( Assignment Model ) - hungarian-algorithm

Duty 1 Duty 2 Duty 3 Duty 4
Staff 1 $50 $50 - $20
Staff 2 $70 $40 $20 $30
Staff 3 $90 $30 $50 -
Staff 4 $70 $70 $60 $20
Note that Staff 1 cannot do Duty 3 and Staff 3 cannot do Duty 4.
Any ideas how to find values that are (-), or how to solve this problem using the Hungarian algorithm?

Related

Query that references itself

I want to create a self referencing and shifting basked of stocks (similar to methodologies used by S&P for the S&P 500). The goal is to create an index that changes structure every month. It guarantees a spot for the first stock by market cap (rank). The 2nd spot goes to the stock that has been in the previous months' lineup and ranks between 2 and 3 this month. If that stock ranks lower than 3, it will get excluded and a new stock slots into its' place. Else, the next closest stock will get chosen.
Give the table below, the index would include the following stocks:
2020-01-01 – AAPL + MSFT
2020-02-01 – AAPL + MSFT
2020-03-01 – APPL + GOOG
In my real data, I obviously have many more stocks and many more months. I am having a very hard time modeling the second case in Postgres since it requires me to create a continuously updated "previous months" table that I need to reference when checking the current month. Any idea how to do this in PostgreSQL? I tried recursive CTEs and those didn't work (due to inner join requirements)
Table with structure below.
date
stock
rank
2020-01-01
AAPL
1
2020-01-01
MSFT
2
2020-01-01
META
3
2020-01-01
GOOG
4
2020-02-01
AAPL
1
2020-02-01
MSFT
3
2020-02-01
META
2
2020-01-01
GOOG
4
2020-03-01
AAPL
1
2020-03-01
MSFT
4
2020-03-01
META
3
2020-01-01
GOOG
2

Creating a parameter filter to pick out consecutive data (Tableau Desktop)

I have a data set as following:
week number
date
item
location
Out of stock %
23
2022-06-05
apple
Seattle
55%
23
2022-06-06
apple
Seattle
60%
23
2022-06-07
apple
Seattle
50%
23
2022-06-08
apple
Seattle
50%
23
2022-06-09
apple
Seattle
50%
23
2022-06-10
apple
Seattle
50%
23
2022-06-11
apple
Seattle
60%
23
2022-06-06
orange
California
10%
23
2022-06-07
orange
California
5%
23
2022-06-08
orange
California
5%
23
2022-06-09
orange
California
30%
23
2022-06-06
orange
California
20%
23
2022-06-07
orange
California
10%
23
2022-06-08
orange
California
2%
My desired output is to have an Out of stock filter for the viewers so that when they enter a certain value, it returns a list of a certain week in which the out of stock is no lesser than the certain value.
For example, if I enter 40% in the filter, then apple at Seattle would only show up.
This apple would be then marked as continuously out of stock. Please help me!

Group Mulitple Rows into 1 email in mail merge

I have to send an email out to all the team managers of my company providing the individual stats for each member of their team. Unfortunately I am not very well acquainted with mail merge and have been running into multiple knowledge gaps. I was hoping somebody here could help me understand how I can do this. If the sample data looks like this:
TM Email
Employee Name
Call Goal
Actual
% Goal Met
# of Audits
Accuracy
email1#fakeemail.com
John Doe
100
50
50%
4
92%
email1#fakeemail.com
Jane Doe
100
50
50%
4
92%
email1#fakeemail.com
Eric Stultz
100
50
50%
4
92%
email1#fakeemail.com
Christian Noname
100
50
50%
4
92%
email1#fakeemail.com
Fakename Mcgee
100
50
50%
4
92%
email1#fakeemail.com
senor chapo
100
50
50%
4
92%
email2#mail.com
Duck Werthington
100
50
50%
4
92%
email2#mail.com
Myster Eeman
100
50
50%
4
92%
email2#mail.com
Ion No
100
50
50%
4
92%
email2#mail.com
No Idea
100
50
50%
4
92%
email2#mail.com
Mail Man
100
50
50%
4
92%
Assume that there are over 2 dozen Team Managers with varying team sizes. and the email will be sent in the same format as listed above. How would I go about this, I don't even know where to begin. Please help.

Calculate the time for executin instructions with pipeline

Suppose that one instructions requires 10 clock cycles from fetch state to write back state. And we want to calculate the time required to execute 1,000,000 instructions. Each clock cycle takes 2 ns.
(a) Calculate the time required.
The answer says that 1,000,009*2 ns. The last digit 9 is for the number of clock cycles for filling the pipeline. Why is this?? I thought since each instruction fetch is happenin in each clock cycle, it would be 1000000*2 ns.
1 2 3 4 5 6 7 8 9 0
1 2 3 4 5 6 7 8 9 0
1 2 3 4 5 6 7 8 9 0
Let's consider these three instructions.Here you can see for the first instruction it has taken 10 clock cycles and and when coming to next two it will only take 2 more clock cycles, so that for the rest 999 999 instructions it will take more 999 999 clock cycles.Therefore 1 000 000 instructions it will take (10+999 999) 1 000 009 clock cycles.

Tableau - % of Unique Metric by Different Unique Metric

I have Customer ID, Product ID, and Industry columns. For example:
**CustomerID ProductID Industry**
1 A Entertainment
1 B Entertainment
2 A Entertainment
3 A Entertainment
4 A Entertainment
4 B Entertainment
4 A Cleaning
I have a grid set up with industry for my columns and Product ID for my rows.
For example,
Entertainment Cleaning
A
B
I'm trying to find the % of customers in a specific industry purchasing each product.
In other words the (number of unique customers by Product ID)/(Unique customers in each industry).
The numerator is: COUNTD([Customer ID])
The denominator is throwing me off. I'm not sure how to get unique customers in a segment.
In the example above, product A has 4 unique customers in the Entertainment industry, and Entertainment has 4 unique customers for all products, so the calculation for product A would 4/4 or 100%.
But product B would be 2 unique customers / 4 total unique customers in Entertainment or 50%.
Does anyone know how I create the calculation for the denominator.
COUNTD([Customer ID])/???