private DS Nearest(DS ds, USample us) { DS nearest = null; Metric minValue = Metric.Zero; for (int i = 0; i < USample.SampleSize; i++) { if (us.Sample[i] != null) { Metric dis = h(us.Sample[i], ds); if (nearest == null || minValue > dis) { nearest = us.Sample[i]; minValue = dis; } } } return(nearest); }
private void init(Goal <SS, DS> Goal, SS ss, DS Sstart, Operator <SS, DS>[] Actions) { LockedList = new HashSet <DS>( ); RHS = new Dictionary <string, Metric>( ); G = new Dictionary <string, Metric>( ); HAdjusted = new Dictionary <string, Metric>( ); this.Sgoal = Transformer.Transform(Goal, Sstart); this.Sstart = Sstart; this.ss = ss; this.Ops = Actions; us = new USample( ); switch (this.sm) { case ChooseMethodStep.LSSLRTAStar: h0 = (x, y) => H.H(ss, x, y, Actions); tree = new ExtendedDictionary <DS, DS>(X => null); HLSS = new ExtendedDictionary <DS, Metric>(x => h0(x, Sgoal)); Incumbant = null; break; } }