本文整理汇总了C#中Metric.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Metric.Equals方法的具体用法?C# Metric.Equals怎么用?C# Metric.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Metric
的用法示例。
在下文中一共展示了Metric.Equals方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Run
//.........这里部分代码省略.........
step.Stop( );
total.Stop( );
long CurrentUsage = Process.GetCurrentProcess( ).PrivateMemorySize64;
if ( CurrentUsage > MaxMemoryUsage ) {
MaxMemoryUsage = CurrentUsage;
}
path = nextPath;
if ( path != null ) {
foreach ( var Action in path.Actions ) {
var oldState = StaticState.InitialDynamicState;
if ( !Action.IsValidOn( StaticState.InitialDynamicState, StaticState, true ) ) {
throw new IllegalActionOnStateException(
"Illegal Action Given By Algorithm" );
}
StaticState.InitialDynamicState = Action.PerformOn(
StaticState.InitialDynamicState, StaticState ).First( );
fullPath.Push( Action, oldState, StaticState.InitialDynamicState );
if ( !Batch ) {
var U = StaticState.InitialDynamicState.FindUnit( 0 );
StaticState.Tiles[U.Y][U.X].Hits++;
#if OpenGl
vis.Visualize( StaticState, StaticState.InitialDynamicState );
vis.SetStepData( (int)Algorithm.Generations, (int)Algorithm.Expansions,
total.ElapsedTicks, fullPath.Cost.ToDouble( ) + numStops,
ComputationTimes.Count != 0 ? ComputationTimes.Average( ): 0,
MaxMemoryUsage, ComputationTimeMax,
Expansions.Count != 0 ? Expansions.Average( ): 0 );
#else
System.Console.WriteLine( StaticState.InitialDynamicState ) ;
#endif
}
HandleChanges( Dynamic, StepNumber );
}
} else {
numStops++;
HandleChanges( Dynamic, StepNumber );
#if OpenGl
if ( !Batch ) {
vis.Visualize( StaticState, StaticState.InitialDynamicState );
( vis as OpenGLStateVisualizer ).redraw( );
vis.SetStepData( (int)Algorithm.Generations, (int)Algorithm.Expansions,
total.ElapsedTicks, fullPath.Cost.ToDouble( )+ numStops,
ComputationTimes.Count != 0 ? ComputationTimes.Average( ): 0,
MaxMemoryUsage, ComputationTimeMax,
Expansions.Count != 0 ? Expansions.Average( ): 0 );
}
#endif
}
Expansions.Add( Algorithm.Expansions - LastExpansions );
LastExpansions = Algorithm.Expansions;
ComputationTimes.Add( step.ElapsedTicks );
if ( step.ElapsedTicks > ComputationTimeMax ) {
ComputationTimeMax = step.ElapsedTicks;
}
if ( Goal.IsSatisfiedBy( StaticState, StaticState.InitialDynamicState ) ) {
break;
}
long t = refreshRate - step.ElapsedMilliseconds;
if ( t > 0 ) {
Thread.Sleep( (int)t );
}
Metric maxPathLength = new Metric( computationLimitCeilingRatio *
( StaticState.Map != null && StaticState.Map.OptimalSolutionCostSpecified ?
StaticState.Map.OptimalSolutionCost :
OptimalPathLength.ToDouble( ) ) );
if ( maxPathLength.Equals( Metric.Infinity ) && fullPath.Cost + new Metric( numStops ) >= maxPathLength ) {
throw new MaxPathLengthExceded(
new Results( Alg, ComputationLimit, Algorithm.Generations,
Algorithm.Expansions, total.ElapsedTicks, fullPath.Cost.ToDouble( )+ numStops,
StaticState.Map != null && StaticState.Map.OptimalSolutionCostSpecified ?
StaticState.Map.OptimalSolutionCost :
OptimalPathLength.ToDouble( ), File, ComputationTimes.Average( ),
MaxMemoryUsage, ComputationTimeMax, Expansions.Average( ) ) );
}
StepNumber++;
step.Reset( );
step.Start( );
total.Start( );
}
total.Stop( );
if ( !Batch ) {
#if OpenGl
if ( vis != null ) {
vis.Cleanup( );
}
#else
new GenericGridWorldPathVisualizer( ).Visualize(
Console.Out, fullPath, StaticState, StaticState.InitialDynamicState );
#endif
}
double AverageComputationTime = ComputationTimes.Average( );
return new Results( Alg, ComputationLimit, Algorithm.Generations,
Algorithm.Expansions, total.ElapsedTicks, fullPath.Cost.ToDouble( )+ numStops,
StaticState.Map != null && StaticState.Map.OptimalSolutionCostSpecified ?
StaticState.Map.OptimalSolutionCost :
OptimalPathLength.ToDouble( ), File, AverageComputationTime,
MaxMemoryUsage, ComputationTimeMax, Expansions.Average( ) );
}