Excel Solver solver is messing up my optimization - excel

I have set up an optimization problem but i must be doing something wrong and I could use your help. I have three firms: alpha, Bravo, Charlie. They each complete three tasks: Milling, Inspecting, Drilling. They each require different amounts of minutes to complete each task. Alpha requires 12 minutes to mill, 5 minutes to inspect and 10 minutes to drill. Bravo requires 10 minutes to mill, 4 to inspect, and 8 to drill. Charlie requires 8 to mill, 4 to inspect, and 16 to drill. After each firm completes all of these tasks they will earn a certain amount of profit, Alpha will earn $2.40, Bravo will earn $2.50, and Charlie will earn $3.00. All three firms have a maximum allotted time of 1200 minutes to mill, 900 to inspect, and 1440 to drill. The goal is to maximize the profit of these three firms. I have set it up so that the sums of the tasks will take away from the available time left when changed by the solver. I have also set constraints within the solver to cap each task to the allotted time allowed per task. I must be missing a vital step however because it keeps trying to just max out the allotted time for an individual firm, not taking in to account the opportunity cost of the other firms or something. Please help! (shown in photos)
Data
Solver
After executing Solver

I have changed the logic a bit different in order to take the minimum unit into consideration:
UNITS portion are the variable cells. Since the final produced unit will be the minimum of these cells, E9 formula is =MIN(B9:D9) and copied down.
TIME portion is multiplication of Unit Times and Units. So the formula of B14 is =B9*B2 and copied down & right.
I9:I11 are the earnings calculated by multiplying the unit earning with the minimum units
I12 is our total earning and is our Objective cell.
Please also be careful about the constraints since when you do not set an integer constrain, finding a solution becomes more difficult and of course our units should be integer in any case.
And also fill B9:D11 cells with some values such as 100, since otherwise iteration does not start correctly and solver ends up with a very small objective cell.

I have just had a go at this and I get a different answer as I have made the assumption that to achieve the profit the company must complete a milling process, then inspect, then drill and once all are complete then that is 1 unit for the profit - I hope that is valid.
But if not, then this layout may help you anyway. Note I have set this as a Linear model for the solver and also note the use of integer and non-negative.
It was fun anyway !

Related

Number of days for delivery and number of orders delivered in two separate columns. Is there a way to get summary statistics about orders?

I've had a bit of trouble explaining this so please bear with me. I'm also very new to using excel so if there's a simple fix, I apologize in advance!
I have two columns, one listing number of days starting from 0 and increasing consecutively. The other column has the number of orders delivered. The two correspond to each other. For example, I've typed out how it would look below. It would mean that there were 100 orders delivered in 1 day, 150 orders delivered in 2 days, 800 orders delivered in 3 days, etc.
Is there a way to get summary statistics (mean, median, mode, upper and lower quartiles) for the number of days it took for the average order to get delivered? The only way I can think of solving this is to manually punch in "1" 100 times, "2" 150 times, etc. into a new column and take median, mean, and upper & lower quartile from that, but that seems extremely inefficient. Would I use a pivot table for this? Thank you in advance!
I tried using the data analysis add-on and doing summary statistics that way, but it didn't work. It just gave me the mean, median, mode, and quartiles of each individual column. It would have given me 3 for median number of days for delivery and 300 for median number of orders.
Method 1
The mean is just
=SUMPRODUCT(A2:A6,B2:B6)/SUM(B2:B6)
Mode is the value with highest frequency
=INDEX(A2:A6,MATCH(MAX(B2:B6),B2:B6,0))
The quartiles and median (or any other quantile by varying the value of p) from first principles following this reference
=LET(p,0.25,
values,A2:A6,
freq,B2:B6,
N,SUM(freq),
h,(N+1)*p,
floorh,FLOOR(h,1),
ceilh,CEILING(h,1),
frac,h-floorh,
cusum,SCAN(0,SEQUENCE(ROWS(values)),LAMBDA(a,c,IF(c=1,0,a+INDEX(freq,c-1)))),
xlower,XLOOKUP(floorh-1,cusum,values,,-1),
xupper,XLOOKUP(ceilh-1,cusum,values,,-1),
xlower+(xupper-xlower)*frac)
Method 2
If you don't like doing it this way, you can always expand the data like this:
=AVERAGE(XLOOKUP(SEQUENCE(SUM(B2:B6),1,0),SCAN(0,SEQUENCE(ROWS(A2:A6)),LAMBDA(a,c,IF(c=1,0,INDEX(B2:B6,c-1)+a))),A2:A6,,-1))
=MODE(XLOOKUP(SEQUENCE(SUM(B2:B6),1,0),SCAN(0,SEQUENCE(ROWS(A2:A6)),LAMBDA(a,c,IF(c=1,0,INDEX(B2:B6,c-1)+a))),A2:A6,,-1))
=QUARTILE.EXC(XLOOKUP(SEQUENCE(SUM(B2:B6),1,0),SCAN(0,SEQUENCE(ROWS(A2:A6)),LAMBDA(a,c,IF(c=1,0,INDEX(B2:B6,c-1)+a))),A2:A6,,-1),1)
=MEDIAN(XLOOKUP(SEQUENCE(SUM(B2:B6),1,0),SCAN(0,SEQUENCE(ROWS(A2:A6)),LAMBDA(a,c,IF(c=1,0,INDEX(B2:B6,c-1)+a))),A2:A6,,-1))
and
=QUARTILE.EXC(XLOOKUP(SEQUENCE(SUM(B2:B6),1,0),SCAN(0,SEQUENCE(ROWS(A2:A6)),LAMBDA(a,c,IF(c=1,0,INDEX(B2:B6,c-1)+a))),A2:A6,,-1),3)

