C# 클래스 SwarmOps.Tools

파일 보기 프로젝트 열기: DanWBR/dwsim3

공개 메소드들

메소드 설명
ArrayToString ( double x ) : string

Convert an array of System.double values to a string.

ArrayToString ( double x, int digits ) : string

Convert an array of System.double values to a string.

ArrayToStringRaw ( double x ) : string

Convert an array of System.double values to a string. Not formatted like a C# array.

ArrayToStringRaw ( double x, int digits ) : string

Convert an array of System.double values to a string. Not formattet like a C# array.

BetterFeasible ( bool oldFeasible, bool newFeasible ) : bool

Return whether feasibility (constraint satisfaction) of new candidate solution is same as or better than feasibility of old candidate solution.

BetterFeasibleFitness ( bool oldFeasible, bool newFeasible, double oldFitness, double newFitness ) : bool

Return whether the new candidate solution is better than the old, depending on their feasibility (constraint satisfaction) and fitness.

BetweenBounds ( double x, double lower, double upper ) : bool

Return whether array of values is between lower and upper boundaries.

Bound ( double x, double lower, double upper ) : double

Bound a value between lower and upper boundaries.

Bound ( double &x, double lower, double upper ) : void

Bound array of values between lower and upper boundaries.

Denormalize ( double x ) : double

Return denormalized version of x. This is useful for avoiding expensive CPU usage when x underflows.

Denormalize ( double &x ) : void

Denormalize an array.

DenormalizeTruncate ( double x ) : double

If Abs(x) is below a limit then it is set to zero.

FormatNumber ( double d ) : string

Convert numeric value d to a string with convenient formatting.

FormatPercent ( double d ) : string

Convert numeric value d to a percentage string, e.g. d==0.253212 returns string "25.32%"

Initialize ( double &x, double value ) : void

Initialize array with value.

InitializeRange ( double &x, double lower, double upper ) : void

Initialize array with the range between the boundaries. That is, x[i] = upper[i]-lower[i].

InitializeUniform ( double &x, double lower, double upper ) : void

Initialize array with uniform random values between given boundaries.

NewMatrix ( int dim1, int dim2 ) : double[][]

Allocate and return a new matrix double[dim1][dim2].

Norm ( double x ) : double

Euclidian norm (or length) of a numeric vector.

NumberToString ( double x, int digits ) : string

Convert a double-value to a string, formatted for array output.

PrintNewline ( ) : void

Print a newline to Console.

PrintParameters ( Problem problem, double parameters ) : void

Print parameters using names associated with an optimization problem.

PrintSolution ( double parameters, double fitness, double fitnessLimit, bool oldFeasible, bool newFeasible, bool formatAsArray ) : void

Print parameters, fitness and feasibility to Console, and print a marking if fitness was an improvement to fitnessLimit.

Sample ( double x, double range ) : double

Pick a uniform random sample from [x-range, x+range].

SampleBounded ( double x, double range, double lowerBound, double upperBound ) : double

First bound the sampling range [x-range, x+range] using lowerBound and upperBound respectively, and then pick a uniform random sample from the bounded range. This avoids samples being boundary points.

메소드 상세

ArrayToString() 공개 정적인 메소드

Convert an array of System.double values to a string.
public static ArrayToString ( double x ) : string
x double Array of values to be converted to string.
리턴 string

ArrayToString() 공개 정적인 메소드

Convert an array of System.double values to a string.
public static ArrayToString ( double x, int digits ) : string
x double Array of values to be converted to string.
digits int Number of digits for each value.
리턴 string

ArrayToStringRaw() 공개 정적인 메소드

Convert an array of System.double values to a string. Not formatted like a C# array.
public static ArrayToStringRaw ( double x ) : string
x double Array of values to be converted to string.
리턴 string

ArrayToStringRaw() 공개 정적인 메소드

Convert an array of System.double values to a string. Not formattet like a C# array.
public static ArrayToStringRaw ( double x, int digits ) : string
x double Array of values to be converted to string.
digits int Number of digits for each value.
리턴 string

BetterFeasible() 공개 정적인 메소드

Return whether feasibility (constraint satisfaction) of new candidate solution is same as or better than feasibility of old candidate solution.
public static BetterFeasible ( bool oldFeasible, bool newFeasible ) : bool
oldFeasible bool Feasibility of old candidate solution.
newFeasible bool Feasibility of new candidate solution.
리턴 bool

BetterFeasibleFitness() 공개 정적인 메소드

