Skip to content
This repository has been archived by the owner on Jan 12, 2025. It is now read-only.

Commit

Permalink
20170316 New features for visualizign Pareto Input and debugging GUI
Browse files Browse the repository at this point in the history
1. Course of one input variable can be track by moving along the Pareto Front
2. GUI: Choice of input variable indices is now more felxible in case of 3D and nD-Interpolation

Signed-off-by: Lazloo <[email protected]>
  • Loading branch information
Lazloo committed Mar 16, 2017
1 parent 5f2a8e3 commit 6399f9b
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 22 deletions.
Binary file modified GUI/dialogInterpolation.fig
Binary file not shown.
47 changes: 38 additions & 9 deletions GUI/dialogInterpolation.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

% Edit the above text to modify the response to help dialogInterpolation

% Last Modified by GUIDE v2.5 03-Jul-2015 13:46:23
% Last Modified by GUIDE v2.5 15-Mar-2017 16:54:31

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
Expand Down Expand Up @@ -170,9 +170,9 @@ function dialogInterpolation_OpeningFcn(hObject, eventdata, handles, varargin)
% the input variable which discrete varied. The remainining columns
% represent input variables which stays constant of the interpolation
handles.InputVarIndiceMatrix = ones(handles.nRows,nInputVar);
for iVar=2:nInputVar
handles.InputVarIndiceMatrix(:,iVar)=iVar;
end
% for iVar=2:nInputVar
% handles.InputVarIndiceMatrix(:,iVar)=iVar;
% end

% InputVarValueMatrix saves concrete values for the input variable
% which are used when they are fix over the interpolation. The
Expand Down Expand Up @@ -286,6 +286,7 @@ function dialogInterpolation_OpeningFcn(hObject, eventdata, handles, varargin)

% Potential index of input variables
indicesWhichCouldBechosen = 1:handles.KrigingAnalysisObj.KrigingObjects{handles.currentObj}.getnInputVar;
indicesNotChosen = indicesWhichCouldBechosen;

% Takes all the indices which are not yet already chosen by the popMenue
switch handles.InterpolationType
Expand Down Expand Up @@ -313,6 +314,7 @@ function dialogInterpolation_OpeningFcn(hObject, eventdata, handles, varargin)

% Collect information for the entries in the table
for iVar=1:length(strNames)-(handles.InterpolationType-1)
% for iVar=1:length(strNames)
dataIni{iVar,1} = strNames{indicesNotChosen(iVar)};

if handles.InterpolationType==4 % nD-plot
Expand Down Expand Up @@ -358,8 +360,9 @@ function dialogInterpolation_OpeningFcn(hObject, eventdata, handles, varargin)
index2(runIndex) = find(strcmp(str{iIndex}{val(iIndex)},strNames)==1);
runIndex = runIndex+1;
end
index2 = unique(index2);
indices = setdiff(1:length(strNames),index2);
% index2 = unique(index2);
% indices = setdiff(1:length(strNames),index2);
indices = 1:length(strNames);


% --- Executes on button press in checkboxBestData.
Expand Down Expand Up @@ -482,8 +485,11 @@ function popupmenuInVar2_Callback(hObject, eventdata, handles)
InputVarPopupValueMatrix(iIndex,currentRow) = get(popUps{iIndex},'Value');
end
% Fill up the remaining part
InputVarIndiceMatrix(currentRow,4:end) =...
InputVarIndiceMatrix(currentRow,4:end) = ...
setdiff(1:nInputVar,InputVarIndiceMatrix(currentRow,1:3));
% InputVarIndiceMatrix(currentRow,1:end) = 1:nInputVar;
% InputVarIndiceMatrix(currentRow,1:end) = ...
% setdiff(1:nInputVar,InputVarIndiceMatrix(currentRow,1:3));



Expand Down Expand Up @@ -571,11 +577,17 @@ function pushbuttonInterpolation_Callback(hObject, eventdata, handles)
errordlg(horzcat('Uncheck either "',get(handles.checkboxContourPlot,'String'),'" or "',get(handles.checkboxDisplayOptimum,'String'),'"'))
error(horzcat('Uncheck either "',get(handles.checkboxContourPlot,'String'),'" or "',get(handles.checkboxDisplayOptimum,'String'),'"'))
end



