public bool add(Solution a_sol) { //Check if the new entry is dominated by any in the set: bool dominated = false; bool dominatesAny = false; bool crowded = false; int i = 0; while (!dominated && i < m_members.size()) { Solution member = m_members.get(i); int dom = Utils.dominates(member.m_data, a_sol.m_data); //if(dom == -1) if (dom == -1) { //if(crowded) // System.out.println("OUT ["+m_members.size()+"]"); dominated = true; } else if (dom == 1) { //This one is dominated. It must be out. m_members.remove(i); m_hvClean = false; dominatesAny = true; //And keep the index in place: --i; } else if (dom == 2) //Use this line to allow any distance between points in pareto. //}else if(dom == 2 || crowded) //Use this line to avoid crowded fronts (min. distance: EPSILON). { //There is another identical member in the set. Do NOT include: return(false); } else if (dom == 0) { //crowded |= Utils.crowded(member.m_data, a_sol.m_data, EPSILON); } ++i; } if (dominatesAny) { crowded = false; } if (!dominated && !crowded) { /*double[] newOne = new double[a_candidate.length]; * System.arraycopy(a_candidate, 0, newOne, 0, a_candidate.length); * Solution newSol = new Solution(newOne); */ //Helpfunctions.Instance.logg("Yes added sol:" + a_sol.m_data[0] + ", " + a_sol.m_data[1] + ", " + a_sol.m_data[2]); //a_sol.m_state.printLastTurnActions(); m_members.add(a_sol); m_hvClean = false; return(true); } else { //Helpfunctions.Instance.logg("No added sol:" + a_sol.m_data[0] + ", " + a_sol.m_data[1]); } return(false); }