Return whether the new candidate solution is better than the old, depending on their feasibility (constraint satisfaction) and fitness.
public static BetterFeasibleFitness ( bool oldFeasible, bool newFeasible, double oldFitness, double newFitness ) : bool
oldFeasible bool Feasibility of old candidate solution.
newFeasible bool Feasibility of new candidate solution.
oldFitness double Fitness of old candidate solution.
newFitness double Fitness of new candidate solution.
리턴 bool

BetweenBounds() 공개 정적인 메소드

Return whether array of values is between lower and upper boundaries.
public static BetweenBounds ( double x, double lower, double upper ) : bool
x double Array of values to be bounded.
lower double Lower boundaries.
upper double Upper boundaries.
리턴 bool

Bound() 공개 정적인 메소드

Bound a value between lower and upper boundaries.
public static Bound ( double x, double lower, double upper ) : double
x double Parameter to be bounded.
lower double Lower boundary.
upper double Upper boundary.
리턴 double

Bound() 공개 정적인 메소드

Bound array of values between lower and upper boundaries.
public static Bound ( double &x, double lower, double upper ) : void
x double Array of values to be bounded.
lower double Lower boundaries.
upper double Upper boundaries.
리턴 void

Denormalize() 공개 정적인 메소드

Return denormalized version of x. This is useful for avoiding expensive CPU usage when x underflows.
public static Denormalize ( double x ) : double
x double
리턴 double

Denormalize() 공개 정적인 메소드

Denormalize an array.
public static Denormalize ( double &x ) : void
x double
리턴 void

DenormalizeTruncate() 공개 정적인 메소드

If Abs(x) is below a limit then it is set to zero.
public static DenormalizeTruncate ( double x ) : double
x double
리턴 double

FormatNumber() 공개 정적인 메소드

Convert numeric value d to a string with convenient formatting.
public static FormatNumber ( double d ) : string
d double
리턴 string

FormatPercent() 공개 정적인 메소드

Convert numeric value d to a percentage string, e.g. d==0.253212 returns string "25.32%"
public static FormatPercent ( double d ) : string
d double
리턴 string

Initialize() 공개 정적인 메소드

Initialize array with value.
public static Initialize ( double &x, double value ) : void
x double Array to be initialized.
value double Value.
리턴 void

InitializeRange() 공개 정적인 메소드

Initialize array with the range between the boundaries. That is, x[i] = upper[i]-lower[i].
public static InitializeRange ( double &x, double lower, double upper ) : void
x double Array to be initialized.
lower double Lower boundary.
upper double Upper boundary.
리턴 void

InitializeUniform() 공개 정적인 메소드

Initialize array with uniform random values between given boundaries.
public static InitializeUniform ( double &x, double lower, double upper ) : void
x double Array to be initialized.
lower double Lower boundary.
upper double Upper boundary.
리턴 void

NewMatrix() 공개 정적인 메소드

Allocate and return a new matrix double[dim1][dim2].
public static NewMatrix ( int dim1, int dim2 ) : double[][]
dim1 int
dim2 int
리턴 double[][]

Norm() 공개 정적인 메소드

Euclidian norm (or length) of a numeric vector.
public static Norm ( double x ) : double
x double
리턴 double

NumberToString() 공개 정적인 메소드

Convert a double-value to a string, formatted for array output.
public static NumberToString ( double x, int digits ) : string
x double Value to convert.
digits int Number of digits.
리턴 string

PrintNewline() 공개 정적인 메소드

Print a newline to Console.
public static PrintNewline ( ) : void
리턴 void

PrintParameters() 공개 정적인 메소드

Print parameters using names associated with an optimization problem.
public static PrintParameters ( Problem problem, double parameters ) : void
problem Problem Optimization problem with associated parameter-names.
parameters double Parameters to be printed.
리턴 void

PrintSolution() 공개 정적인 메소드

Print parameters, fitness and feasibility to Console, and print a marking if fitness was an improvement to fitnessLimit.
public static PrintSolution ( double parameters, double fitness, double fitnessLimit, bool oldFeasible, bool newFeasible, bool formatAsArray ) : void
parameters double
fitness double
fitnessLimit double
oldFeasible bool
newFeasible bool
formatAsArray bool
리턴 void

Sample() 공개 정적인 메소드

Pick a uniform random sample from [x-range, x+range].
public static Sample ( double x, double range ) : double
x double
range double
리턴 double

SampleBounded() 공개 정적인 메소드

First bound the sampling range [x-range, x+range] using lowerBound and upperBound respectively, and then pick a uniform random sample from the bounded range. This avoids samples being boundary points.
public static SampleBounded ( double x, double range, double lowerBound, double upperBound ) : double
x double
range double
lowerBound double
upperBound double
리턴 double