best combination for lowest possible dose and lowest possible material cost
2 ビュー (過去 30 日間)
古いコメントを表示
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));
0 件のコメント
回答 (1 件)
Torsten
2024 年 11 月 26 日
編集済み: Torsten
2024 年 11 月 26 日
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 件のコメント
Torsten
2024 年 11 月 26 日
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))
参考
カテゴリ
Help Center および File Exchange で Import Data についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!