private Solution GetSolutionAtDistance(int distance, ISolutionPair[] solutionPairsIn) { ISolutionPair[] solutionPairs = new SolutionPair[solutionPairsIn.Length]; for (int i = 0; i < solutionPairsIn.Length; i++) { solutionPairs[i] = new SolutionPair() { WorkerMan = solutionPairsIn[i].WorkerMan, WorkToDo = solutionPairsIn[i].WorkToDo }; } for (int i = 0; i < distance; i++) //distance-szer megváltoztatom az egyik munkást { int rnd = this.random.Next(solutionPairs.Length); var wm = solutionPairs[rnd].WorkerMan; do { solutionPairs[rnd].WorkerMan = this.workerMens[random.Next(this.workerMens.Length)]; //megváltoztatom az egyik munkást } while (solutionPairs[rnd].WorkerMan == wm); } return(new Solution() { SolutionPairs = solutionPairs.ToList() }); }
public ISolution InitializeStart() { ISolutionPair[] solutionPairs = new SolutionPair[this.workToDos.Length]; for (int i = 0; i < this.workToDos.Length; i++) { solutionPairs[i] = new SolutionPair() { WorkToDo = workToDos[i], WorkerMan = this.workerMens[random.Next(this.workerMens.Length)] }; } return(new Solution() { SolutionPairs = solutionPairs.ToList() }); }