[Swift-commit] r5612 - SwiftApps/SciColSim

wilde at ci.uchicago.edu wilde at ci.uchicago.edu
Tue Feb 14 10:56:15 CST 2012


Author: wilde
Date: 2012-02-14 10:56:15 -0600 (Tue, 14 Feb 2012)
New Revision: 5612

Modified:
   SwiftApps/SciColSim/annealing.swift
Log:
Re-enabled rejection[][] update logic that was commented out earlier to debug a deadlock. Use a trejection[][] value to update rejection every 'cycle' iterations.

Modified: SwiftApps/SciColSim/annealing.swift
===================================================================
--- SwiftApps/SciColSim/annealing.swift	2012-02-14 16:53:11 UTC (rev 5611)
+++ SwiftApps/SciColSim/annealing.swift	2012-02-14 16:56:15 UTC (rev 5612)
@@ -69,6 +69,7 @@
     int NEVOPARAMS = 5;      // const - 5 params, alpha 1,m through delta, does not include target_innovation
 
     float rejection[][];  // [i][j] where i is cycle and j is evolve-parameter (alpha_i, alpha_m, beta, gamma, delta)
+    float trejection[][];
 
     float x[][], dx[][], curr_loss[], curr_sdev[];
 
@@ -108,11 +109,13 @@
                 {
                     dx[i][k] = dx[i-1][k] / ( newrejection / Target_rejection );
                     // FIXME: re-enable: rejection[i][k]=0.0;
+                    trejection[i][k]=0.0;
                 }
                 else
                 {
                     dx[i][k] = dx[i-1][k] * 2.0;
                     // FIXME: re-enable: rejection[i][k]=rejection[i-1][k];
+                    trejection[i][k]=rejection[i-1][k];
                 }
                 // FIXME: HANGS? : tracef(color(Red,"Recomputed rejection: i=%d k=%d dx[i][k]=%f\n"), i, k, dx[i][k]);
             }
@@ -181,7 +184,14 @@
                 if (r > ratio) // Reject new parameter
                 {
                     x[i][j]         = x[i-1][j];
-                    rejection[i][j] = rejection[i-1][j] + 1.0;  // FIXME: AR: Is this correct? incr rejection?
+                    if ( i %% cycle == 1 && i > 1 )
+                    {
+                      rejection[i][j] = trejection[i][j] + 1.0;    // FIXME: triple-check this!
+                    }
+                    else
+                    {
+                      rejection[i][j] = rejection[i-1][j] + 1.0;  // FIXME: AR: Is this correct? incr rejection?
+                    }
                     curr_loss[curr] = curr_loss[prev];
                     curr_sdev[curr] = curr_sdev[prev];
                     // FIXME: AR: the following prints seem to replicate values in the .cpp version - please clarify.
@@ -193,7 +203,14 @@
                     tracef( "multi_annealing: Accepting try_x[j], i=%i j=%i\n",i,j );
 
                     x[i][j]         = try_x[j];
-                    rejection[i][j] = rejection[i-1][j];  // FIXME: AR: Is this correct? no incr of rejection?
+                    if ( i %% cycle == 1 && i > 1 )
+                    {
+                      rejection[i][j] = trejection[i][j];    // FIXME: triple-check this!
+                    }
+                    else
+                    {
+                      rejection[i][j] = rejection[i-1][j];  // FIXME: AR: Is this correct? no incr of rejection?
+                    }
                     curr_loss[curr] = mlres[i][j].loss;
                     curr_sdev[curr] = mlres[i][j].sdev;
 




More information about the Swift-commit mailing list