0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028 function hh=demo(obj)
0029 if isinf(obj.dimAvailable);obj.dim=2;end
0030 Xmin=obj.xMin;
0031 Xmax=obj.xMax;
0032
0033 if obj.dim==1
0034 stepM=100;
0035
0036 xx=linspace(Xmin(1),Xmax(1),stepM)';
0037
0038 [ZZobj,GZobj]=obj.evalObj(xx);
0039
0040 hh(1)=obj.show1D(xx,ZZobj,GZobj,[obj.namePb ': Objective'],obj.funObj);
0041
0042 if obj.nbCons>1
0043
0044 [ZZcons,GZcons]=obj.evalCons(xx);
0045
0046 hh(2)=obj.show1D(xx,ZZcons,GZcons,[obj.namePb ': Constraint'],obj.funCons);
0047 end
0048
0049 obj.figureHandle=hh;
0050 elseif any(ismember(obj.dimAvailable,2))||isinf(obj.dimAvailable)
0051 obj.dim=2;
0052 stepM=100;
0053
0054 xL=linspace(Xmin(1),Xmax(1),stepM);
0055 yL=linspace(Xmin(2),Xmax(2),stepM);
0056 [x,y]=meshgrid(xL,yL);
0057 xx=zeros(stepM,stepM,2);
0058 xx(:,:,1)=x;xx(:,:,2)=y;
0059
0060 [ZZobj,GZobj]=obj.evalObj(xx);
0061
0062 hh(1)=obj.show2D(x,y,ZZobj,GZobj,[obj.namePb ': Objective'],obj.funObj);
0063
0064 if obj.nbCons>0
0065
0066 [ZZcons,GZcons]=obj.evalCons(xx);
0067 statusCons=obj.checkCons;
0068
0069 hh(2)=obj.show2D(x,y,ZZcons,GZcons,[obj.namePb ': Constraint'],obj.funCons);
0070 hh(3)=obj.show2DCons(x,y,ZZobj,statusCons,[obj.namePb ': Objective function with Constraint'],obj.funObj);
0071 end
0072
0073 obj.figureHandle=hh;
0074 else
0075 Ofprintf(['Too large dimension to be plotted (' mfilename ')\n']);
0076 end
0077 end