/** Fill in the finalScore attribute for every choice. */ private static void calculateFinalScores( List<Choice> choices, List<Characteristic> characs, double[][] crossRankings) { double[] scores = new double[choices.size()]; double max = 0.0; for (int i = 0; i < choices.size(); i++) { for (int j = 0; j < characs.size(); j++) { scores[i] += characs.get(j).getRank() * crossRankings[i][j]; choices.get(i).setFinalScore((int) Math.round(crossRankings[i][j] * 100)); } if (scores[i] > max) max = scores[i]; } for (int i = 0; i < scores.length; i++) { choices.get(i).setFinalScore((int) (Math.round(scores[i] / max * 100))); } }
@Test public void testRandom() { Random random = new Random(); // System.out.println(random.nextInt()); System.out.println(random.nextInt(10)); System.out.println(Math.round(((double) Math.random() * 100))); }
public long deltaDCountComplete() { Iterator iter = idx.sigma.iterator(); double count = 0; FuncSymb f; double qdsize = qd.size(); while (iter.hasNext()) { f = (FuncSymb) iter.next(); count = count + Math.pow(qdsize, (double) f.arity); } return Math.round(count); }
public long deltaDCount() { double count = 0; double tcount; double argsize; double qdsize = qd.size(); ArrayList<LinkedHashSet<LinkedHashSet<String>>> lhs; for (int i = 0; i < deltad.size(); i++) { lhs = deltad.get(i).lhs; tcount = 1.0; for (int j = 0; j < lhs.size(); j++) { argsize = lhs.get(j).size(); if (argsize == 0) { argsize = qdsize; // don't care argument } tcount = tcount * argsize; } count = count + tcount; } return Math.round(count); }
// to measure euclidean distance (not yet used) final int distance(int x, int y, int i, int j) { double dis = Math.sqrt((x - i) * (x - i) + (y - j) * (y - j)); return (int) Math.round(dis); }
private void handleRotationAngleFieldUserInput() { final Double ra = Math.round(getRotationAngleFieldValue() / 5) * 5.0; updateRotationField(ra); rotate(ra); }