}
//TODO parse network parameters file
private static Network parseParametersFile(String filename)
{
if (filename == null || filename.compareTo("") == 0) return new Network(Main.NUM_COLS);
File parametersFile = new File(System.getProperty("user.dir")+File.separatorChar+filename);
//TODO Interesting Network variables
Network network = null;
int numCols = 0;
int granulesPerColumn = 1;
double intercolumnConnectivity = 0.20;
boolean dynamicItercolumnConnectivity = false;
Gaussian granuleToMitralWeight = null;
Gaussian granuleActivationThreshold = null;
Gaussian mitralToGranuleWeights = null;
String[] lines = Util.truncateLinesAtChar(FileUtil.readFileLines(parametersFile), '=');
if (lines == null || lines.length != 7)
{
//DEBUG
if (Main.VERBOSE)
{
System.out.println();
System.out.println("-COULD NOT READ PARAMS FILE; DEFAULT NETWORK USED-");
}
//LOG
if (Main.LOG_WRITER != null)
{
Main.attemptNewLineToLog();
Main.attemptWriteToLog("-COULD NOT READ PARAMS FILE; DEFAULT NETWORK USED-");
}
return new Network(Main.NUM_COLS);
}
for (int x = 0; x < lines.length; x++)
{
switch (x)
{
case 0:
{
numCols = Integer.parseInt(lines[x]);
break;
}
case 1:
{
granulesPerColumn = Integer.parseInt(lines[x]);
break;
}
case 2:
{
intercolumnConnectivity = Double.parseDouble(lines[x]);
break;
}
case 3:
{
dynamicItercolumnConnectivity = Boolean.parseBoolean(lines[x]);
break;
}
case 4:
{
if (lines[x].contains( (CharSequence)"(" ))
{
lines[x] = Util.removeChar(lines[x], '(');
lines[x] = Util.removeChar(lines[x], ')');
granuleToMitralWeight = new Gaussian( Double.parseDouble(lines[x]) );
}
else
granuleToMitralWeight = new SingleValueGaussian(Double.parseDouble(lines[x]));
break;
}
case 5:
{
if (lines[x].contains( (CharSequence)"(" ))
{
lines[x] = Util.removeChar(lines[x], '(');
lines[x] = Util.removeChar(lines[x], ')');
granuleActivationThreshold = new Gaussian(Double.parseDouble(lines[x]));
}
else
granuleActivationThreshold = new SingleValueGaussian(Double.parseDouble(lines[x]));
break;
}
case 6:
{
if (lines[x].contains( (CharSequence)"(" ))
{
lines[x] = Util.removeChar(lines[x], '(');
lines[x] = Util.removeChar(lines[x], ')');
mitralToGranuleWeights = new Gaussian(Double.parseDouble(lines[x]));
}
else
mitralToGranuleWeights = new SingleValueGaussian(Double.parseDouble(lines[x]));
break;
}
}
}
network = new Network( numCols,
granulesPerColumn,
intercolumnConnectivity,
dynamicItercolumnConnectivity,
granuleToMitralWeight,
granuleActivationThreshold,