switch handles.InterpolationType
case 2
chosenIndices = indicesWhichCouldBechosen1(val1);

if length(unique(chosenIndices))~= length(chosenIndices)
errordlg('Indices of input variable are not unique')
error('Indices of input variable are not unique')
end

indicesRemainingInputVar = setdiff(1:nInputVar,chosenIndices);
data = get(handles.uitableInputParameters,'Data');
for iVar=1:nInputVar-1
Expand All @@ -602,6 +614,11 @@ function pushbuttonInterpolation_Callback(hObject, eventdata, handles)
case 3
chosenIndices = [indicesWhichCouldBechosen1(val1),indicesWhichCouldBechosen2(val2)];

if length(unique(chosenIndices))~= length(chosenIndices)
errordlg('Indices of input variable are not unique')
error('Indices of input variable are not unique')
end

indicesRemainingInputVar = setdiff(1:nInputVar,chosenIndices);
data = get(handles.uitableInputParameters,'Data');
for iVar=1:nInputVar-2
Expand Down Expand Up @@ -641,7 +658,11 @@ function pushbuttonInterpolation_Callback(hObject, eventdata, handles)


case 4

if length(unique(handles.InputVarIndiceMatrix(:,1:3)))~= length(handles.InputVarIndiceMatrix(:,1:3))
errordlg('Indices of input variable are not unique')
error('Indices of input variable are not unique')
end

valuesRemainingInputVarValues = zeros(handles.nRows,nInputVar-3);
for iVar=1:handles.nRows
valuesRemainingInputVarValues(iVar,:) = handles.InputVarValueMatrix(iVar,handles.InputVarIndiceMatrix(iVar,4:end));
Expand Down Expand Up @@ -1018,3 +1039,11 @@ function uitableMinMaxVar_CreateFcn(hObject, eventdata, handles)
% your option, any later version) which accompanies this distribution, and
% is available at http://www.gnu.org/licenses/gpl.html
% =============================================================================


% --- If Enable == 'on', executes on mouse press in 5 pixel border.
% --- Otherwise, executes on mouse press in 5 pixel border or over popupmenuInVar1.
function popupmenuInVar1_ButtonDownFcn(hObject, eventdata, handles)
% hObject handle to popupmenuInVar1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
Binary file modified GUI/dialogInterpolationGUI.fig
Binary file not shown.
10 changes: 9 additions & 1 deletion GUI/dialogInterpolationGUI.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

% Edit the above text to modify the response to help dialogInterpolationGUI

% Last Modified by GUIDE v2.5 22-Jan-2015 16:17:46
% Last Modified by GUIDE v2.5 15-Mar-2017 16:52:51

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
Expand Down Expand Up @@ -193,3 +193,11 @@ function popupmenu4_CreateFcn(hObject, eventdata, handles)
% your option, any later version) which accompanies this distribution, and
% is available at http://www.gnu.org/licenses/gpl.html
% =============================================================================


% --- If Enable == 'on', executes on mouse press in 5 pixel border.
% --- Otherwise, executes on mouse press in 5 pixel border or over popupmenu1.
function popupmenu1_ButtonDownFcn(hObject, eventdata, handles)
% hObject handle to popupmenu1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
4 changes: 3 additions & 1 deletion dependencies/@AnalyzeKriging/plotParetoFrontData.m
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
for iObjNested = 1:nObj
outputMatrix(:,iObjNested) = obj.KrigingObjects{krigingObjectIndex(iObjNested)}.getOutputData;
end
outputMatrix = bsxfun(@times,outputMatrix,obj.getMinMax(krigingObjectIndex));
end
% -------------------------------------------------------------------------
function []=numerateSamples(nObj,paretoSamples)
Expand Down Expand Up @@ -87,7 +88,8 @@
end

