(*datafrommenu:*)​​wingNums=Flatten[{Range[4,30],35,40,45,50,60,70,75,80,90,100,125,150,200}];​​wingPrices={4.55,5.7,6.8,7.95,9.1,10.2,11.35,12.5,13.6,14.75,15.9,17.,18.15,19.3,20.4,21.55,22.7,23.8,24.95,26.1,27.25,27.8,28.95,30.1,31.2,32.32,33.5,39.15,44.8,50.5,55.7,67,78.3,83.45,89.1,100.45,111.25,139,166.85,222.5};​​wingData=Thread[{wingNums,wingPrices}];​​​​(*0-order(nearestdatapoint)interpolation.Notactuallyusedforinterpolationthough,justmakesiteasytoaskforthepriceforacertainnumberofwings.*)​​wingCost=Interpolation[wingData,InterpolationOrder0];​​​​(*generateslistofallposiblecombinationsofwingordersthatsumtoacertainnumberofwings*)​​combinationList[n_]:=IntegerPartitions[n,All,wingNums];​​​​(*returnscombinationwithminimalcost*)​​minCost[nWings_]:=Module[{nIn=nWings},​​possibleCombos=combinationList[nIn];​​Min@Table[Total@Map[wingCost[#]&,n],{n,possibleCombos}]​​]​​
In[]:=
DiscretePlot[minCost[wings],{wings,4,80},FillingNone,JoinedTrue,PlotRangeAll,PlotMarkersAutomatic,FrameTrue,FrameLabel{"# wings","min. cost ($)"},LabelStyle{FontFamily"Arial",FontSize16,Black,Bold}]
Out[]=
In[]:=
(*ThegrowthofcombinationListlengthhindersbruteforcingaftern~80:*)​​DiscretePlot[combinationList[wings]//Flatten//Length,{wings,4,80},FillingNone,JoinedTrue,PlotRangeAll,PlotMarkersAutomatic,FrameTrue,FrameLabel{"# wings","# combinations adding \n up to #wings"},LabelStyle{FontFamily"Arial",FontSize16,Black,Bold},ScalingFunctions"Log"]
Out[]=