best combination for lowest possible dose and lowest possible material cost

3 views (last 30 days)
Hello,
I have been trying to get the best possible combination of low dose and low material cost.
The dose and cost seem to be correct, but the ratios i get are wrong. It gives me the maximum values, so i suppose the values are not being held correctly. What are your thoughts and how could i fix this?
Thank you in advance!
mixDoseRate = zeros(1,9261);
mixCost = zeros(1,9261);
proportions = zeros(9261,3);
% Initialize index for cells
index = 1;
for p1 = 0:0.05:1
for p2 = 0:0.05:1
for p3 = 0:0.05:1
% Calculate the mixed dose rate
mixDoseRate(index) = InDoseRate(i) * exp(-((selectedSource.(materials{1}) * density.(materials{1}) * ceil(thickness(1,i)) * p1) + (selectedSource.(materials{2}) * density.(materials{2}) * ceil(thickness(2,i)) * p2) + (selectedSource.(materials{3}) * density.(materials{3}) * ceil(thickness(3,i)) * p3)));
mixvolume = areaEditField{i}.Value*1e6*(thickness(1,i)*p1 + thickness(2,i)*p2 + thickness(3,i)*p3);
mixCost(index) = (PriceEditField.(materials{1}).Value * density.(materials{1}) + PriceEditField.(materials{2}).Value * density.(materials{2}) + PriceEditField.(materials{3}).Value * density.(materials{3})) * mixvolume;
proportions(index,:) = [p1, p2, p3];
% Increment index
index = index + 1;
if index > 9261
break;
end
end
end
end
for index = 2:9261
if (mixDoseRate(index) <= mixDoseRate(index-1)) && (mixCost(index) <= mixCost(index-1))
bestDoseRate = mixDoseRate(index);
bestCost = mixCost(index);
Proportions = proportions(index,:);
else
continue;
end
end
tableData{4, 2*i} = sprintf('%.2e uSv/h', bestDoseRate);
tableData{4, 2*i+1} = sprintf('€ %.2e', bestCost);
tableData{5, 2*i} = sprintf('%.2f, %.2f, %.2f', Proportions(1), Proportions(2), Proportions(3));

Answers (1)

Torsten
Torsten on 26 Nov 2024
Edited: Torsten on 26 Nov 2024
You mean
bestDoseRate = Inf;
bestCost = Inf;
for index = 2:9261
if (mixDoseRate(index) <= bestDoseRate && mixCost(index) <= bestCost)
bestDoseRate = mixDoseRate(index);
bestCost = mixCost(index);
Proportions = proportions(index,:);
end
end
?
Does it really make sense to minimize Dose and Cost this way ?
My guess is that low dose means high cost - so you have two conflicting aims in your optimization.
Take a look at
on how to handle such a situation mathematically.
There are also MATLAB tools for such cases:
  2 Comments
ALEXANDROS
ALEXANDROS on 26 Nov 2024
Hi,
Thank you for your fast reply.
It might seem kind of strange, i agree. But i have already calculated the thickness and cost for each material required to minimize the dose rate at an acceptale value. At this point i want to find the best material combination iterrating through the percentages of each thickness from 0 to 1 with step 0.05 while also keeping the cost as low as possible.
And yes, you could preallocate the values of the variables as you have added, but i believe since there is an array of the values, it is not needed. I might be wrong though.
I will check out the tools you mention in your reply and see where i can take it.
Torsten
Torsten on 26 Nov 2024
It's not the "preallocation", but the comparison that makes the difference:
if (mixDoseRate(index) <= bestDoseRate && mixCost(index) <= bestCost)
instead of
if (mixDoseRate(index) <= mixDoseRate(index-1)) && (mixCost(index) <= mixCost(index-1))

Sign in to comment.

Products


Release

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!