% Sort ParetoSet allong th x-axis
paretoSamples = sortrows(obj.ParetoSetExperiments);
paretoSamples = bsxfun(@times,obj.ParetoSetExperiments,obj.getMinMax(krigingObjectIndex));
paretoSamples = sortrows(paretoSamples);

% Connect pareto points by a "stair" indicating dominated and non
% domiated are
Expand Down
50 changes: 39 additions & 11 deletions dependencies/@AnalyzeKriging/plotParetoInput.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
nInputVar = length(inputIndices);

% Test Input
if (nInputVar~=2&&nInputVar~=3)||~any(size(inputIndices)==1)
error('InputIndices has to be an one-dimensional array of size 2 or 3')
if (nInputVar~=1&&nInputVar~=2&&nInputVar~=3)||~any(size(inputIndices)==1)
error('InputIndices has to be an one-dimensional array of size 1, 2, or 3')
end

if obj.nParetoSetExperiments<=0
Expand All @@ -71,7 +71,11 @@

% Add legend
warning('off','MATLAB:legend:IgnoringExtraEntries')
legend('Non-optimal Sample Points','Optimal Sample Points','Trajectory')
if nInputVar
legend('Optimal Sample Points','Trajectory')
else
legend('Non-optimal Sample Points','Optimal Sample Points','Trajectory')
end
warning('on','MATLAB:legend:IgnoringExtraEntries')
%% Nested Functions
% ---------------------------------------------------------------------
Expand All @@ -85,6 +89,16 @@

% Actual Plotting
switch nInputVar
case 1
% Mark pareto optimal
nPareto = length(obj.ParetoValuesInput(:,inputIndices(1)));
plot(1:nPareto,...
inputSorted(:,inputIndices(1)),...
'kO','MarkerFaceColor',colorOptimal,'MarkerSize',12);
stairs(1:nPareto,...
inputSorted(:,inputIndices(1)),...
'k','LineWidth',2);
set(gca,'XTick',1:nPareto)
case 2
if obj.ShowData==1
% All data
Expand Down Expand Up @@ -152,16 +166,30 @@
% ----------------------------------------------------------------------
function []=labelAxes()
if isempty(obj.InputVarNames{krigingObjectIndex(1)})
xlabel(horzcat('Input Variable ',num2str(inputIndices(1))),'FontSize',20);
ylabel(horzcat('Input Variable ',num2str(inputIndices(2))),'FontSize',20);
if nInputVar>2
zlabel(horzcat('Input Variable ',num2str(inputIndices(3))),'FontSize',20);
switch nInputVar
case 1
xlabel('Point Number','FontSize',20)
xlabel(horzcat('Input Variable ',num2str(inputIndices(1))),'FontSize',20);
case {2,3}
xlabel(horzcat('Input Variable ',num2str(inputIndices(1))),'FontSize',20);
ylabel(horzcat('Input Variable ',num2str(inputIndices(2))),'FontSize',20);
if nInputVar>2
zlabel(horzcat('Input Variable ',num2str(inputIndices(3))),'FontSize',20);
end
end
else
xlabel(obj.InputVarNames{krigingObjectIndex(1)}(inputIndices(1)),'FontSize',20);
ylabel(obj.InputVarNames{krigingObjectIndex(1)}(inputIndices(2)),'FontSize',20);
if nInputVar>2
zlabel(obj.InputVarNames{krigingObjectIndex(1)}(inputIndices(3)),'FontSize',20);

switch nInputVar
case 1
xlabel('Point Number','FontSize',20)
inputNames = obj.getInputVarNames(krigingObjectIndex(1));
ylabel(inputNames(inputIndices(1)),'FontSize',20)
case {2,3}
xlabel(obj.InputVarNames{krigingObjectIndex(1)}(inputIndices(1)),'FontSize',20);
ylabel(obj.InputVarNames{krigingObjectIndex(1)}(inputIndices(2)),'FontSize',20);
if nInputVar>2
zlabel(obj.InputVarNames{krigingObjectIndex(1)}(inputIndices(3)),'FontSize',20);
end
end
end
end
Expand Down

0 comments on commit 6399f9b

Please sign in to comment.