0001
0002 function [alx,aldx,alddx] = setuptestpoint(obj, filename, type)
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 global DCF_SILENT
0016 DCF_SILENT=1;
0017
0018 if (strcmpi(type,'pennlp') || strcmpi(type,'nlp'))
0019
0020
0021
0022
0023
0024
0025 x=datatransfer(filename,0);
0026 pen_u=datatransfer(filename,1);
0027
0028
0029
0030 pen_p=datatransfer(filename,2);
0031 aldx=datatransfer(filename,3);
0032 pen_H=datatransfer(filename,4);
0033 pen_A=datatransfer(filename,5);
0034 ueq=datatransfer(filename,6);
0035 alx=datatransfer(filename,7);
0036
0037
0038
0039 if (length(x)~=obj.Nx || obj.NYnnz~=0)
0040 error('DCF does not fit the number of variables.');
0041 end
0042 if (obj.NA~=0)
0043 error('Problem object is not a NLP (only) problem.');
0044 end
0045 if (length(pen_u)~=obj.Nxbox+obj.Nineq+obj.Neq)
0046 error('Problem object does not seem to be defined by the same NLP model');
0047 end
0048 if (length(pen_u)~=length(pen_p))
0049 error('Arrays U and P in DCF are of different size? Corrupted DCF?');
0050 end
0051 if (length(pen_u)~=length(obj.userdata.BEQUAL_M2))
0052 error('Mapping to separate ineq+eq is incompatible, different problem loaded?');
0053 end
0054 if (length(aldx)~=obj.Nx)
0055 error('DCF looks incompatible (because of aldx).');
0056 end
0057 if (length(ueq)~=obj.Neq)
0058 error('Different number of equalities.');
0059 end
0060
0061
0062
0063 u=pen_u(~obj.userdata.BEQUAL_M2);
0064 p=pen_p(~obj.userdata.BEQUAL_M2);
0065
0066
0067 obj.xall=x;
0068 obj.uxbox=u(1:obj.Nxbox);
0069 obj.uineq=u(obj.Nxbox+1:end);
0070 obj.pxbox=p(1:obj.Nxbox);
0071 obj.pineq=p(obj.Nxbox+1:end);
0072 obj.ueq=ueq;
0073
0074
0075 [pha,phb]=size(pen_H);
0076 if (obj.Neq~=0 && isempty(pen_A) && pha==obj.Nx+obj.Neq && phb==pha)
0077 disp(' ---Separating equalities from input data.---');
0078 disp(' ');
0079 pen_A = pen_H(1:obj.Nx,(obj.Nx+1):phb);
0080 pen_H = pen_H(1:obj.Nx,1:obj.Nx);
0081
0082
0083 end
0084
0085
0086 if (~issparse(pen_H))
0087 disp(' ---pen_H is dense, symmetrizing it for sure---');
0088 disp(' ');
0089 pen_H_ut=triu(pen_H,1);
0090
0091 pen_H = triu(pen_H) + pen_H_ut';
0092 end
0093
0094 alddx=[pen_H, pen_A; pen_A', sparse(obj.Neq,obj.Neq)];
0095
0096 elseif (strcmpi(type,'pensdp') || strcmpi(type,'sdp'))
0097
0098
0099
0100
0101 x=datatransfer(filename,0);
0102 u=datatransfer(filename,1);
0103 p=datatransfer(filename,2);
0104
0105 dense=datatransfer(filename,3);
0106 alx=datatransfer(filename,4);
0107 aldx=datatransfer(filename,5);
0108 alddx=datatransfer(filename,6);
0109
0110 if (~issparse(alddx))
0111
0112 alddx = alddx+triu(alddx,1)';
0113 end
0114
0115 Na = datatransfer(filename,7);
0116 umat=cell(Na,1);
0117 for k=1:Na
0118
0119
0120
0121 umatk=datatransfer(filename,double(7+k));
0122 if (size(umatk,1)~=size(umatk,2))
0123
0124
0125
0126 nnz=size(umatk,1);
0127 dim=(-1+sqrt(1+8*nnz))/2;
0128
0129
0130 Mtmp=triu(ones(dim));
0131 [irow,icol]=find(Mtmp);
0132 utmp=sparse(irow,icol,umatk);
0133 umat{k}=full(utmp+triu(utmp,1)');
0134
0135
0136 else
0137
0138 umat{k}=umatk;
0139 end
0140 end
0141
0142
0143 if (length(x)~=obj.Nx || obj.NYnnz~=0)
0144 error('DCF does not fit the number of variables.');
0145 end
0146 if (Na~=obj.NA || obj.NANLN~=0)
0147 error('DCF has different number of matrix constraints.');
0148 end
0149 if (obj.Nxbox~=0 || obj.NgNLN~=0 || obj.Neq~=0)
0150 error('Problem object does not seem to be from SDPA');
0151 end
0152 if (length(u)~=obj.Nineq)
0153 error('DCF has a different number of linear inequalitites.');
0154 end
0155
0156 obj.xall=x;
0157 obj.uineq=u;
0158 obj.pineq=p(1:obj.Nineq);
0159 for k=1:Na
0160 obj.UA{k}=umat{k};
0161 end
0162
0163
0164
0165 obj.PA=2*p(obj.Nineq+1:end);
0166
0167
0168 else
0169 error('Unknown type of DCF file.');
0170 end
0171