Advertisement
Guest User

Untitled

a guest
Apr 19th, 2014
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.60 KB | None | 0 0
  1. while (true)
  2. {
  3.     //hugo construction
  4.     List<Pair> tempHugoNodes = new ArrayList<Pair>();
  5.     for (int i=0;i<hugoNodes.size();i++)
  6.     {
  7.         Point tempPoint = hugoPoints[hugoNodes.get(i).GetPoint()];
  8.         for (int j=0;j<tempPoint.GetPN();j++)
  9.         {
  10.             Path tempPath = tempPoint.GetPath(j);
  11.             int price = hugoNodes.get(i).GetPrice()+tempPath.GetPrice()+points[tempPath.GetFinishPoint()].GetOvernightPrice();
  12.             if (price<leastPrice.GetPrice())
  13.             {
  14.                 tempHugoNodes.add(new Pair(tempPath.GetFinishPoint(), price));
  15.             }
  16.         }
  17.     }
  18.     hugoNodes.clear();
  19.     hugoNodes = new ArrayList<Pair>(tempHugoNodes);
  20.     //end
  21.     //quido construction
  22.     List<Pair> tempQuidoNodes = new ArrayList<Pair>();
  23.     for (int i=0;i<quidoNodes.size();i++)
  24.     {
  25.         Point tempPoint = quidoPoints[quidoNodes.get(i).GetPoint()];
  26.         for (int j=0;j<tempPoint.GetPN();j++)
  27.         {
  28.             Path tempPath = tempPoint.GetPath(j);
  29.             int price = hugoNodes.get(i).GetPrice()+tempPath.GetPrice()+points[tempPath.GetFinishPoint()].GetOvernightPrice();
  30.             if (price<leastPrice.GetPrice())
  31.             {
  32.                 tempHugoNodes.add(new Pair(tempPath.GetFinishPoint(), price));
  33.             }
  34.         }
  35.     }
  36.     quidoNodes.clear();
  37.     quidoNodes = new ArrayList<Pair>(tempQuidoNodes);
  38.     //end
  39.     for (int i=0;i<hugoNodes.size();i++)
  40.     {
  41.         for (int j=0;j<quidoNodes.size();j++)
  42.         {
  43.             if (hugoNodes.get(i).GetPoint()==quidoNodes.get(j).GetPoint())
  44.             {
  45.                 int price = hugoNodes.get(i).GetPrice()+quidoNodes.get(j).GetPrice() - 2*(points[hugoNodes.get(i).GetPoint()].GetOvernightPrice());
  46.                 if (price<leastPrice.GetPrice())
  47.                 {
  48.                     leastPrice = new Pair (hugoNodes.get(i).GetPoint(), price);
  49.                 }
  50.             }
  51.         }
  52.     }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement