Re: Reverse engineer prices an an Insurance Plan
(Sorry for the late response. I'm recovering from major surgery, and my attention span has been limited.)
I suspect that Solver cannot solve this.
Actually, it can. I agree that Worf's LP model does not make sense. But it is true: with a correct LP model (and even with Worf's), Solver can find many solutions using the Simplex LP method. But as I demonstrate below, it is more work than necessary.
I also don't believe your method (allocating according to percentage differences) makes much sense. Arguably, it's not wrong. It's just arbitrary. The fact is: the percentage differences are constant, regardless of the solution -- as you proved.
In fact, as I demonstrate below, there is an
"infinite" number of solutions. Actually, the number of solutions is limited by the 2-decimal-place precision of the solutions.
Your approach of looking at the differences of total costs is good. But I think you over-complicated it.
We can use the BAA-AAA and CAA-BAA to derive the incremental differences between HA, HB and HC. Similarly, ABA-AAA and ACA-ABA derive the incremental differences between DA, DB and DC; and AAB-AAA and AAC-AAB derive the incremental differences between PA, PB and PC.
(Of course, we would use BAA-AAA and CAA-AAA to derive differences from AAA instead of incremental differences. But the latter information might be of some use to you.)
Then, we can allocate the total cost of AAA among HA, DA and PA
randomly (!). Yes, 58%, 35% and 7% are possible. But any other percentage allocation is equally possible.
The following is one implementation. Press f9 repeatedly to see many solutions. Note that the relationships among HA, DA and PA can vary arbitrarily. For example, HA<=DA and HA>=DA are both possible.
(FYI, I have had trouble posting Excel HTML to this forum. I don't know what my problem is. Y'all do so much better than I.)
[TABLE="class: grid, width: 500"]
<tbody>[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]
[TH][/TH]
[TH]A[/TH]
[TH]B[/TH]
[TH]C[/TH]
[TH]D[/TH]
[TH]E[/TH]
[TH]F[/TH]
[TH]G[/TH]
[TH]H[/TH]
[TH]I[/TH]
[TH]J[/TH]
[TH]K[/TH]
[/TR]
[TR]
[TD="align: center"]5[/TD]
[TD="align: right"][/TD]
[TD="align: right"]H[/TD]
[TD="align: right"]D[/TD]
[TD="align: right"]P[/TD]
[TD="align: right"][/TD]
[TD]Random:[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"]Random
Sum:[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: center"]6[/TD]
[TD]A[/TD]
[TD="align: right"]10.45[/TD]
[TD="align: right"]33.82[/TD]
[TD="align: right"]25.23[/TD]
[TD="align: right"][/TD]
[TD="align: right"]0.306548[/TD]
[TD="align: right"]0.992216[/TD]
[TD="align: right"]0.740324[/TD]
[TD="align: right"]2.039088[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: center"]7[/TD]
[TD]B[/TD]
[TD="align: right"]29.55[/TD]
[TD="align: right"]45.22[/TD]
[TD="align: right"]27.63[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: center"]8[/TD]
[TD]C[/TD]
[TD="align: right"]42.05[/TD]
[TD="align: right"]75.62[/TD]
[TD="align: right"]44.13[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: center"]9[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: center"]10[/TD]
[TD="align: center"]Orig
Row#[/TD]
[TD]H[/TD]
[TD]D[/TD]
[TD]P[/TD]
[TD="align: right"]H[/TD]
[TD="align: right"]D[/TD]
[TD="align: right"]P[/TD]
[TD="align: right"]Orig
H+D+P[/TD]
[TD="align: right"]Rand
H+D+P[/TD]
[TD="align: right"]Orig
=Rand?[/TD]
[TD="align: right"]#Orig
=Rand[/TD]
[/TR]
[TR]
[TD="align: center"]11[/TD]
[TD="align: center"]11[/TD]
[TD]A[/TD]
[TD]A[/TD]
[TD]A[/TD]
[TD="align: right"]10.45[/TD]
[TD="align: right"]33.82[/TD]
[TD="align: right"]25.23[/TD]
[TD="align: right"]69.50[/TD]
[TD="align: right"]69.50[/TD]
[TD="align: right"]TRUE[/TD]
[TD="align: right"]27[/TD]
[/TR]
[TR]
[TD="align: center"]12[/TD]
[TD="align: center"]12[/TD]
[TD]A[/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD="align: right"]10.45[/TD]
[TD="align: right"]33.82[/TD]
[TD="align: right"]27.63[/TD]
[TD="align: right"]71.90[/TD]
[TD="align: right"]71.90[/TD]
[TD="align: right"]TRUE[/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: center"]13[/TD]
[TD="align: center"]26[/TD]
[TD]A[/TD]
[TD]A[/TD]
[TD]C[/TD]
[TD="align: right"]10.45[/TD]
[TD="align: right"]33.82[/TD]
[TD="align: right"]44.13[/TD]
[TD="align: right"]88.40[/TD]
[TD="align: right"]88.40[/TD]
[TD="align: right"]TRUE[/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: center"]14[/TD]
[TD="align: center"]13[/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]A[/TD]
[TD="align: right"]10.45[/TD]
[TD="align: right"]45.22[/TD]
[TD="align: right"]25.23[/TD]
[TD="align: right"]80.90[/TD]
[TD="align: right"]80.90[/TD]
[TD="align: right"]TRUE[/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: center"]15[/TD]
[TD="align: center"]14[/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]B[/TD]
[TD="align: right"]10.45[/TD]
[TD="align: right"]45.22[/TD]
[TD="align: right"]27.63[/TD]
[TD="align: right"]83.30[/TD]
[TD="align: right"]83.30[/TD]
[TD="align: right"]TRUE[/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: center"]16[/TD]
[TD="align: center"]27[/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD="align: right"]10.45[/TD]
[TD="align: right"]45.22[/TD]
[TD="align: right"]44.13[/TD]
[TD="align: right"]99.80[/TD]
[TD="align: right"]99.80[/TD]
[TD="align: right"]TRUE[/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: center"]17[/TD]
[TD="align: center"]32[/TD]
[TD]A[/TD]
[TD]C[/TD]
[TD]A[/TD]
[TD="align: right"]10.45[/TD]
[TD="align: right"]75.62[/TD]
[TD="align: right"]25.23[/TD]
[TD="align: right"]111.30[/TD]
[TD="align: right"]111.30[/TD]
[TD="align: right"]TRUE[/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: center"]18[/TD]
[TD="align: center"]28[/TD]
[TD]A[/TD]
[TD]C[/TD]
[TD]B[/TD]
[TD="align: right"]10.45[/TD]
[TD="align: right"]75.62[/TD]
[TD="align: right"]27.63[/TD]
[TD="align: right"]113.70[/TD]
[TD="align: right"]113.70[/TD]
[TD="align: right"]TRUE[/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: center"]19[/TD]
[TD="align: center"]29[/TD]
[TD]A[/TD]
[TD]C[/TD]
[TD]C[/TD]
[TD="align: right"]10.45[/TD]
[TD="align: right"]75.62[/TD]
[TD="align: right"]44.13[/TD]
[TD="align: right"]130.20[/TD]
[TD="align: right"]130.20[/TD]
[TD="align: right"]TRUE[/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: center"]20[/TD]
[TD="align: center"]18[/TD]
[TD]B[/TD]
[TD]A[/TD]
[TD]A[/TD]
[TD="align: right"]29.55[/TD]
[TD="align: right"]33.82[/TD]
[TD="align: right"]25.23[/TD]
[TD="align: right"]88.60[/TD]
[TD="align: right"]88.60[/TD]
[TD="align: right"]TRUE[/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: center"]21[/TD]
[TD="align: center"]16[/TD]
[TD]B[/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD="align: right"]29.55[/TD]
[TD="align: right"]33.82[/TD]
[TD="align: right"]27.63[/TD]
[TD="align: right"]91.00[/TD]
[TD="align: right"]91.00[/TD]
[TD="align: right"]TRUE[/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: center"]22[/TD]
[TD="align: center"]30[/TD]
[TD]B[/TD]
[TD]A[/TD]
[TD]C[/TD]
[TD="align: right"]29.55[/TD]
[TD="align: right"]33.82[/TD]
[TD="align: right"]44.13[/TD]
[TD="align: right"]107.50[/TD]
[TD="align: right"]107.50[/TD]
[TD="align: right"]TRUE[/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: center"]23[/TD]
[TD="align: center"]17[/TD]
[TD]B[/TD]
[TD]B[/TD]
[TD]A[/TD]
[TD="align: right"]29.55[/TD]
[TD="align: right"]45.22[/TD]
[TD="align: right"]25.23[/TD]
[TD="align: right"]100.00[/TD]
[TD="align: right"]100.00[/TD]
[TD="align: right"]TRUE[/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: center"]24[/TD]
[TD="align: center"]15[/TD]
[TD]B[/TD]
[TD]B[/TD]
[TD]B[/TD]
[TD="align: right"]29.55[/TD]
[TD="align: right"]45.22[/TD]
[TD="align: right"]27.63[/TD]
[TD="align: right"]102.40[/TD]
[TD="align: right"]102.40[/TD]
[TD="align: right"]TRUE[/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: center"]25[/TD]
[TD="align: center"]19[/TD]
[TD]B[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD="align: right"]29.55[/TD]
[TD="align: right"]45.22[/TD]
[TD="align: right"]44.13[/TD]
[TD="align: right"]118.90[/TD]
[TD="align: right"]118.90[/TD]
[TD="align: right"]TRUE[/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: center"]26[/TD]
[TD="align: center"]31[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]A[/TD]
[TD="align: right"]29.55[/TD]
[TD="align: right"]75.62[/TD]
[TD="align: right"]25.23[/TD]
[TD="align: right"]130.40[/TD]
[TD="align: right"]130.40[/TD]
[TD="align: right"]TRUE[/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: center"]27[/TD]
[TD="align: center"]20[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]B[/TD]
[TD="align: right"]29.55[/TD]
[TD="align: right"]75.62[/TD]
[TD="align: right"]27.63[/TD]
[TD="align: right"]132.80[/TD]
[TD="align: right"]132.80[/TD]
[TD="align: right"]TRUE[/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: center"]28[/TD]
[TD="align: center"]21[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]C[/TD]
[TD="align: right"]29.55[/TD]
[TD="align: right"]75.62[/TD]
[TD="align: right"]44.13[/TD]
[TD="align: right"]149.30[/TD]
[TD="align: right"]149.30[/TD]
[TD="align: right"]TRUE[/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: center"]29[/TD]
[TD="align: center"]35[/TD]
[TD]C[/TD]
[TD]A[/TD]
[TD]A[/TD]
[TD="align: right"]42.05[/TD]
[TD="align: right"]33.82[/TD]
[TD="align: right"]25.23[/TD]
[TD="align: right"]101.10[/TD]
[TD="align: right"]101.10[/TD]
[TD="align: right"]TRUE[/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: center"]30[/TD]
[TD="align: center"]33[/TD]
[TD]C[/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD="align: right"]42.05[/TD]
[TD="align: right"]33.82[/TD]
[TD="align: right"]27.63[/TD]
[TD="align: right"]103.50[/TD]
[TD="align: right"]103.50[/TD]
[TD="align: right"]TRUE[/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: center"]31[/TD]
[TD="align: center"]36[/TD]
[TD]C[/TD]
[TD]A[/TD]
[TD]C[/TD]
[TD="align: right"]42.05[/TD]
[TD="align: right"]33.82[/TD]
[TD="align: right"]44.13[/TD]
[TD="align: right"]120.00[/TD]
[TD="align: right"]120.00[/TD]
[TD="align: right"]TRUE[/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: center"]32[/TD]
[TD="align: center"]34[/TD]
[TD]C[/TD]
[TD]B[/TD]
[TD]A[/TD]
[TD="align: right"]42.05[/TD]
[TD="align: right"]45.22[/TD]
[TD="align: right"]25.23[/TD]
[TD="align: right"]112.50[/TD]
[TD="align: right"]112.50[/TD]
[TD="align: right"]TRUE[/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: center"]33[/TD]
[TD="align: center"]22[/TD]
[TD]C[/TD]
[TD]B[/TD]
[TD]B[/TD]
[TD="align: right"]42.05[/TD]
[TD="align: right"]45.22[/TD]
[TD="align: right"]27.63[/TD]
[TD="align: right"]114.90[/TD]
[TD="align: right"]114.90[/TD]
[TD="align: right"]TRUE[/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: center"]34[/TD]
[TD="align: center"]23[/TD]
[TD]C[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD="align: right"]42.05[/TD]
[TD="align: right"]45.22[/TD]
[TD="align: right"]44.13[/TD]
[TD="align: right"]131.40[/TD]
[TD="align: right"]131.40[/TD]
[TD="align: right"]TRUE[/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: center"]35[/TD]
[TD="align: center"]37[/TD]
[TD]C[/TD]
[TD]C[/TD]
[TD]A[/TD]
[TD="align: right"]42.05[/TD]
[TD="align: right"]75.62[/TD]
[TD="align: right"]25.23[/TD]
[TD="align: right"]142.90[/TD]
[TD="align: right"]142.90[/TD]
[TD="align: right"]TRUE[/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: center"]36[/TD]
[TD="align: center"]24[/TD]
[TD]C[/TD]
[TD]C[/TD]
[TD]B[/TD]
[TD="align: right"]42.05[/TD]
[TD="align: right"]75.62[/TD]
[TD="align: right"]27.63[/TD]
[TD="align: right"]145.30[/TD]
[TD="align: right"]145.30[/TD]
[TD="align: right"]TRUE[/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: center"]37[/TD]
[TD="align: center"]25[/TD]
[TD]C[/TD]
[TD]C[/TD]
[TD]C[/TD]
[TD="align: right"]42.05[/TD]
[TD="align: right"]75.62[/TD]
[TD="align: right"]44.13[/TD]
[TD="align: right"]161.80[/TD]
[TD="align: right"]161.80[/TD]
[TD="align: right"]TRUE[/TD]
[TD="align: right"][/TD]
[/TR]
</tbody>[/TABLE]
Code:
Formulas:
F6:H6: =RAND()
I6: =SUM(F6:H6)
B6: =ROUND($H$11*F6/$I$6,2)
C6: =ROUND($H$11*G6/$I$6,2)
D6: =ROUND(H11-SUM(B6:C6),2)
B7: =ROUND(B6+(H20-H11),2)
C7: =ROUND(C6+(H14-H11),2)
D7: =ROUND(D6+(H12-H11),2)
B8: =ROUND(B7+(H29-H20),2)
C8: =ROUND(C7+(H17-H14),2)
D8: =ROUND(D7+(H13-H12),2)
E11: =INDEX($B$6:$D$8,MATCH(B11,$A$6:$A$8,0),COLUMNS($E$10:E10))
I11: =ROUND(SUM(E11:G11),2)
J11: =I11=H11
K11: =COUNTIF(J11:J37,TRUE)
Copy E11 not E11:G37
Copy I11 into I12:J37
(A10:A37 are vestigial and unnecessary. They refer to your original posting, which you corrected later. I incorporated your corrections for ACA and CAC.)
The individual costs of HA, DA, PA are determined by the random ratios of F6/I6, G6/I6 and H6/I6, where I6 = F6+G6+H6, times the total cost of AAA.
The individual costs of HB, DB, PB and HC, DC, PC are derived directly from HA, DA, PA based on the constant differences derived from the differences of the total costs, as described above.
I hope that helps.