public IVelocy Add(IVelocy speed) { Velocy v = (speed as Velocy); int[] vel = new int[this.velocy.Length]; for (int i = 0; i < this.velocy.Length; i++) { vel[i] = (this.velocy[i] + v.velocy[i]) % this.numberOfWorkers; } return(new Velocy(this.numberOfWorkers, vel)); }
public IPositionPS AddVelocy(IVelocy velocy) { Velocy v = (velocy as Velocy); int[] vec = v.GetVelocy(); int[] outPos = new int[this.position.Length]; for (int i = 0; i < this.position.Length; i++) { outPos[i] = (this.position[i] + vec[i]) % this.numberOfWorkers; if (outPos[i] < 0) { outPos[i] *= (-1); } } return(new PositionPS(outPos, this.numberOfWorkers)); }
public SolutionPosSpeed(int numberOfJobs, int numberOfWorkers, SolutionPosSpeed localOptimum) { Position = new PositionPS(numberOfJobs, numberOfWorkers); Speed = new Velocy(numberOfJobs, numberOfWorkers); LocalOptimum = localOptimum; }