function optim(optv)

if nargin == 0 | isempty(optv)
   load def.opt -mat	
elseif nargin==1 
   feval('load',[optv,'.opt'],'-mat')
end

a={'ON','OFF'};
b={'OFF','ITER','FINAL'};
c={'DFP','GILLMURR','STEEPDESC','BFGS'};
d={'CUBICPOLY','QUADCUBIC'};
e={'SINGLEOBJ', 'MULTIOBJ'}; 

h0 = figure('Color',[0.8 0.8 0.8], ...
	'Name','Optimset selecion', ...
	'NumberTitle','off', ...
	'PaperPosition',[18 180 576 432], ...
	'PaperUnits','points', ...
	'Position',[100 100 560 420], ...
	'Tag','Fig1', ...
	'ToolBar','none');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'ListboxTop',0, ...
	'Position',[10 10 400 300], ...
	'Style','frame', ...
	'Tag','Frame1');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[0.8 0.8 0.8], ...
	'FontSize',14, ...
	'FontWeight','demi', ...
	'ListboxTop',0, ...
	'Position',[33 290 342 15], ...
	'String','OPTIMSET SELECTION', ...
	'Style','text', ...
	'Tag','StaticText1');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[1 1 1], ...
	'ListboxTop',0, ...
	'Position',[122.625 39.25 52.5 15], ...
	'String',a, ...
	'Style','popupmenu', ...
	'Tag','popup08', ...
	'Value',optv.pop(8));
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[0.8 0.8 0.8], ...
	'FontSize',10, ...
	'ListboxTop',0, ...
	'Position',[18 267.25 97.5 15], ...
	'String','DerivativeCheck', ...
   'Style','text', ...
   'TooltipString','Compare user-supplied analytic derivatives to finite differencing derivatives.', ...
	'Tag','StaticText2');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[1 1 1], ...
	'ListboxTop',0, ...
	'Position',[122.625 267 52.5 15], ...
	'String',a, ...
	'Style','popupmenu', ...
	'Tag','popup01', ...
	'Value',optv.pop(1));
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[0.8 0.8 0.8], ...
	'FontSize',10, ...
	'ListboxTop',0, ...
	'Position',[18 248.25 97.5 15], ...
	'String','Diagnostics', ...
   'Style','text', ...
   'TooltipString','Print diagnostic information about the function to be minimized or solved.',...
	'Tag','StaticText2');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[0.8 0.8 0.8], ...
	'FontSize',10, ...
	'ListboxTop',0, ...
	'Position',[18 229.25 97.5 15], ...
	'String','DiffMaxChange', ...
	'Style','text', ...
   'TooltipString','Maximum change in variables for finite difference derivatives.',...
	'Tag','StaticText2');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[0.8 0.8 0.8], ...
	'FontSize',10, ...
	'ListboxTop',0, ...
	'Position',[18 210.25 97.5 15], ...
	'String','DiffMinChange', ...
   'Style','text', ...
   'TooltipString','Minimum change in variables for finite difference derivatives.',...
	'Tag','StaticText2');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[0.8 0.8 0.8], ...
	'FontSize',10, ...
	'ListboxTop',0, ...
	'Position',[18 191.25 97.5 15], ...
	'String','Display', ...
   'Style','text', ...
   'TooltipString','Level of display. off displays no output; iter displays output at each iteration; final displays just the final output.',...
	'Tag','StaticText2');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[0.8 0.8 0.8], ...
	'FontSize',10, ...
	'ListboxTop',0, ...
	'Position',[18 153.25 97.5 15], ...
	'String','GradConstr', ...
   'Style','text', ...
   'TooltipString','Gradients for the nonlinear constraints defined by user.',...
	'Tag','StaticText2');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[0.8 0.8 0.8], ...
	'FontSize',10, ...
	'ListboxTop',0, ...
	'Position',[18 134.25 97.5 15], ...
   'String','GradObj', ...
   'Style','text', ...
   'TooltipString','Gradient(s) for the objective function(s) defined by user.',...
	'Tag','StaticText2');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[0.8 0.8 0.8], ...
	'FontSize',10, ...
	'ListboxTop',0, ...
	'Position',[18 115.25 97.5 15], ...
	'String','Hessian', ...
   'Style','text', ...
   'TooltipString','Hessian for the objective function defined by user.',...
	'Tag','StaticText2');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[0.8 0.8 0.8], ...
	'FontSize',10, ...
	'ListboxTop',0, ...
	'Position',[18 96.25 97.5 15], ...
   'String','HessPattern', ...
   'Style','text', ...
   'TooltipString','Sparsity pattern of the Hessian for finite differencing.',...
	'Tag','StaticText2');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[0.8 0.8 0.8], ...
	'FontSize',10, ...
	'ListboxTop',0, ...
	'Position',[18 77.25 97.5 15], ...
	'String','HessUpdate', ...
   'Style','text', ...
   'TooltipString','Quasi-Newton updating scheme.', ...
	'Tag','StaticText2');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[0.8 0.8 0.8], ...
	'FontSize',10, ...
	'ListboxTop',0, ...
	'Position',[18 39.25 97.5 15], ...
	'String','Jacobian', ...
	'Style','text', ...
   'TooltipString','Jacobian for the objective function defined by user.', ...
	'Tag','StaticText2');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[0.8 0.8 0.8], ...
	'FontSize',10, ...
	'ListboxTop',0, ...
	'Position',[18 20.25 97.5 15], ...
	'String','LargeScale', ...
   'Style','text', ...
   'TooltipString','Use large-scale algorithm if possible.', ...
	'Tag','StaticText2');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[0.8 0.8 0.8], ...
	'FontSize',10, ...
	'ListboxTop',0, ...
	'Position',[199.5 39.25 97.5 15], ...
	'String','TypicalX', ...
   'Style','text', ...
   'TooltipString','Typical x values.',...
	'Tag','StaticText2');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[0.8 0.8 0.8], ...
	'FontSize',10, ...
	'ListboxTop',0, ...
	'Position',[199.5 58.25 97.5 15], ...
	'String','TolX', ...
   'Style','text', ...
   'TooltipString','Termination tolerance on x.',...
	'Tag','StaticText2');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[0.8 0.8 0.8], ...
	'FontSize',10, ...
	'ListboxTop',0, ...
	'Position',[199.5 77.25 97.5 15], ...
	'String','TolPCG', ...
   'Style','text', ...
   'TooltipString','Termination tolerance on the PCG iteration.',...
	'Tag','StaticText2');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[0.8 0.8 0.8], ...
	'FontSize',10, ...
	'ListboxTop',0, ...
	'Position',[199.5 96.25 97.5 15], ...
	'String','TolFun', ...
   'Style','text', ...
   'TooltipString','Termination tolerance on the function value.', ...
	'Tag','StaticText2');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[0.8 0.8 0.8], ...
	'FontSize',10, ...
	'ListboxTop',0, ...
	'Position',[199.5 115.25 97.5 15], ...
	'String','TolCon', ...
   'Style','text', ...
   'TooltipString','Termination tolerance on the constraint violation.', ...
	'Tag','StaticText2');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[0.8 0.8 0.8], ...
	'FontSize',10, ...
	'ListboxTop',0, ...
	'Position',[199.5 134.25 97.5 15], ...
	'String','PrecondBandWidth', ...
   'Style','text', ...
   'TooltipString','Upper bandwidth of preconditioner for PCG.', ...
   'Tag','StaticText2');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[0.8 0.8 0.8], ...
	'FontSize',10, ...
	'ListboxTop',0, ...
	'Position',[199.5 153.25 97.5 15], ...
	'String','MinAbsMax', ...
   'Style','text', ...
   'TooltipString','Number of F(x) to minimize the worst case absolute values.', ...
	'Tag','StaticText2');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[0.8 0.8 0.8], ...
	'FontSize',10, ...
	'ListboxTop',0, ...
	'Position',[199.5 172.25 97.5 15], ...
	'String','MeritFunction', ...
   'Style','text', ...
   'TooltipString','Use goal attainment/minimax merit function (multiobjective) vs. fmincon (single objective).', ...
	'Tag','StaticText2');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[0.8 0.8 0.8], ...
	'FontSize',10, ...
	'ListboxTop',0, ...
	'Position',[199.5 191.25 97.5 15], ...
	'String','MaxPCGIter', ...
   'Style','text', ...
   'TooltipString','Maximum number of PCG iterations allowed.',...
	'Tag','StaticText2');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[0.8 0.8 0.8], ...
	'FontSize',10, ...
	'ListboxTop',0, ...
	'Position',[199.5 210.25 97.5 15], ...
   'String','MaxIter', ...
   'Style','text', ...
   'TooltipString','Maximum number of iterations allowed.',...
	'Tag','StaticText2');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[0.8 0.8 0.8], ...
	'FontSize',10, ...
	'ListboxTop',0, ...
	'Position',[199.5 229.25 97.5 15], ...
   'String','MaxFunEvals', ...
   'Style','text', ...
   'TooltipString','Maximum number of function evaluations allowed.',...
	'Tag','StaticText2');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[0.8 0.8 0.8], ...
	'FontSize',10, ...
	'ListboxTop',0, ...
	'Position',[199.5 248.25 97.5 15], ...
	'String','LineSearchType', ...
   'Style','text', ...
   'TooltipString','Line search algorithm choice.',...
	'Tag','StaticText2');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[0.8 0.8 0.8], ...
	'FontSize',10, ...
	'ListboxTop',0, ...
	'Position',[199.5 267.25 97.5 15], ...
	'String','LevenbergMarquardt', ...
   'Style','text', ...
   'TooltipString','Chooses Levenberg-Marquardt over Gauss-Newton algorithm.',...
   'Tag','StaticText2');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[0.8 0.8 0.8], ...
	'FontSize',10, ...
	'ListboxTop',0, ...
	'Position',[18 58.25 97.5 15], ...
	'String','JacobPattern', ...
   'Style','text', ...
   'TooltipString','Sparsity pattern of the Jacobian for finite differencing.', ...
	'Tag','StaticText2');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[1 1 1], ...
	'ListboxTop',0, ...
	'Position',[122.625 248.25 52.5 15], ...
	'String',a, ...
	'Style','popupmenu', ...
	'Tag','popup02', ...
	'Value',optv.pop(2));
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[1 1 1], ...
	'ListboxTop',0, ...
	'Position',[122.625 229.5 52.5 15], ...
	'String',optv.edit{1}, ...
	'Style','edit', ...
	'Tag','edit01');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[1 1 1], ...
	'ListboxTop',0, ...
	'Position',[122.625 210 52.5 15], ...
	'String',optv.edit{2}, ...
	'Style','edit', ...
	'Tag','edit02');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[1 1 1], ...
	'ListboxTop',0, ...
	'Position',[122.625 191.25 52.5 15], ...
	'String',b, ...
	'Style','popupmenu', ...
	'Tag','popup03', ...
	'Value',optv.pop(3));
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[1 1 1], ...
	'ListboxTop',0, ...
	'Position',[122.625 153 52.5 15], ...
	'String',a, ...
	'Style','popupmenu', ...
	'Tag','popup04', ...
	'Value',optv.pop(4));
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[1 1 1], ...
	'ListboxTop',0, ...
	'Position',[122.625 134.25 52.5 15], ...
	'String',a, ...
	'Style','popupmenu', ...
	'Tag','popup05', ...
	'Value',optv.pop(5));
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[1 1 1], ...
	'ListboxTop',0, ...
	'Position',[122.625 115.5 52.5 15], ...
	'String',a, ...
	'Style','popupmenu', ...
	'Tag','popup06', ...
	'Value',optv.pop(6));
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[1 1 1], ...
	'ListboxTop',0, ...
	'Position',[122.625 96.25 52.5 15], ...
	'String',optv.edit{4}, ...
	'Style','edit', ...
	'Tag','edit04');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[1 1 1], ...
	'ListboxTop',0, ...
	'Position',[122.625 77.25 52.5 15], ...
	'String',c, ...
	'Style','popupmenu', ...
	'Tag','popup07', ...
	'Value',optv.pop(7));
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[1 1 1], ...
	'ListboxTop',0, ...
	'Position',[122.625 58.25 52.5 15], ...
   'String',optv.edit{5}, ...
	'Style','edit', ...
	'Tag','edit05');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[1 1 1], ...
	'ListboxTop',0, ...
	'Position',[122.625 20.25 52.5 15], ...
	'String',a, ...
	'Style','popupmenu', ...
	'Tag','popup09', ...
	'Value',optv.pop(9));
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[1 1 1], ...
	'ListboxTop',0, ...
	'Position',[314.25 267.75 52.5 15], ...
	'String',a, ...
	'Style','popupmenu', ...
	'Tag','popup10', ...
	'Value',optv.pop(10));
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[1 1 1], ...
	'ListboxTop',0, ...
	'Position',[314.25 248.25 52.5 15], ...
	'String',d, ...
	'Style','popupmenu', ...
	'Tag','popup11', ...
	'Value',1);
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[1 1 1], ...
	'ListboxTop',0, ...
	'Position',[314.25 229.25 52.5 15], ...
	'String',optv.edit{6}, ...
	'Style','edit', ...
	'Tag','edit06');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[1 1 1], ...
	'ListboxTop',0, ...
	'Position',[314.25 210.25 52.5 15], ...
	'String',optv.edit{7}, ...
	'Style','edit', ...
	'Tag','edit07');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[1 1 1], ...
	'ListboxTop',0, ...
	'Position',[314.25 191.25 52.5 15], ...
   'Style','edit', ...
   'String',optv.edit{8},...
	'Tag','edit08');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[1 1 1], ...
	'ListboxTop',0, ...
	'Position',[314.25 153.25 52.5 15], ...
   'Style','edit', ...  
   'String',optv.edit{9},...
	'Tag','edit09');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[1 1 1], ...
	'ListboxTop',0, ...
	'Position',[314.25 172.25 52.5 15], ...
	'String',e, ...
	'Style','popupmenu', ...
	'Tag','popup12', ...
	'Value',2);
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[1 1 1], ...
	'ListboxTop',0, ...
	'Position',[314.25 134.25 52.5 15], ...
	'String','0', ...
   'Style','edit', ...
   'String',optv.edit{10},...
	'Tag','edit10');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[1 1 1], ...
	'ListboxTop',0, ...
	'Position',[314.25 115.25 52.5 15], ...
   'Style','edit', ...
   'String',optv.edit{11},...
	'Tag','edit11');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[1 1 1], ...
	'ListboxTop',0, ...
	'Position',[314.25 96.25 52.5 15], ...
	'String','10^-6', ...
   'Style','edit', ...
   'String',optv.edit{12},...
	'Tag','edit12');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[1 1 1], ...
	'ListboxTop',0, ...
	'Position',[314.25 77.25 52.5 15], ...
	'String','0.1', ...
   'Style','edit', ...
   'String',optv.edit{13},...
	'Tag','edit13');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[1 1 1], ...
	'ListboxTop',0, ...
	'Position',[314.25 58.25 52.5 15], ...
	'String','10^-6', ...
   'Style','edit', ...
   'String',optv.edit{14},...   
	'Tag','edit14');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[1 1 1], ...
	'ListboxTop',0, ...
	'Position',[314.25 39.25 52.5 15], ...
   'Style','edit', ...
   'String',optv.edit{15},...   
	'Tag','edit15');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[0.8 0.8 0.8], ...
	'FontSize',10, ...
	'ListboxTop',0, ...
	'Position',[18 172.25 97.5 15], ...
   'String','GoalsExactAchieve', ...
   'Style','text', ...
   'TooltipString','Number of goals to achieve exactly (do not over- or underachieve).',...
	'Tag','StaticText2');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[1 1 1], ...
	'ListboxTop',0, ...
	'Position',[122.625 172.25 52.5 15], ...
	'String',optv.edit{3}, ...
	'Style','edit', ...
	'Tag','edit03');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ...
	'Callback','closereq', ...
	'ListboxTop',0, ...
	'Position',[310 14.625 45 15], ...
	'String','CANCEL', ...
	'Tag','Pushbutton2');
h1 = uicontrol('Parent',h0, ...
  	'Callback','read2', ...
	'Units','points', ...
	'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ...
	'ListboxTop',0, ...
	'Position',[360 14.625 45 15], ...
	'String','SAVE', ...
	'Tag','pushbutton4');
endfunction
