Skip to content

Commit 3696549

Browse files
committed
bugfix for EXTERNAL contours and speedub of jacobian structure for constrained optimization
1 parent e1e507c commit 3696549

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

matRad/optimization/@matRad_OptimizationProblem/matRad_getConstraintBounds.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
for i = 1:size(cst,1)
4040

4141
% Only take OAR or target VOI.
42-
if ~any(cellfun(@isempty,cst{i,4})) && ( isequal(cst{i,3},'OAR') || isequal(cst{i,3},'TARGET') )
42+
if ~any(cellfun(@isempty,cst{i,4})) && any(strcmp(cst{i,3},{'OAR','TARGET','EXTERNAL'}))
4343

4444
% loop over the number of constraints for the current VOI
4545
for j = 1:numel(cst{i,6})

matRad/optimization/@matRad_OptimizationProblem/matRad_getJacobianStructure.m

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@
3232
%
3333
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3434
% Initializes constraints
35-
jacobStruct = sparse([]);
35+
jacobStruct = sparse([]);
36+
37+
tmp = false(size(dij.physicalDose{1},1),1);
3638
% compute objective function for every VOI.
3739
for i = 1:size(cst,1)
3840
% Only take OAR or target VOI.
@@ -43,12 +45,15 @@
4345
obj = cst{i,6}{j};
4446

4547
% only perform computations for constraints
46-
if isa(obj,'DoseConstraints.matRad_DoseConstraint')
48+
if isa(obj,'DoseConstraints.matRad_DoseConstraint')
49+
tmp(:) = false;
50+
tmp(cst{i,4}{1}) = true;
4751

4852
% get the jacobian structure depending on dose
4953
jacobDoseStruct = obj.getDoseConstraintJacobianStructure(numel(cst{i,4}{1}));
5054
nRows = size(jacobDoseStruct,2);
51-
jacobStruct = [jacobStruct; repmat(spones(mean(dij.physicalDose{1}(cst{i,4}{1},:),1)),nRows,1)];
55+
%jacobStruct = [jacobStruct; repmat(spones(mean(dij.physicalDose{1}(cst{i,4}{1},:),1)),nRows,1)];
56+
jacobStruct = [jacobStruct; repmat(spones(double(tmp') * dij.physicalDose{1}),nRows,1)];
5257

5358
end
5459
end

0 commit comments

Comments
 (0)