Optimization of weighted sum
    조회 수: 5 (최근 30일)
  
       이전 댓글 표시
    
I want to optimize the weights  of the sum
 of the sum  , where z is depth (in cm),
, where z is depth (in cm),  
   . The terms
. The terms  are vectors (representing dose) of size
 are vectors (representing dose) of size  for
 for  with already fixed and know entry values. I need to optimize these weights such that
 with already fixed and know entry values. I need to optimize these weights such that  in the region
 in the region  , where
, where  is a constant dose vector of size
 is a constant dose vector of size  (see attached figure), in order to flatten the plateau as much as possible.
 (see attached figure), in order to flatten the plateau as much as possible.
 of the sum
 of the sum  , where z is depth (in cm),
, where z is depth (in cm),  
   . The terms
. The terms  are vectors (representing dose) of size
 are vectors (representing dose) of size  for
 for  with already fixed and know entry values. I need to optimize these weights such that
 with already fixed and know entry values. I need to optimize these weights such that  in the region
 in the region  , where
, where  is a constant dose vector of size
 is a constant dose vector of size  (see attached figure), in order to flatten the plateau as much as possible.
 (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
채택된 답변
  Matt J
      
      
 2022년 3월 28일
        
      편집: Matt J
      
      
 2022년 3월 28일
  
      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));
plot(z, [C*w,Dconst]); legend('Dtot','Dconst','location','southeast')
추가 답변 (1개)
  John D'Errico
      
      
 2022년 3월 28일
        
      편집: John D'Errico
      
      
 2022년 3월 28일
  
      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.
댓글 수: 0
참고 항목
카테고리
				Help Center 및 File Exchange에서 Surrogate Optimization에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!





