ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/loops/TSPExchangerTest.java
(Generate patch)

Comparing jsr166/src/test/loops/TSPExchangerTest.java (file contents):
Revision 1.14 by jsr166, Tue Feb 21 01:54:03 2012 UTC vs.
Revision 1.19 by jsr166, Sun Sep 13 16:28:14 2015 UTC

# Line 18 | Line 18 | import java.util.concurrent.locks.*;
18   * A set of worker threads perform updates on subpops. The basic
19   * update step is:
20   * <ol>
21 < *   <li> Select a breeder b from the subpop
22 < *   <li> Create a strand of its tour with a random starting point and length
23 < *   <li> Offer the strand to the exchanger, receiving a strand from
24 < *        another subpop
25 < *   <li> Combine b and the received strand using crossing function to
26 < *        create new chromosome c.
27 < *   <li> Replace a chromosome in the subpop with c.
21 > *   <li>Select a breeder b from the subpop
22 > *   <li>Create a strand of its tour with a random starting point and length
23 > *   <li>Offer the strand to the exchanger, receiving a strand from
24 > *       another subpop
25 > *   <li>Combine b and the received strand using crossing function to
26 > *       create new chromosome c.
27 > *   <li>Replace a chromosome in the subpop with c.
28   * </ol>
29   *
30   * This continues for a given number of generations per subpop.
# Line 39 | Line 39 | public class TSPExchangerTest {
39      static final int NCPUS = Runtime.getRuntime().availableProcessors();
40  
41      /** Runs start with two threads, increasing by two through max */
42 <    static final int DEFAULT_MAX_THREADS  = Math.max(4, NCPUS + NCPUS/2);
42 >    static final int DEFAULT_MAX_THREADS = Math.max(4, NCPUS + NCPUS/2);
43  
44      /** The number of replication runs per thread value */
45      static final int DEFAULT_REPLICATIONS = 3;
# Line 229 | Line 229 | public class TSPExchangerTest {
229          p.printSnapshot(secs);
230      }
231  
232
232      /**
233       * A Population creates the subpops, subpops, and threads for a run
234       * and has control methods to start, stop, and report progress.
# Line 362 | Line 361 | public class TSPExchangerTest {
361      }
362  
363      /**
364 <     * A Subpop maintains a set of chromosomes..
364 >     * A Subpop maintains a set of chromosomes.
365       */
366      static final class Subpop {
367          /** The chromosomes, kept in sorted order */
# Line 406 | Line 405 | public class TSPExchangerTest {
405           * other.  It is hardwired because small variations of it
406           * don't matter much.
407           *
408 <         * @param g the first generation to run.
408 >         * @param g the first generation to run
409           */
410          int runUpdates() throws InterruptedException {
411              int n = 1 + (rng.next() & ((subpopSize << 1) - 1));

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines