/** constructor */ public CLSolver(int _candidateDimension) { candidateDimension = _candidateDimension; // we init all candidates once and for all for (int i = 0; i < candidates.Length; i++) { candidates[i] = new CLCandidate(candidateDimension); } }
protected void StoreNewGlobalLeader(int leader) { CLViewpoint newLeaderViewpoint = new CLViewpoint(); CLCandidate leaderCandidate = new CLCandidate(candidateDimension); leaderCandidate.bestEvaluation = candidates [leader].bestEvaluation; leaderCandidate.bestPosition = candidates [leader].bestPosition; leaderCandidate.evaluation = candidates [leader].evaluation; leaderCandidate.inSearchSpace = candidates [leader].inSearchSpace; leaderCandidate.leader = candidates [leader].leader; newLeaderViewpoint.psoRepresentation = leaderCandidate.bestPosition; newLeaderViewpoint.properties = new List <CLVisualProperty> (evaluator.properties); newLeaderViewpoint.satisfaction = new List <float> (evaluator.properties.Count); newLeaderViewpoint.inScreenRatio = new List <float> (evaluator.properties.Count); foreach (CLVisualProperty p in newLeaderViewpoint.properties) { newLeaderViewpoint.satisfaction.Add(p.satisfaction); newLeaderViewpoint.inScreenRatio.Add(p.inScreenRatio); } globalBestViewpoints.Add(newLeaderViewpoint); }
// constructor, also sets the best candidate public CandidateCluster(CLCandidate c) { bestCandidate = c; }