public Solution(int[] solution, Mochila mochila) { this.s = solution.clone(); this.mochila = mochila; this.forbiden = new boolean[mochila.getNumItens()]; for (int i = 0; i < this.mochila.getNumItens(); i++) this.forbiden[i] = false; }
public Solution(Solution solution, int index) { this.s = solution.s.clone(); this.mochila = solution.mochila; this.forbiden = new boolean[mochila.getNumItens()]; for (int i = 0; i < this.mochila.getNumItens(); i++) this.forbiden[i] = false; if (this.s[index] == 0) this.s[index] = 1; else this.s[index] = 0; }