Examples of RadiusIteration


Examples of com.ike.rwdccalc.Objects.RadiusIteration

                ArrayList<RadiusIteration> answerList = Iterate.getRadiusDifference(
                    2, footprintWidth, pricePerHour, speed,
                    increment);
                plotPoints(answerList);
              } else {
                RadiusIteration answer = Iterate.doIterations(
                    footprintWidth, pricePerHour, speed,
                    increment);
                bruteForce(answer);
              }
             
View Full Code Here

Examples of com.ike.rwdccalc.Objects.RadiusIteration

  static ArrayList<RadiusIteration> distance = new ArrayList<RadiusIteration> ();

  public static RadiusIteration doIterations(double footprintWidth, double pricePerHour, double groundSpeed, double increment) {

    // Initiate a new RadiusIteration object, this will be used to find the quickest path
    RadiusIteration lowest = new RadiusIteration();
    // Only look for two planes, we know for out circumstances that
    // two planes is the best option, and three or four planes just
    // takes too long
    for (int x = 2; x <= 2; x++) {
      // Find the best path based on the information given
View Full Code Here

Examples of com.ike.rwdccalc.Objects.RadiusIteration

        // Find out the price from how long it took
        price = time * pricePerHour * 2;

        // Add a new object to distnace
        distance.add(new RadiusIteration(
          price,
          new String[] {
            "Plane One: " + x, "Plane Two: " + max
          },
          new MissionPath[] {
            new MissionPath(
              small.getDistanceFromCenter(),
              small.getAngleFromCenter(),
              small.getSegmentType()),
            new MissionPath(
              big.getDistanceFromCenter(),
              big.getAngleFromCenter(),
              big.getSegmentType())
          },
          x, time
        ));
       
      }
      break;
    // Three planes
    case 3:
      for (int x = 1; x < max; x+=increment) {
        first = max - x;
        small = CalculatingTools.calculate(true, true, 0, x,
            footprintWidth);
        for (int y = x + 1; y < first; y+=10) {
          min = x + y;
          middle = CalculatingTools.calculate(true, true, x, min,
              footprintWidth);
          big = CalculatingTools.calculate(true, true, min, max,
              footprintWidth);

          time = Math.max(small.getAnswerInFeet(),
              middle.getAnswerInFeet());
          time = Math.max(time, big.getAnswerInFeet());
          time = time / speed;

          price = time * pricePerHour * 3;

          distance.add(new RadiusIteration(
            price,
            new String[] {
              "Plane One: " + x, "Plane Two: " + min, "Plane Three " + max
            },
            new MissionPath[] {
              new MissionPath(
                small.getDistanceFromCenter(),
                small.getAngleFromCenter(),
                small.getSegmentType()),
              new MissionPath(
                middle.getDistanceFromCenter(),
                middle.getAngleFromCenter(),
                middle.getSegmentType()),
              new MissionPath(
                big.getDistanceFromCenter(),
                big.getAngleFromCenter(),
                big.getSegmentType())
            },
            x, time
          ));
        }
      }
      break;
    // Fource planes
    case 4:
      for (int x = 1; x < max; x+=increment) {
        first = max - x;
        small = CalculatingTools.calculate(true, true, 0, x,
            footprintWidth);
        for (int y = x + 1; y < first; y+=10) {
          min = x + y;
          second = max - min;
          middle = CalculatingTools.calculate(true, true, x, min,
              footprintWidth);
          for (int z = y + 1; z < second; z+=10) {
            mid = min + z;
            bigger = CalculatingTools.calculate(true, true, min,
                mid, footprintWidth);
            big = CalculatingTools.calculate(true, true, mid, max,
                footprintWidth);

            time = Math.max(small.getAnswerInFeet(),
                middle.getAnswerInFeet());
            time = Math.max(time, bigger.getAnswerInFeet());
            time = Math.max(time, big.getAnswerInFeet());

            time = time / speed;

            price = time * pricePerHour * 4;

            distance.add(new RadiusIteration(
              price,
              new String[] {
                "Plane One: " + x, "Plane Two: " + min, "Plane Three " + mid, "Plane Four: " + max
              },
              new MissionPath[] {
View Full Code Here

Examples of com.ike.rwdccalc.Objects.RadiusIteration

  ///////////////
  // getLowest //
  ///////////////
  private static RadiusIteration getLowest(ArrayList<RadiusIteration> difference) {

    RadiusIteration lowest = new RadiusIteration();
    // We need to go through the whole array
    for (int x = 0; x < difference.size() - 1; x++) {
      if (x == 0) {
        // Since this is the first go, let's compare the first two prices together
        if (Math.min(
            difference.get(x).getPrice(),
            difference.get(x + 1).getPrice()) == difference.get(x).getPrice()) {
          // Set lowest to the lower price
          lowest = difference.get(x);
        } else {
          // Set lowest to the lower price
          lowest = difference.get(x + 1);
        }
      } else {
        // This isn't the first go, so pick up where we left off
        if (Math.min(lowest.getPrice(),
            difference.get(x + 1).getPrice()) == difference.get(x + 1).getPrice()) {
          // Only update if the lowest price has changed
          lowest = difference.get(x + 1);
        }
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.