[Swift-commit] r5615 - SwiftApps/SciColSim

jonmon at ci.uchicago.edu jonmon at ci.uchicago.edu
Tue Feb 14 16:03:14 CST 2012


Author: jonmon
Date: 2012-02-14 16:03:14 -0600 (Tue, 14 Feb 2012)
New Revision: 5615

Modified:
   SwiftApps/SciColSim/annealing.swift
Log:
more information to the some files, added negative beta tests



Modified: SwiftApps/SciColSim/annealing.swift
===================================================================
--- SwiftApps/SciColSim/annealing.swift	2012-02-14 19:58:13 UTC (rev 5614)
+++ SwiftApps/SciColSim/annealing.swift	2012-02-14 22:03:14 UTC (rev 5615)
@@ -137,8 +137,8 @@
             if ( /* (!FIX_VARIABLES) || */ ( var_fixed[j] == 0 ) ) {  // Adjustable vars
                 // fixed=1,1,0,0,0: FIXME: FIX_VARIABLES flag has faulty logic but OK when TRUE
                 float try_x[];
-                foreach k in [0:NEVOPARAMS-1]
-                { // Select the evolve params to try
+                foreach k in [0:NEVOPARAMS-1] // Select the evolve params to try
+                {
                     if ( k < j )
                     {
                         try_x[k] = x[i][k]; // already set x[i][k]
@@ -149,17 +149,24 @@
                         {
                             try_x[k] = newx(x[i-1][j], dx[i-1][j]); // permute x[i-1][j]
                         }
-                        else
-                        { // k > j
+                        else // k > j
+                        {
                             try_x[k] = x[i-1][k]; // use x[i-1][k] (from prior cycle)
                         }
                     }
                 }
                 tracef( @strcat( "multi_annealing: AR: ", color( 10,"%f" ), " ", color( 9,"%i" ),"\n" ), try_x[j], j );
 
-                // Up to here, x[] and dx[] are only set for previous i
-                mlres[i][j] = multi_loss( T_start, T_end, annealing_cycles, Target_rejection, starting_jump, i, j, try_x, target_innov, evolve_reruns ); // do the N evolve()'s, N=evolve_reruns
-
+                if( try_x[2] < 0.0 )
+                {
+                    mlres[i][j].loss = 100.0;
+                    mlres[i][j].sdev = 1.0;
+                }
+                else
+                {
+                    // Up to here, x[] and dx[] are only set for previous i
+                    mlres[i][j] = multi_loss( T_start, T_end, annealing_cycles, Target_rejection, starting_jump, i, j, try_x, target_innov, evolve_reruns ); // do the N evolve()'s, N=evolve_reruns
+                }
                 tracef( "multi_annealing: AR: %f +- %f\n", mlres[i][j].loss, mlres[i][j].sdev );
                 // Beyond this point, x[] and dx[] are being set for this i,j
 
@@ -167,14 +174,17 @@
 
                 if ( mlres[i][j].loss < ALOT )
                 {
-                    fprintf( some_out_filename, "%i, %f, %f, %f, %f, %f, %f, %f\n",
-                             @toint(target_innov), mlres[i][j].loss, try_x[0], try_x[1], try_x[2], try_x[3], try_x[4], mlres[i][j].sdev );
+                    fprintf( some_out_filename, "N %i %i %f %f | %i, %f, %f, %f, %f, %f, %f, %f\n",
+                             i, j, dx[i][j], rejection[i][j], @toint(target_innov), mlres[i][j].loss, try_x[0], try_x[1], try_x[2], try_x[3], try_x[4], mlres[i][j].sdev );
 
                     fprintf( "max_dist_swift.txt", color( Red,"multi_annealing: AF: max_dist.txt - tbd\n" ) ); // FIXME: max_dist is global set in evolve()
                 }
-                else
-                {  // does this ever occur? if so did we want to still do the ratio computation above???
-                    tracef( "multi_annealing: Loss %f > ALOT at [i][j] = [%d][%d]\n", mlres[i][j].loss, i ,j );
+                else // does this ever occur? if so did we want to still do the ratio computation above???
+                {
+                    fprintf( some_out_filename, "A %i %i %f %f | %i, %f, %f, %f, %f, %f, %f, %f\n",
+                             i, j, dx[i][j], rejection[i][j], @toint(target_innov), mlres[i][j].loss, try_x[0], try_x[1], try_x[2], try_x[3], try_x[4], mlres[i][j].sdev );
+
+                    //tracef( "multi_annealing: Loss %f > ALOT at [i][j] = [%d][%d]\n", mlres[i][j].loss, i ,j );
                 }
 
                 float ratio = min( 1.0, exp( -( mlres[i][j].loss - curr_loss[prev] ) / temperature ) );




More information about the Swift-commit mailing list