Calculating number of hours spent per product, with diminishing effort

I want to calculate the number of work hours it takes to produce X. The first X takes 20 hours, but for each X it takes 20% less time. However, it will always take a minimum of 2 hours.
Any help is appreciated.
In Excel, this is really easy: 20% less means you are calculating 80% of the value, which in fact means that you are multiplying the value with 0.8.
As the value can't go below 2, you can simply take the maximum between the calculated value and 2, using the formula:
=MAX(2,0.8*A1)
The result looks as follows:
Have fun!
In order to calculate the sum, you can use the simple formula =SUM(A$1:A2) up to the end, as you can see in following screenshot:
An individual term of a geometric series is given by
The sum of a geometric series is given by
where in your case a=20 and r=0.8
You can show by taking logs or by trial and error that in your particular case you have
0.8^10 = 0.107374
so when n=11 you can see that the time has diminished to just over 2 hours. After that each rep takes 2 hours. So you have
=a*(1-r_^MIN(C2,11))/(1-r_)+MAX(0,C2-11)*2
for the total.
If you just want the time per item, it's
=IF(C2<=11,a*r_^(C2-1),2)
where a and r_ are named ranges for a and r, and the values of N are in column C.

How do I transform my maths totals into a time duration?

At work we use a spreadsheet to calculate how long delivery will take to complete, depending on people working on delivery and the amount we receive.
It frustrates me that we end up with a value of say 3.75 hours.
The .75 actually represents .75 of an hour and not 1hr 25minutes like you may first have thought.
I'm wanting the spreadsheet to say the time 3:45 minutes, not 3:75 minutes.
Is this even possible?
It gets more tricky though as we have to assume we will process 200 pieces per hour so the formula is slightly backwards. For example:
Fill Grade: 55 (pieces in each crate)
Crates: 10
Total Pieces 550 (fill grade * crates)
Process Time: (total pieces /200)
Clear rail time (puting stock out on shop floor, total pieces/400)
Total time = ???
I'm wanting to do this because of the stupidity of our current system. We print the spreadsheet then use a calculator to add up all the values. We are effectively just using the grid of the Excel spreadsheet to rota in people's time.
***** Updated information *****
Click here to see a screenshot of the current situation.
You can see that 'Pro Time' and 'C/R Time' is now correct but the total is wrong. I'm also having to total 'Pro Time' and 'C/R Time' by adding up in the boxes just to the right-hand side as you can see.
Advice?
The way to do this is whatever your formula in Total time is - let's assume it is (Process Time + Clear Rail time), then enter the formula there as (Process Time + Clear Rail time)/24.
IMP: That divide by 24 should be included, which is an addition to whatever formula you had there before.
Then select your Total Time column>> Format Cells (also Ctrl+1)>>Select Time (HH:MM:SS type)
This will show your value in hours, mins and seconds.
PS: (based on comments) IMP - if you use divide by 24 on on Process Time and Clear Rail Time, then you should not use it on Total Time, as the conversion is already done. In such a case, Total time is just addition of the previous two.
Illustrative Image
Take the fractional(modulus) part e.g. the .75. divide by 100 and then multiply by 60. (or just simply multiply by 0.6.
e.g. (where C4 contains the hours and centi hours (if that's the correct term).
=MOD(C4,1) * 0.6
Assuming the above is in D4 ..
Then in E4 =INT(C4)+D4
However datetime might be a better route. Note sue of the functions but then you could add. In short datetime, if I recall correctly is a number eg something like Date+1 adds a day.

How do I use Goalseek function in excel to generate a series?

am struggling with the application of goal seek function in excel. Am forecasting production for an oil well however we have a target cumulative production expected after say 20 years of production. I have produced table columns of monthly production rate and cumulative production. I would like to play (create sensitivity scenarios) with my expected cumulative production.
Can i use goal seek to change the production forecast profile per month by just changing the cumulative production at the end.
Also advise alternative functions should goal seek not be the right function for this task.
Appreciate your support
This is really just an example of what #DanK has already mentioned. Say ColumnB figures are actual production (in black) and estimates (in blue). The estimates in this case computed as number of days in the month times the factor in D1 ("daily production"). To ramp up production so that the total cumulative production (in the example below, for 1-1/2 years, rather than all 20 as in the example above), presently estimated to be 115,620 units is instead 150,000 then Goal Seek might be applied so:
whereupon the D1 value (200) should change to 287 (and the total in B19 to 150,000, and all the blue values change also). The principle should work if, say, June 2015 were calculated as 16*D1 rather than 30*D1 to allow for planned suspension of production. If that fortnight were an intervention to add production from another reservoir anticipated to be 100 per day then Goal Seek would not adjust "100 per day" but would adjust a new daily rate of 1.5*D1.

How can I implement 'balanced' error spreading functionality in Excel?

I have a requirement in Excel to spread small; i.e. pennies, monetry rounding errors fairly across the members of my club.
The error arises when I deduct money from members; e.g. £30 divided between 21 members is £1.428571... requiring £1.43 to be deducted from each member, totalling £30.03, in order to hit the £30 target.
The approach that I want to take, continuing the above example, is to deduct £1.42 from each member, totalling £29.82, and then deduct the remaining £0.18 using an error spreading technique to randomly take an extra penny from 18 of the 21 members.
This immediately made me think of Reservoir Sampling, and I used the information here: Random selection,
to construct the test Excel spreadsheet here: https://www.dropbox.com/s/snbkldt6e8qkcco/ErrorSpreading.xls, on Dropbox, for you guys to play with...
The problem I have is that each row of this spreadsheet calculates the error distribution indepentently of every other row, and this causes some members to contribute more than their fair share of extra pennies.
What I am looking for is a modification to the Resevoir Sampling technique, or another balanced / 2 dimensional error spreading methodology that I'm not aware of, that will minimise the overall error between members across many 'error spreading' rows.
I think this is one of those challenging problems that has a huge number of other uses, so I'm hoping you geniuses have some good ideas!
Thanks for any insight you can share :)
Will
I found a solution. Not very elegant, through.
You have to use two matrix. In the first you get completely random number, chosen with =RANDOM() and in the second you choose the n greater value
Say that in F30 you have the first
=RANDOM()
cell.
(I have experimented with your sheet.)
Just copy a column of n (in your sheet 8) in column A)
In cell F52 you put:
=IF(RANK(F30,$F30:$Z30)<=$A52, 1, 0)
Until now, if you drag left and down the formulas, you have the same situation that is in your sheet (only less elegant und efficient).
But starting from the second row of random number you could compensate for the penny esbursed.
In cell F31 you put:
=RANDOM()-SUM(F$52:F52)*0.5
(pay attention to the $, each random number should have a correction basated on penny already spent.)
If the $ are ok you should be OK dragging formulas left and down. You could also parametrize the 0.5 and experiment with other values. With 0,5 I have a error factor (the equivalent of your cell AB24) between 1 and 2

Resources