[Swift-commit] r5542 - SwiftApps/SciColSim
jonmon at ci.uchicago.edu
jonmon at ci.uchicago.edu
Wed Feb 1 15:05:30 CST 2012
Author: jonmon
Date: 2012-02-01 15:05:29 -0600 (Wed, 01 Feb 2012)
New Revision: 5542
Modified:
SwiftApps/SciColSim/annealing.swift
Log:
parameterized the variables to annealing.swift. Will document in the README
Modified: SwiftApps/SciColSim/annealing.swift
===================================================================
--- SwiftApps/SciColSim/annealing.swift 2012-02-01 18:38:20 UTC (rev 5541)
+++ SwiftApps/SciColSim/annealing.swift 2012-02-01 21:05:29 UTC (rev 5542)
@@ -82,7 +82,7 @@
curr_sdev[j] = mlres[0][0].sdev;
}
- iterate iter_i
+ iterate iter_i // number of annealing cycles
{ // foreach i in [1:annealing_cycles]
int i = iter_i + 1;
@@ -174,8 +174,8 @@
tracef("multi_annealing: AR: %f vs %f\n", r, ratio);
- if (r > ratio)
- { // Reject new parameter
+ 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?
curr_loss[curr] = curr_loss[prev];
@@ -184,8 +184,8 @@
tracef( "multi_annealing: AR: %i,%i %i Did not accept: %f (%i)\n", i, j, i, try_x[j], j );
tracef( "multi_annealing: AR: %f %f %f %f %f\n", try_x[0],try_x[1],try_x[2],try_x[3],try_x[4] );
}
- else
- { // Accept new parameter
+ else // Accept new parameter
+ {
tracef( "multi_annealing: Accepting try_x[j], i=%i j=%i\n",i,j );
x[i][j] = try_x[j];
@@ -222,8 +222,8 @@
curr_sdev[curr] = curr_sdev[prev];
// dx[i][j] not set for fixed vars
}
- } until(j == NEVOPARAMS-1);
- } until(iter_i == (annealing_cycles-1));
+ } until( j == (NEVOPARAMS-1) );
+ } until( iter_i == (annealing_cycles-1) );
}
(Res r) multi_loss( int ci, int cj, float x[], float target_innov, int evolve_reruns )
@@ -232,7 +232,7 @@
file rfile[];
file ofile[]; // FIXME: to obtain timings and otehr stats
- tracef("multi_loss: entered: ci=%i cj=%i target_innov=%f evolve_reruns=%i x=%q\n",ci, cj, target_innov,evolve_reruns,x);
+ tracef( "multi_loss: entered: ci=%i cj=%i target_innov=%f evolve_reruns=%i x=%q\n",ci, cj, target_innov,evolve_reruns,x );
int appCalls = @toint(@tofloat(evolve_reruns) / @tofloat(rerunsPerApp)); // FIXME: handle fractional issues and rounding etc. For now must divide evenly
@@ -298,19 +298,19 @@
file lossfile; // <single_file_mapper; file=@strcat("output/T",target_innov,".R",rep,".loss_data")>;
( outfile,lossfile ) = multi_annealing(
- 2.0,
- 0.01,
- 0.3,
- 100,
- 2.3,
- [0.0, 0.0, 4.0, 50.0, -1.0],
+ @tofloat(@arg("tstart", "2.0")),
+ @tofloat(@arg("tend", "0.01")),
+ @tofloat(@arg("trejection", "0.3")),
+ @toint(@arg("erruns", "100")),
+ @tofloat(@arg("startingjump", "2.3")),
+ [@tofloat(@arg("alphai", "0.0")), @tofloat(@arg("alpham", "0.0")), @tofloat(@arg("beta", "4.0")), @tofloat(@arg("gamma", "50.0")), @tofloat(@arg("delta", "-1.0"))],
@tofloat(target_innov),
- 30 );
+ @toint(@arg("annealingcycles", "50")) );
}
}
}
-rerunsPerApp = 100;
+rerunsPerApp = @toint(@arg("rerunsperapp", "100"));
main()
{
More information about the Swift-commit
mailing list