Optimization of weighted sum

21 views (last 30 days)
De Ar
De Ar on 28 Mar 2022
Commented: De Ar on 28 Mar 2022
I want to optimize the weights of the sum , where z is depth (in cm), . The terms are vectors (representing dose) of size for with already fixed and know entry values. I need to optimize these weights such that in the region , where is a constant dose vector of size (see attached figure), in order to flatten the plateau as much as possible.
Could anyone help me with this problem?
Many thanks in advance for any guidance and consideration!
  3 Comments
De Ar
De Ar on 28 Mar 2022
Edited: De Ar on 28 Mar 2022
I attached the figure Optimization_DoseVec.png. I have also attached the dose vector data in Dose.mat.
That is correct! By the figure Optimization.png, I have already tried computing the most optimal set of weights through Jette D & Chen W (2011) (Creating a spread-out Bragg peak in proton beams), but the plateau dose did not work in my case. Was therefore wondering if I should apply a method such as e.g. gradient descent..?
Torsten
Torsten on 28 Mar 2022
Edited: Torsten on 28 Mar 2022
Yes, but how should it be possible that the weighted sum becomes a constant over a complete interval ?
The Di curves behave similarly, so every weighted sum will behave similarly as the Di's do. The weighted sum can't become a constant.

Sign in to comment.

Accepted Answer

Matt J
Matt J on 28 Mar 2022
Edited: Matt J on 28 Mar 2022
You did not include Dconst or the corresponding z, so I eyeballed both from your attached .jpg image.
load Dose.mat
C=[D1,D2,D3,D4,D5,D6,D7,D8];
[m,n]=size(C);
Dconst=0.1*ones(m,1); %approximated from .jpg image
z=linspace(0,8.5,m); %approximated from .jpg image
bp=5.5<=z & z<=8.5; %Bragg peak interval
w=lsqlin(C(bp,:),Dconst(bp),[],[],ones(1,n),1,zeros(n,1),ones(n,1));
Minimum found that satisfies the constraints. Optimization completed because the objective function is non-decreasing in feasible directions, to within the value of the optimality tolerance, and constraints are satisfied to within the value of the constraint tolerance.
plot(z, [C*w,Dconst]); legend('Dtot','Dconst','location','southeast')
  1 Comment
De Ar
De Ar on 28 Mar 2022
Awesome - thank you!! I forgot to mention that I am mostly keen on achieving homogeniety in dose in that particular region than reaching the level dose of . However, this solution works!

Sign in to comment.

More Answers (1)

John D'Errico
John D'Errico on 28 Mar 2022
Edited: John D'Errico on 28 Mar 2022
First, LEARN TO USE ARRAYS!!!!!!!!
Don't create 8 different numbered variables. Why does that make sense, when you can create ONE array, call it Dose?
Dose = [D1,D2,D3,D4,D5,D6,D7,D8];
MATLAB is a MATRIX LANGUAGE. Learn to use it as such. Anyway, in order to use lsqlin, you will need an array.
Next, you don't actually provide Dtot. So is there a way we can help you more? Probably not really, if your goal is to truly achueve that specific dose goal. If your goal is to achieve an aggregate dose that is as large as possible over the entire region, then you might do this:
Daim = 0.12*ones(501,1); % unachievable, but who cares? Aim for the stars.
LB = zeros(1,8);
UB = ones(1,8);
A = ones(1,8); % equality constraint: the sum must be 1
B = 1;
W = lsqlin(Dose,Daim,[],[],A,B,LB,UB)
Minimum found that satisfies the constraints.
Optimization completed because the objective function is non-decreasing in
feasible directions, to within the value of the optimality tolerance,
and constraints are satisfied to within the value of the constraint tolerance.
<stopping criteria details>
W =
0.0271916622048387
0.043945469132034
0.0555504667354272
0.0671084337012187
0.0905029933411581
0.113513538791469
0.167454011263868
0.434733424829987
plot(Dose*W)
In advance, I played with some numbers, wondering what the solution would look like. That is roughly what I found by hand, at least if your goal is a curve that looks vaguely like your plotted aim.
If you wanted a higher loading on the left end, you need something with some mass down there. However, by dropping the aim just a bit, you can flatten the result, just a bit.
Daim = 0.1*ones(501,1);
W = lsqlin(Dose,Daim,[],[],ones(1,8),1,zeros(1,8),ones(1,8))
Minimum found that satisfies the constraints.
Optimization completed because the objective function is non-decreasing in
feasible directions, to within the value of the optimality tolerance,
and constraints are satisfied to within the value of the constraint tolerance.
<stopping criteria details>
W =
0.0800640800727342
0.0450974697116315
0.0615545440518655
0.0676444663541099
0.0843898048745855
0.110747769607969
0.135846098000183
0.414655767326922
plot(Dose*W)
This clearly has a flatter plateau, which you sort of indicated was your goal.

Categories

Find more on Biotech and Pharmaceutical in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!