本文整理汇总了C#中Parameters.ReadDirectory方法的典型用法代码示例。如果您正苦于以下问题:C# Parameters.ReadDirectory方法的具体用法?C# Parameters.ReadDirectory怎么用?C# Parameters.ReadDirectory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Parameters
的用法示例。
在下文中一共展示了Parameters.ReadDirectory方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Run
public void Run()
{
// Load parameters
var parameters = new Parameters();
parameters.ReadDirectory(@"Data\Base");
// Get best guess parameter values
var parameterValues = parameters.GetBestGuess();
// Create a new model that inits itself from the parameters just loaded
var model = FundModel.GetModel();
// Run the model
var rs = model.Run(parameterValues);
// Display all variables in interactive window
OutputHelper.ShowModel(rs);
}
示例2: Run
public static void Run()
{
int monteCarloRuns = 10000;
// Load parameters
var parameters = new Parameters();
parameters.ReadDirectory(@"Data\Base");
// Do one best guess run
{
var model = FundModel.GetModel();
//var model = new FundWorkflow(parameters.GetBestGuess());
model.Run(parameters.GetBestGuess());
}
int currentRun = 0;
var stopwatch = new Stopwatch();
stopwatch.Start();
ParallelMonteCarlo.DoParallelRun(
parameters,
monteCarloRuns,
p =>
{
var m = FundModel.GetModel();
m.Run(p);
int tempCurrentCount = Interlocked.Increment(ref currentRun);
Console.Write("\rRun {0} ", tempCurrentCount);
return 0.0;
},
d => 0.0);
stopwatch.Stop();
Console.WriteLine();
Console.WriteLine(stopwatch.Elapsed);
}
示例3: GetSCGasMonteCarlo
private static Tuple<double, double> GetSCGasMonteCarlo(MarginalGas gas, double prtp, bool equityWeights, int monteCarloRuns)
{
var parameters = new Parameters();
parameters.ReadDirectory(@"Data\Base");
var fm = FundModel.GetModel();
fm.Run(parameters.GetBestGuess());
var rand = new jp.takel.PseudoRandom.MersenneTwister();
var sccs = new System.Collections.Concurrent.ConcurrentBag<double>();
Parallel.ForEach(parameters.GetRandom(rand, monteCarloRuns), pv =>
{
var m = new MarginalDamage3()
{
EmissionYear = Timestep.FromYear(2010),
Eta = 1.0,
Gas = gas,
Parameters = pv,
Prtp = prtp,
UseEquityWeights = equityWeights,
YearsToAggregate = 290
};
double scc = m.Start();
sccs.Add(scc);
});
var stats = new DescriptiveStatistics(sccs);
return Tuple.Create(stats.Mean, Math.Sqrt(stats.Variance) / Math.Sqrt(stats.Count));
}
示例4: GetSCGas
private static double GetSCGas(MarginalGas gas, double prtp, bool equityWeights)
{
var parameters = new Parameters();
parameters.ReadDirectory(@"Data\Base");
var m = new MarginalDamage3()
{
EmissionYear = Timestep.FromYear(2010),
Eta = 1.0,
Gas = gas,
Parameters = parameters.GetBestGuess(),
Prtp = prtp,
UseEquityWeights = equityWeights
};
double scc = m.Start();
return scc;
}