verifyPoints

PURPOSE ^

function [errorsA, errorsLUB] = verifyPoints(sampleStruct)

SYNOPSIS ^

function [errorsA, errorsLUB, stuckPoints] = verifyPoints(sampleStruct)

DESCRIPTION ^

 function [errorsA, errorsLUB] = verifyPoints(sampleStruct)
verifyPoints Verify that a set of points are in the solutoin space of sampleStruct.
 Typically, this method would be called to check a set of warmup points or
 points generated via gpSampler. Also verifies if points moved from
 warmup points.

 function [errorsA, errorsLUB, stuckPoints] = verifyPoints(sampleStruct)
 
INPUT
 sampleStruct      LPProblem containing points and warmup points

OUTPUTS
 errorsA           Row index of the constraint in sampleStruct that
                   is not consistent with the given points
 errorsLUB         Upper and lower bounds of the constraint + tolerance
 stuckPoints       Index of points which did not move.

 Author: Ellen Tsai 2007
 Richard Que (12/1/09) Combined with checkWP.m

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % function [errorsA, errorsLUB] = verifyPoints(sampleStruct)
0002 function [errorsA, errorsLUB, stuckPoints] = verifyPoints(sampleStruct)
0003 %verifyPoints Verify that a set of points are in the solutoin space of sampleStruct.
0004 % Typically, this method would be called to check a set of warmup points or
0005 % points generated via gpSampler. Also verifies if points moved from
0006 % warmup points.
0007 %
0008 % function [errorsA, errorsLUB, stuckPoints] = verifyPoints(sampleStruct)
0009 %
0010 %INPUT
0011 % sampleStruct      LPProblem containing points and warmup points
0012 %
0013 %OUTPUTS
0014 % errorsA           Row index of the constraint in sampleStruct that
0015 %                   is not consistent with the given points
0016 % errorsLUB         Upper and lower bounds of the constraint + tolerance
0017 % stuckPoints       Index of points which did not move.
0018 %
0019 % Author: Ellen Tsai 2007
0020 % Richard Que (12/1/09) Combined with checkWP.m
0021 
0022 %check to see if warmup points moved
0023 [warmupPts, points] = deal(sampleStruct.warmupPts, sampleStruct.points);
0024 
0025 n=size(points,2);
0026 len=size(n,1);
0027 stuckPoints=zeros(0,1);
0028 
0029 for i=1:n
0030     len(i,1)=norm(warmupPts(:,i)-points(:,i));
0031     if len(i,1)<10
0032         stuckPoints=[stuckPoints; i];
0033     end
0034 end
0035 minL = min(len);
0036 
0037 %check to see if points are within solution space
0038 [A,b,csense]=deal(sampleStruct.A,sampleStruct.b,sampleStruct.csense);
0039 t=.01; %tolerance
0040 npoints = size(points, 2);
0041 
0042 LHS = A*points;
0043 EIndex = (csense == 'E');
0044 LIndex = (csense == 'L');
0045 GIndex = (csense == 'G');
0046 
0047 [errorsL(:,1), errorsL(:,2)] = find(LHS(LIndex,:) - b(LIndex)* ones(1, npoints) > t);
0048 [errorsG(:,1), errorsG(:,2)] = find(b(GIndex)* ones(1, npoints) - LHS(GIndex,:)   > t);
0049 [errorsE(:,1), errorsE(:,2)] = find( abs(LHS(EIndex,:) - b(EIndex)* ones(1, npoints))   > t);
0050 
0051 errorsUB = find(points > sampleStruct.ub*ones(1,npoints) + t);
0052 errorsLB = find(points < sampleStruct.lb*ones(1,npoints) - t);
0053 
0054 errorsA = [errorsL; errorsG; errorsE];
0055 errorsLUB = [errorsLB; errorsUB];
0056 
0057 end

Generated on Thu 21-Jun-2012 15:39:23 by m2html © 2003