diff --git a/output/graph - optimizer.png b/output/graph - optimizer.png index 773d3fc..021d3d3 100644 Binary files a/output/graph - optimizer.png and b/output/graph - optimizer.png differ diff --git a/output/parameters.txt b/output/parameters.txt index a95cfd3..c49ab5a 100644 --- a/output/parameters.txt +++ b/output/parameters.txt @@ -1,16 +1,3 @@ -We got the best Tobler projections using: - t0=44.49736479301335; t1=0.00392527452555691; t2=4.500664624872501; (0.0015117117801069964, 0.5789093041902463) - t0=44.4936541545398; t1=0.006548940147121929; t2=4.501433723834101; (0.0014673812200635672, 0.5788382710393578) - t0=44.48951494957488; t1=0.006535013891140196; t2=4.501789852627221; (0.0014673803066007664, 0.578780179204182) - t0=44.48413941124096; t1=0.012476702712649335; t2=4.503413820309772; (0.0013693003620921726, 0.5786674049116084) - t0=44.4774541677433; t1=0.010580178788632821; t2=4.503423182737272; (0.0013981890762588872, 0.5785847209253756) - t0=44.46827397058529; t1=0.016504123873106735; t2=4.505494986993204; (0.001310857178908313, 0.5784155794393526) - t0=44.455563148801275; t1=0.013224165984482283; t2=4.505241030942571; (0.0013577366100977224, 0.5782629984821109) - t0=44.43662231312362; t1=0.02478520699789044; t2=4.509064448636131; (0.0012015924392150326, 0.5779201791225536) - t0=44.40508537139888; t1=0.04837562772586068; t2=4.515090405813822; (9.613815880729862E-4, 0.5773384868436131) - t0=44.34224160187729; t1=0.06951090414375471; t2=4.523060420684118; (8.381115649334689E-4, 0.5763523031518725) - t0=44.124748508786354; t1=0.141539528986101; t2=4.541575156650708; (8.535694173909947E-4, 0.5731007763064535) - We got the best Hyperellipower projections using: t0=2.9805327028160047; t1=1.4620205936408104; t2=1.2260538331901316; (0.02498272791703329, 0.5334608076993929) t0=2.9905920355994238; t1=1.4465014713514734; t2=1.1967256256435732; (0.03043457998723157, 0.5214751201404486) @@ -24,42 +11,3 @@ We got the best Hyperellipower projections using: t0=3.0237399472302613; t1=0.5600288656005254; t2=1.3457090939279759; (0.61978843032033, 0.11003035234367435) t0=3.14353629984587; t1=0.5005076822295891; t2=1.3891880892209763; (0.659949552269144, 0.08727046668993045) -We got the best Tetrapower projections using: - t0=1.9742017849877067; t1=0.3162063133968771; t2=1.7120540423562045; (0.1258252238679622, 0.7005677855491624) - t0=1.962946901115604; t1=0.33643644568151476; t2=1.6376451578369986; (0.11996191382294889, 0.6646835788944014) - t0=1.9482122579017167; t1=0.35820555314261515; t2=1.5596007725493086; (0.12236608915694984, 0.6261805784009753) - t0=1.9235950892509521; t1=0.3844987115570184; t2=1.4616134703187686; (0.13729703578984156, 0.5766312917494608) - t0=0.6078162918738137; t1=1.9184154579992683; t2=0.9374969326053915; (0.41463636119160974, 0.2321352376415144) - t0=0.6768981747546086; t1=1.8569910574056223; t2=0.9687975907818611; (0.39596942962204096, 0.22442292151266904) - t0=0.8181900944465301; t1=1.776744883033544; t2=0.9938680301730116; (0.36146141160554407, 0.222732976480267) - t0=0.8707287786830218; t1=1.6708658507974103; t2=0.9953327713347058; (0.34947850355439064, 0.2144133868329382) - t0=0.8290702635455336; t1=1.5114556757650064; t2=0.9729815284781616; (0.3622144281786425, 0.18867009848372016) - t0=0.7811701429810967; t1=1.2659478546922074; t2=0.9395657968519764; (0.3822474927530909, 0.15551055615753112) - t0=0.776639599429668; t1=1.0310109779059893; t2=0.7730294723435058; (0.4178180981302166, 0.18597107060510343) - -We got the best Tetrafillet projections using: - t0=1.7288505725437506; t1=0.2900860123567215; t2=2.0471999824952634; (0.14694825866595568, 0.5163771543891366) - t0=1.6823776797111454; t1=0.28697384098194645; t2=2.0276944103794334; (0.13811002621138319, 0.5026511615481717) - t0=1.6332138547902728; t1=0.28392500093346573; t2=2.0060174858671074; (0.13073975144149713, 0.4880869584178728) - t0=1.57265871333352; t1=0.2804940342282789; t2=1.9776257697639696; (0.12500803769986443, 0.4700697574887316) - t0=0.8153291409168926; t1=0.44049624114253483; t2=1.8959250549593474; (0.24046500594270506, 0.3416977194269567) - t0=0.8245709478754968; t1=0.46529282362431346; t2=1.8044071372430146; (0.24185954090909334, 0.32318634022044795) - t0=0.8280188390702712; t1=0.49455295305481073; t2=1.694022436723964; (0.24760421972453442, 0.3026571586101631) - t0=0.8163363015495637; t1=0.5314301073295056; t2=1.5595921905114505; (0.2611257175300009, 0.28016520163305947) - t0=0.5009320826127315; t1=1.4734012144606687; t2=1.4197160558087738; (0.32297081636099445, 0.2731240174032427) - t0=0.5186271423635311; t1=1.254469850922547; t2=1.270260869970464; (0.3289844752140432, 0.24460926431841706) - t0=0.5792393092602097; t1=0.9721593452832309; t2=1.162807744683981; (0.33416189872837637, 0.23106563246322284) - -We got the best Tetrachamfer projections using: - t0=1.7853271662440338; t1=0.2831804816469661; t2=2.0280092833265937; (0.16484468546801748, 0.694902216760462) - t0=1.6318105710233075; t1=0.28146710257639906; t2=2.0031455734092605; (0.13962084387127202, 0.6532469343914646) - t0=1.8075069161487942; t1=0.2475287140185909; t2=1.9658015876860677; (0.17093702504913671, 0.6900898048806519) - t0=0.7223330651323909; t1=0.4110649447425505; t2=1.9528460043299454; (0.28230467732058345, 0.48601136854710203) - t0=0.7573115507958637; t1=0.4243808486498466; t2=1.8708944121508928; (0.27508256755764127, 0.47115029033025646) - t0=-1.7106270713623495; t1=-0.008538938591179601; t2=9.338028252128773; (1.0887527217519657, 1.7302599183430785) - t0=0.6639005401748719; t1=0.5014532357333898; t2=1.6275390621683492; (0.3116484423565494, 0.4135437766201649) - t0=0.5462292082742124; t1=1.582020618987002; t2=0.9085007328308023; (0.36334026452533624, 0.3447448125298554) - t0=0.3786532688160591; t1=1.4496054272311163; t2=0.9376127751076488; (0.3999982659592346, 0.31944040411860314) - t0=0.7066517852744312; t1=0.7313487405330719; t2=0.9098285640091461; (0.3696975287491499, 0.2963896674047347) - t0=0.7690859433401585; t1=0.829580616832942; t2=0.9038137953260303; (0.3527548189362114, 0.2983682349953474) - diff --git a/src/apps/MapOptimizer.java b/src/apps/MapOptimizer.java index 8b07e23..c7ccff1 100644 --- a/src/apps/MapOptimizer.java +++ b/src/apps/MapOptimizer.java @@ -52,11 +52,11 @@ import maps.Tobler; */ public class MapOptimizer extends Application { - - private static final Projection[] EXISTING_PROJECTIONS = { Cylindrical.HOBO_DYER, Robinson.ROBINSON, - Cylindrical.PLATE_CARREE, Misc.PEIRCE_QUINCUNCIAL }; - private static final Projection[] PROJECTIONS_TO_OPTIMIZE = { Tobler.TOBLER, MyProjections.HYPERELLIPOWER, - Tetrahedral.TETRAPOWER, Tetrahedral.TETRAFILLET, Tetrahedral.TETRACHAMFER }; + private static final Projection[] EXISTING_PROJECTIONS = { Cylindrical.HOBO_DYER, + Robinson.ROBINSON, Cylindrical.PLATE_CARREE, Misc.PEIRCE_QUINCUNCIAL }; + private static final Projection[] PROJECTIONS_TO_OPTIMIZE = { Tobler.TOBLER, + MyProjections.HYPERELLIPOWER, Tetrahedral.TETRAPOWER, Tetrahedral.TETRAFILLET, + Tetrahedral.TETRACHAMFER }; private static final double[] WEIGHTS = { .083, .20, .33, .50, .71, 1.0, 1.4, 2.0, 3.0, 5.0, 12. }; private static final int NUM_DESCENT = 40; private LineChart chart; @@ -120,7 +120,8 @@ public class MapOptimizer extends Application { final double[] params = new double[proj.getNumParameters()]; for (int i = 0; i < params.length; i++) params[i] = bounds[i][0]; // initialize params - + + bruteForceLoop: while (true) { // start with brute force double[] distortions = proj.avgDistortion(points, params); System.out.println(Arrays.toString(params) + ": " + Arrays.toString(distortions)); @@ -135,7 +136,10 @@ public class MapOptimizer extends Application { } int i; - for (i = 0; i < params.length; i++) { // iterate the parameters + for (i = 0; i <= params.length; i++) { // iterate the parameters + if (i == params.length) + break bruteForceLoop; // if you made it through all the parameters without breaking, you're done! + final double step = (bounds[i][1] - bounds[i][0]) / Math.floor(Math.pow(16, 1. / params.length)); if (params[i] + step < bounds[i][1] + 1e-5) { for (int j = 0; j < i; j++) @@ -144,8 +148,6 @@ public class MapOptimizer extends Application { break; } } - if (i == params.length) - break; // if you made it through the for loop without breaking (finding a parameter to increment), you're done! } final double h = 1e-7;