title: cell overlap removal in vlsi placement
body: <p>Below code is to remove overlap among cells residing inside grids.</p>
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;math.h&gt;
  #include &lt;time.h&gt;
  #define TRUE 1
  #define FALSE 0
  //coordinate representation
  struct Point
  {
      double x;
      double y;
  };
  //block representation with 4 coordinates
  struct Block
  {
      unsigned int id;
      struct Point bottomLeft, topLeft, bottomRight, topRight;
      double width, height;
      double whitespace;
  };
  struct Overlap
  {
      double overlapLength;
      struct Block *b1, *b2;
  } OL[1000];
  struct Block *b;
  struct Block ROW1, ROW2, ROW3;
  
  int comparator(const void *p, const void *q)
  {
      return (((struct Overlap *)p)-&gt;overlapLength -
              (((struct Overlap *)q)-&gt;overlapLength));
  }
  
  //intialise Blocks using bottom left x,y coordinate
  void intialiseBlock(struct Block *B)
  {
      B-&gt;topLeft.x = B-&gt;bottomLeft.x;
      B-&gt;topLeft.y = B-&gt;height + B-&gt;bottomLeft.y;
      B-&gt;bottomRight.x = B-&gt;width + B-&gt;bottomLeft.x;
      B-&gt;bottomRight.y = B-&gt;bottomLeft.y;
      B-&gt;topRight.x = B-&gt;width + B-&gt;bottomLeft.x;
      B-&gt;topRight.y = B-&gt;height + B-&gt;bottomLeft.y;
  }
  
  //update coordinate
  void move(double xDelta, double yDelta, struct Point *p)
  {
      // Parameter values are increments to the current coordinates
      p-&gt;x += xDelta;
      p-&gt;y += yDelta;
  }
  
  //calculate and return distance between 2 points
  double distance(const struct Point aPoint, const struct Point bPoint)
  {
      return sqrt((aPoint.x - bPoint.x) * (aPoint.x - bPoint.x) +
                  (aPoint.y - bPoint.y) * (aPoint.y - bPoint.y));
  }
  
  //generate width of cell using number of cells
  double computeCellWidth(int ncell)
  {
      double width = (0.8 * 400) / ncell;
      return width;
  }
  
  //create a
  unsigned int rand_interval(unsigned int min, unsigned int max)
  {
      int r;
      const unsigned int range = 1 + max - min;
      const unsigned int buckets = RAND_MAX / range;
      const unsigned int limit = buckets * range;
  
      /* Create equal size buckets all in a row, then fire randomly towards
     * the buckets until you land in one of them. All buckets are equally
     * likely. If you land off the end of the line of buckets, try again. */
      do
      {
          r = rand();
      } while (r &gt;= limit);
  
      return min + (r / buckets);
  }
  
  //place blocks in appropriate rows
  void placeVertical(struct Block *b, int n, struct Block ROW1, struct Block ROW2,
                     struct Block ROW3)
  {
      for (int i = 0; i &lt; n; i++)
      {
          double distanceFromBottom = 0.0;
          double distanceFromTop = 0.0;
          // check if Inside Row1 and Row2
          if ((b[i].bottomLeft.y &lt; ROW1.topLeft.y) &amp;&amp; (b[i].topLeft.y &gt; ROW1.topLeft.y))
          {
              //printf(&quot;ROW1 and ROW2 Executed\n&quot;);
              distanceFromBottom = ROW1.topLeft.y - b[i].bottomLeft.y;
              distanceFromTop = b[i].height - distanceFromBottom;
  
              if (distanceFromBottom &gt; distanceFromTop)
              {
                  move(0, -distanceFromTop, &amp;b[i].bottomLeft);
                  move(0, -distanceFromTop, &amp;b[i].topLeft);
                  move(0, -distanceFromTop, &amp;b[i].bottomRight);
                  move(0, -distanceFromTop, &amp;b[i].topRight);
              }
              else
              {
                  move(0, distanceFromBottom, &amp;b[i].bottomLeft);
                  move(0, distanceFromBottom, &amp;b[i].topLeft);
                  move(0, distanceFromBottom, &amp;b[i].bottomRight);
                  move(0, distanceFromBottom, &amp;b[i].topRight);
              }
          }
          // check if Inside Row2 and Row3
          else if ((b[i].bottomLeft.y &lt; ROW2.topLeft.y) &amp;&amp; (b[i].topLeft.y &gt; ROW2.topLeft.y))
          {
              //System.out.println(&quot;ROW2 and ROW3 Executed&quot;);
              distanceFromBottom = ROW2.topLeft.y - b[i].bottomLeft.y;
              distanceFromTop = b[i].height - distanceFromBottom;
              if (distanceFromBottom &gt; distanceFromTop)
              {
                  move(0, -distanceFromTop, &amp;b[i].bottomLeft);
                  move(0, -distanceFromTop, &amp;b[i].topLeft);
                  move(0, -distanceFromTop, &amp;b[i].bottomRight);
                  move(0, -distanceFromTop, &amp;b[i].topRight);
              }
              else
              {
                  move(0, distanceFromBottom, &amp;b[i].bottomLeft);
                  move(0, distanceFromBottom, &amp;b[i].topLeft);
                  move(0, distanceFromBottom, &amp;b[i].bottomRight);
                  move(0, distanceFromBottom, &amp;b[i].topRight);
              }
          }
          else if ((b[i].bottomLeft.y &gt;= ROW1.bottomLeft.y) &amp;&amp; (b[i].topLeft.y &lt;= ROW1.topLeft.y))
          {
              // do nothing in ROW1
          }
          else if ((b[i].bottomLeft.y &gt;= ROW2.bottomLeft.y) &amp;&amp; (b[i].topLeft.y &lt;= ROW2.topLeft.y))
          {
              // do nothing in ROW2
          }
          else // ((b[i].bottomLeft.y &gt;=
          // ROW2.bottomLeft.y)&amp;&amp;(b[i].topLeft.y &lt;=
          // ROW2.topLeft.y))
          {
              // do nothing in ROW3
          }
      }
  }
  
  //use when floating point operations create run time problems
  void linkfloat()
  {
      float a = 0.0, *x;
      x = &amp;a;
      a = *x;
  }
  
      
  int findOverlaps(struct Block *b, int n)
  {
      int k, j, p = 0;
      //struct Overlap OL[200];
      //short flag = FALSE;
      double overlapLength = 0.0;
      for (int i = 0; i &lt; n - 1; i++)
      {
          k = i;
          for (j = i + 1; j &lt; n; j++)
          {
              if (k == j)
                  continue;
              overlapLength = 0.0;
              //for ROW1
              if (b[k].bottomLeft.y &gt;= 0 &amp;&amp; b[k].topLeft.y &lt;= 100 &amp;&amp; b[j].bottomLeft.y &gt;= 0 &amp;&amp; b[j].topLeft.y &lt;= 100)
              {
                  //if ((b[k].bottomRight.x &gt; b[j].bottomLeft.x) &amp;&amp; (b[k].bottomRight.y &lt; b[j].topLeft.y || b[k].topRight.y &gt; b[j].bottomLeft.y))
                  if ((b[k].bottomLeft.y == b[j].bottomLeft.y) &amp;&amp; (b[k].bottomRight.x &gt; b[j].bottomLeft.x))
                  {
                      overlapLength = b[k].bottomRight.x - b[j].bottomLeft.x;
                      OL[p].overlapLength = overlapLength;
                      OL[p].b1 = &amp;b[k];
                      OL[p].b2 = &amp;b[j];
                      p++;
                  }
                  else if (((b[k].topLeft.y &gt; b[j].bottomLeft.y) &amp;&amp; (b[k].topRight.x &gt; b[j].bottomLeft.x)) || ((b[k].bottomLeft.y &lt; b[j].topLeft.y) &amp;&amp; (b[k].bottomRight.x &gt; b[j].topLeft.x)))
                  {
                      //flag = TRUE;
                      overlapLength = b[k].bottomRight.x - b[j].bottomLeft.x;
                      OL[p].overlapLength = overlapLength;
                      OL[p].b1 = &amp;b[k];
                      OL[p].b2 = &amp;b[j];
                      p++;
                  }
                  else
                  {
                  }
                  overlapLength = 0.0;
              }
              //For Row2
              else if (b[k].bottomLeft.y &gt;= 100 &amp;&amp; b[k].topLeft.y &lt;= 200 &amp;&amp; b[j].bottomLeft.y &gt;= 100 &amp;&amp; b[j].topLeft.y &lt;= 200)
              {
                  if ((b[k].bottomLeft.y == b[j].bottomLeft.y) &amp;&amp; (b[k].bottomRight.x &gt; b[j].bottomLeft.x))
                  {
                      overlapLength = b[k].bottomRight.x - b[j].bottomLeft.x;
                      OL[p].overlapLength = overlapLength;
                      OL[p].b1 = &amp;b[k];
                      OL[p].b2 = &amp;b[j];
                      p++;
                  }
                  else if (((b[k].topLeft.y &gt; b[j].bottomLeft.y) &amp;&amp; (b[k].topRight.x &gt; b[j].bottomLeft.x)) || ((b[k].bottomLeft.y &lt; b[j].topLeft.y) &amp;&amp; (b[k].bottomRight.x &gt; b[j].topLeft.x)))
                  {
                      //flag = TRUE;
                      overlapLength = b[k].bottomRight.x - b[j].bottomLeft.x;
                      OL[p].overlapLength = overlapLength;
                      OL[p].b1 = &amp;b[k];
                      OL[p].b2 = &amp;b[j];
                      p++;
                  }
                  else
                  {
                  }
                  overlapLength = 0.0;
              }
              //For Row3
              else if (b[k].bottomLeft.y &gt;= 200 &amp;&amp; b[k].topLeft.y &lt;= 300 &amp;&amp; b[j].bottomLeft.y &gt;= 200 &amp;&amp; b[j].topLeft.y &lt;= 300)
              {
                  if ((b[k].bottomLeft.y == b[j].bottomLeft.y) &amp;&amp; (b[k].bottomRight.x &gt; b[j].bottomLeft.x))
                  {
                      overlapLength = b[k].bottomRight.x - b[j].bottomLeft.x;
                      OL[p].overlapLength = overlapLength;
                      OL[p].b1 = &amp;b[k];
                      OL[p].b2 = &amp;b[j];
                      p++;
                  }
                  else if (((b[k].topLeft.y &gt; b[j].bottomLeft.y) &amp;&amp; (b[k].topRight.x &gt; b[j].bottomLeft.x)) || ((b[k].bottomLeft.y &lt; b[j].topLeft.y) &amp;&amp; (b[k].bottomRight.x &gt; b[j].topLeft.x)))
                  {
                      //flag = TRUE;
                      overlapLength = b[k].bottomRight.x - b[j].bottomLeft.x;
                      OL[p].overlapLength = overlapLength;
                      OL[p].b1 = &amp;b[k];
                      OL[p].b2 = &amp;b[j];
                      p++;
                  }
                  else
                  {
                  }
                  overlapLength = 0.0;
              }
              else
              {
                  //do nothing
              }
          }
      }
      return p;
  }
  
  struct Block *
  getBlock(struct Block *b, int n, int id)
  {
      int i;
      for (i = 0; i &lt; n; i++)
      {
          if (id == b[i].id)
              return (b + i);
      }
      return NULL;
  }
  
  void placeHorizontalGreedy(struct Block *b, int n)
  {
  
      struct Block *t = NULL;
      int p = 0, k = 0;
      p = findOverlaps(b, n);
      qsort(OL, p, sizeof(struct Overlap), comparator);
      while (TRUE)
      {
          t = getBlock(b, 12, OL[k].b2-&gt;id);
          if (t != NULL)
          {
              //t-&gt;bottomLeft.x = t-&gt;bottomLeft.x+OL[0].overlapLength;
              if ((t-&gt;bottomLeft.x + OL[0].overlapLength + t-&gt;width) &lt;= ROW1.bottomRight.x)
              {
                  move(OL[0].overlapLength, 0, &amp;t-&gt;bottomLeft);
                  intialiseBlock(t);
              }
          }
  
          p = findOverlaps(b, n);
          if (p == 0)
              break;
          else
              qsort(OL, p, sizeof(struct Overlap), comparator);
      }
  }
  
  void placeHorizontalNonGreedy(struct Block *b, int n, struct Block ROW1,
                                struct Block ROW2, struct Block ROW3)
  {
      int k, j, p = 0;
      double overlapLength = 0.0;
      for (int i = 0; i &lt; n - 1; i++)
      {
          k = i;
          for (j = i + 1; j &lt; n; j++)
          {
              if (k == j)
                  continue;
              overlapLength = 0.0;
              //check if in Row1
              if (b[k].bottomLeft.y &gt;= ROW1.bottomLeft.y &amp;&amp; b[k].topLeft.y &lt;= ROW1.topLeft.y &amp;&amp; b[j].bottomLeft.y &gt;= ROW1.bottomLeft.y &amp;&amp; b[j].topLeft.y &lt;= ROW1.topLeft.y)
              {
                  if ((b[k].bottomRight.x &gt; b[j].bottomLeft.x) &amp;&amp; (b[k].bottomRight.y &lt; b[j].topLeft.y || b[k].topRight.y &gt; b[j].bottomLeft.y))
                  {
                      //flag = TRUE;
                      overlapLength = b[k].bottomRight.x - b[j].bottomLeft.x;
                      if (overlapLength != 0)
                      {
                          if (b[j].bottomLeft.x + overlapLength + b[j].width &lt;=
                              ROW1.bottomRight.x)
                          {
                              b[j].bottomLeft.x += overlapLength;
                              intialiseBlock(&amp;b[j]);
                          }
                          else
                          {
                              b[j].bottomLeft.x =
                                  b[j].bottomLeft.x + (ROW1.bottomRight.x -
                                                       b[j].bottomRight.x);
                          }
                      }
                  }
              }
              //check if in Row2
              else if (b[k].bottomLeft.y &gt;= ROW2.bottomLeft.y &amp;&amp; b[k].topLeft.y &lt;= ROW2.topLeft.y &amp;&amp; b[j].bottomLeft.y &gt;= ROW2.bottomLeft.y &amp;&amp; b[j].topLeft.y &lt;= ROW2.topLeft.y)
              {
                  if ((b[k].bottomRight.x &gt; b[j].bottomLeft.x) &amp;&amp; (b[k].bottomRight.y &lt; b[j].topLeft.y || b[k].topRight.y &gt; b[j].bottomLeft.y))
                  {
                      //flag = TRUE;
                      overlapLength = b[k].bottomRight.x - b[j].bottomLeft.x;
                      if (overlapLength != 0)
                      {
                          if (b[j].bottomLeft.x + overlapLength + b[j].width &lt;=
                              400)
                          {
                              b[j].bottomLeft.x += overlapLength;
                              intialiseBlock(&amp;b[j]);
                          }
                      }
                  }
              }
              //check if in Row3
              else if (b[k].bottomLeft.y &gt;= ROW3.bottomLeft.y &amp;&amp; b[k].topLeft.y &lt;= ROW3.topLeft.y &amp;&amp; b[j].bottomLeft.y &gt;= ROW3.bottomLeft.y &amp;&amp; b[j].topLeft.y &lt;= ROW3.topLeft.y)
              {
                  if ((b[k].bottomRight.x &gt; b[j].bottomLeft.x) &amp;&amp; (b[k].bottomRight.y &lt; b[j].topLeft.y || b[k].topRight.y &gt; b[j].bottomLeft.y))
                  {
                      //flag = TRUE;
                      overlapLength = b[k].bottomRight.x - b[j].bottomLeft.x;
                      if (overlapLength != 0)
                      {
                          if (b[j].bottomLeft.x + overlapLength + b[j].width &lt;=
                              400)
                          {
                              b[j].bottomLeft.x += overlapLength;
                              intialiseBlock(&amp;b[j]);
                          }
                      }
                  }
              }
              else
              {
                  //printf(&quot;Invalid input\n&quot;);
                  continue;
              }
          }
      }
  }
  
  int main()
  {
      //struct Block b[16];
      //struct Block b[4];
      //struct Block *b;
      //struct Block ROW1, ROW2, ROW3;
      //FILE *fp = fopen(&quot;/home/jeetu/experimentprograms/recordcoord.txt&quot;, &quot;w+&quot;);
      //FILE *fp = fopen(&quot;/home/jeetu/experimentprograms/blockcoordinates.txt&quot;, &quot;r&quot;);
      int ncell = 0, width = 0, i = 0, totalncells = 0, id = 0;
      double distanceFromBottom = 0.0;
      double distanceFromTop = 0.0;
      int x = 0, y = 0, temp = 0, d = 0;
      printf(&quot;Enter number of cells: &quot;);
      scanf(&quot;%d&quot;, &amp;ncell);
      width = computeCellWidth(ncell);
      //width = 40;
      b = (struct Block *)malloc(3 * ncell * sizeof(struct Block));
      //b = (struct Block *)malloc(12 * sizeof(struct Block));
      srand(time(0));
  
      ROW1.bottomLeft.x = 0;
      ROW1.bottomLeft.y = 0;
      ROW1.height = 100;
      ROW1.width = 400;
      ROW1.whitespace = 40000;
      intialiseBlock(&amp;ROW1);
      ROW2.bottomLeft.x = 0;
      ROW2.bottomLeft.y = 100;
      ROW2.height = 100;
      ROW2.width = 400;
      ROW2.whitespace = 40000;
      intialiseBlock(&amp;ROW2);
      ROW3.bottomLeft.x = 0;
      ROW3.bottomLeft.y = 200;
      ROW3.height = 100;
      ROW3.width = 400;
      ROW3.whitespace = 40000;
      intialiseBlock(&amp;ROW3);
  
      for (i = 0; i &lt; ncell; i++)
      {
          if (i == 0)
          {
              // x = rand_interval(0, width / 2);
              x = rand() % (width / 2);
              //y = rand_interval(0, 70);
              y = rand() % 70;
              temp = x;
          }
          //m = rand();
          else
          {
              x = rand_interval((temp + (int)width / 2), temp + width);
              //x = (rand()%((temp+width)-(temp+width/2)))+(temp+width/2);
              //y = rand_interval(0, 70);
              y = rand() % 70;
              temp = x;
          }
          b[totalncells].bottomLeft.x = x;
          b[totalncells].bottomLeft.y = y;
          b[totalncells].width = width;
          b[totalncells].height = 50;
          b[totalncells].id = id;
          //initial white space calculation for ROW1
          if (b[totalncells].bottomLeft.y &gt;= ROW1.bottomLeft.y &amp;&amp; b[totalncells].topLeft.y &lt;= ROW1.topLeft.y)
          {
              ROW1.whitespace =
                  ROW1.whitespace - b[totalncells].width * b[totalncells].height;
          }
          id++;
          intialiseBlock(&amp;b[totalncells]);
          totalncells++;
          //printf(&quot;x=%d\ty=%d\n&quot;, x, y);
      }
      temp = 0;
      //Generate random coordinates For Row2
      for (i = 0; i &lt; ncell; i++)
      {
          //int x = 0, y = 0, m = 0, d = 0;
          if (i == 0)
          {
              /*x = rand_interval(0, width / 2);
           y = rand_interval(100, 170); */
              //x = rand() % (width / 2);
              x = rand() % (width / 2);
              y = (rand() % (170 - 100)) + 100;
              temp = x;
          }
          //m = rand();
          else
          {
              /*x = rand_interval((temp + (int)width / 2), 400 - (int)width);
           y = rand_interval(100, 170); */
              //x = (rand()%((temp+width)-(temp+width/2)))+(temp+width/2);
              x = rand_interval((temp + (int)width / 2), temp + width);
              y = (rand() % (170 - 100)) + 100;
              temp = x;
          }
  
          b[totalncells].bottomLeft.x = x;
          b[totalncells].bottomLeft.y = y;
          b[totalncells].width = width;
          b[totalncells].height = 50;
          b[totalncells].id = id;
          //initial white space calculation for ROW2
          if (b[totalncells].bottomLeft.y &gt;= ROW2.bottomLeft.y &amp;&amp; b[totalncells].topLeft.y &lt;= ROW2.topLeft.y)
          {
              ROW2.whitespace =
                  ROW2.whitespace - b[totalncells].width * b[totalncells].height;
          }
          id++;
          intialiseBlock(&amp;b[totalncells]);
          totalncells++;
          //printf(&quot;x=%d\ty=%d\n&quot;, x, y);
      }
      temp = 0;
      //Generate random coordinates For Row3
      for (i = 0; i &lt; ncell; i++)
      {
          //int x = rand_interval(0, 100 - (int)width);
          //int y = rand_interval(20, 25); //cell height is 5 so max will reach 30
          //int x = 0, y = 0, m = 0, d = 0;
          if (i == 0)
          {
              /*x = rand_interval(0, width / 2);
           y = rand_interval(200, 250); */
  
              x = rand() % (width / 2);
              y = (rand() % (250 - 200)) + 200;
              temp = x;
          }
          //m = rand();
          else
          {
              /*x = rand_interval((temp + (int)width / 2), 400 - (int)width);
           y = rand_interval(200, 250); */
              x = rand_interval((temp + (int)width / 2), temp + width);
              //x = (rand()%((temp+width)-(temp+width/2)))+(temp+width/2);
              y = (rand() % (250 - 200)) + 200;
              temp = x;
          }
          b[totalncells].bottomLeft.x = x;
          b[totalncells].bottomLeft.y = y;
          b[totalncells].width = width;
          b[totalncells].height = 50;
          b[totalncells].id = id;
          //initial white space calculation for ROW3
          if (b[totalncells].bottomLeft.y &gt;= ROW3.bottomLeft.y &amp;&amp; b[totalncells].topLeft.y &lt;= ROW3.topLeft.y)
          {
              ROW3.whitespace =
                  ROW3.whitespace - b[totalncells].width * b[totalncells].height;
          }
          id++;
          intialiseBlock(&amp;b[totalncells]);
          totalncells++;
          //printf(&quot;x=%d\ty=%d\n&quot;, x, y);
      }
      for (i = 0; i &lt; totalncells; i++)
      {
          //printf(&quot;%f %f %f %f\n&quot;, b[i].bottomLeft.x, b[i].bottomLeft.y, b[i].width, b[i].height);
          printf(&quot;%d\t%d\t%d\t%d\n&quot;, (int)b[i].bottomLeft.x,
                 (int)b[i].bottomLeft.y, (int)b[i].width, (int)b[i].height);
      }
      placeVertical(b, totalncells, ROW1, ROW2, ROW3);
      //placeVerticalWithDensityConstraints(b,totalncells,ROW1,ROW2,ROW3);
      printf(&quot;\nAfter vertical Updation\n&quot;);
      for (i = 0; i &lt; totalncells; i++)
      {
          printf(&quot;%d\t%d\t%d\t%d\n&quot;, (int)b[i].bottomLeft.x,
                 (int)b[i].bottomLeft.y, (int)b[i].width, (int)b[i].height);
      }
      /*placeHorizontalNonGreedy(b, 12, ROW1, ROW2, ROW3);
       printf(&quot;\nAfter Horizontal Updation(Non greedy)\n&quot;);
       for (i = 0; i &lt; 12; i++)
       {
       printf(&quot;%d\t%d\t%d\t%d\n&quot;, (int)b[i].bottomLeft.x, (int)b[i].bottomLeft.y, (int)b[i].width, (int)b[i].height);
       } */
      placeHorizontalGreedy(b, totalncells);
      printf(&quot;\nAfter Horizontal Updation(Greedy)\n&quot;);
      for (i = 0; i &lt; totalncells; i++)
      {
          printf(&quot;%d\t%d\t%d\t%d\n&quot;, (int)b[i].bottomLeft.x,
                 (int)b[i].bottomLeft.y, (int)b[i].width, (int)b[i].height);
      }
      return 0;
  }
  </code></pre>
  <p>Explanation about the code
  in this program I have defined three structures
  one to represent a Point,one to represent rectangular block with 4 coordinates,one to represent overlap between pair of cells.
  There is function(computeCellWidth) to dynamically compute width of cells according to a formula.
  There are three rows ROW1,ROW2,ROW3 in which cells will reside.
  This program will first ask for number of cells and this is numbers of cells per row.At first x,y coordinates for each cell is randomly generated.Then placeVertical() function will move cells to different rows which are spanning across two rows.Then there is a placeHorizontalGreedy() function which will remove overlap among cells by first finding overlaplength and then sorting them and removing the overlap between cells which has least overlap and this process will continue till either there will be no overlaps or overlap removal is not possible anymore.Here I would like to bring to the notice of everybody that cells will be moved towards the right of the grid to remove overlaps.<strong>In placeHorizontalGreedy() function I have  used a variable p which will indicate number of overlaps after each iteration.for small number of cells testing for p to be zero works fine but not as I increase the numbers.Plus how can I make sure that overlaps exists but overlap removal is not possible anymore,so that I can stop the loop.</strong> Please help me out.</p>