static Quick() { s_RandomFactory = new MwcFactory(); s_Generators = new GeneratorContainer(); Register(typeof(Quick).Assembly); }
/// <summary> /// Initializes a new instance of the <see cref="SimulationEngine"/> class. /// </summary> /// <param name="stationCount">The station count.</param> /// <param name="highwayLength">Length of the highway.</param> /// <param name="replications">The replications.</param> /// <param name="channels">The channels.</param> /// <param name="reserved">The reserved.</param> /// <param name="report">The report.</param> /// <param name="randomFactory">The random factory.</param> /// <param name="replicationFactory">The replication factory.</param> /// <param name="threadCount">The thread count. Create this many parallel threads to run concurrent replications in.</param> public SimulationEngine( uint stationCount, uint highwayLength, uint replications, uint channels, uint reserved, Action <object> report, IRandomFactory randomFactory, IReplicationFactory replicationFactory, uint threadCount ) { if (threadCount == 0) { throw new ArgumentException(Messages.CantRunWithNoWorkerThreads, "threadCount"); } _randomFactory = randomFactory; _replicationFactory = replicationFactory; _threadCount = threadCount; _stationCount = stationCount; _highwayLength = highwayLength; _replications = replications; _channels = channels; _reserved = reserved; _report = report; _bagOfTasks = new Dictionary <uint, Action <uint> >((int)replications); _totalCollectedData = new DataGatherer(0); }
public ForwarderMiddleware(RequestDelegate next, ILogger <ForwarderMiddleware> logger, IHttpForwarder forwarder, IRandomFactory randomFactory) { _next = next ?? throw new ArgumentNullException(nameof(next)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _forwarder = forwarder ?? throw new ArgumentNullException(nameof(forwarder)); _randomFactory = randomFactory ?? throw new ArgumentNullException(nameof(randomFactory)); }
public Illumination(Construction primitives, IRandomFactory randomFactory, TriangleSampler triangleSampler) { this.lights = new List <Triangle>(); this.primitives = primitives; this.randomFactory = randomFactory; this.triangleSampler = triangleSampler; }
public override InnerMap GoGenerate <M>(IInnerMapFactory <M> mapFactory, IRandomFactory randomFactory, Action <int, int, long, long> pixelChangedCallback) { var innerMap = mapFactory.Create(); var random = randomFactory.Create(); return(GoGenerateInternal(innerMap, random, pixelChangedCallback)); }
/// <summary> /// An empty constructor for serialization. /// </summary> public NEATPopulation() { SurvivalRate = DefaultSurvivalRate; WeightRange = 5; InitialConnectionDensity = 0.1; RandomNumberFactory = EncogFramework.Instance .RandomFactory.FactorFactory(); }
public RequestHeaderForwardedTransform(IRandomFactory randomFactory, NodeFormat forFormat, NodeFormat byFormat, bool host, bool proto, bool append) { _randomFactory = randomFactory; ForFormat = forFormat; ByFormat = byFormat; HostEnabled = host; ProtoEnabled = proto; Append = append; }
public RequestHeaderForwardedTransform(IRandomFactory randomFactory, NodeFormat forFormat, NodeFormat byFormat, bool host, bool proto, bool append) { _randomFactory = randomFactory ?? throw new ArgumentNullException(nameof(randomFactory)); ForFormat = forFormat; ByFormat = byFormat; HostEnabled = host; ProtoEnabled = proto; Append = append; }
public RequestHeaderForwardedTransform(IRandomFactory randomFactory, NodeFormat forFormat, NodeFormat byFormat, bool host, bool proto, ForwardedTransformActions action) { _randomFactory = randomFactory ?? throw new ArgumentNullException(nameof(randomFactory)); ForFormat = forFormat; ByFormat = byFormat; HostEnabled = host; ProtoEnabled = proto; Debug.Assert(action != ForwardedTransformActions.Off); TransformAction = action; }
public HttpSysDelegatorMiddleware( RequestDelegate next, ILogger <HttpSysDelegatorMiddleware> logger, HttpSysDelegator delegator, IRandomFactory randomFactory) { _next = next ?? throw new ArgumentNullException(nameof(next)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _delegator = delegator ?? throw new ArgumentNullException(nameof(delegator)); _randomFactory = randomFactory ?? throw new ArgumentNullException(nameof(randomFactory)); }
public ProxyInvokerMiddleware( RequestDelegate next, ILogger <ProxyInvokerMiddleware> logger, IHttpProxy httpProxy, IRandomFactory randomFactory) { _next = next ?? throw new ArgumentNullException(nameof(next)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _httpProxy = httpProxy ?? throw new ArgumentNullException(nameof(httpProxy)); _randomFactory = randomFactory ?? throw new ArgumentNullException(nameof(randomFactory)); }
public Tracer(Construction construction, IMaterial ambient, IRandomFactory randomFactory, IHemispherecalSamplerFactory samplerFactory, double maxRadiance) { this.construction = construction; this.ambient = ambient; this.randomFactory = randomFactory; this.sampler = samplerFactory.makeSampler(); this.maxRadiance = maxRadiance; this.DEFAULT_FILTER = (t) => false; }
/// <summary> /// Private constructor. /// </summary> private EncogFramework() { RandomFactory = new BasicRandomFactory(); _properties[EncogVersion] = Version; _properties[EncogFileVersion] = FileVersion; _plugins = new List <EncogPluginBase>(); RegisterPlugin(new SystemLoggingPlugin()); RegisterPlugin(new SystemMethodsPlugin()); RegisterPlugin(new SystemTrainingPlugin()); RegisterPlugin(new SystemActivationPlugin()); }
/// <summary> /// Initializes a new instance of the <see cref="BackendProberFactory"/> class. /// </summary> public BackendProberFactory(IMonotonicTimer timer, ILoggerFactory loggerFactory, IOperationLogger operationLogger, IHealthProbeHttpClientFactory httpClientFactory) { Contracts.CheckValue(timer, nameof(timer)); Contracts.CheckValue(loggerFactory, nameof(loggerFactory)); Contracts.CheckValue(operationLogger, nameof(operationLogger)); Contracts.CheckValue(httpClientFactory, nameof(httpClientFactory)); _timer = timer; _loggerFactory = loggerFactory; _httpClientFactory = httpClientFactory; _randomFactory = new RandomFactory(); _operationLogger = operationLogger; }
/// <summary> /// Initializes a new instance of the <see cref="ClusterProberFactory"/> class. /// </summary> public ClusterProberFactory( IMonotonicTimer timer, ILogger <ClusterProber> logger, IOperationLogger <ClusterProber> operationLogger, IHealthProbeHttpClientFactory httpClientFactory, IRandomFactory randomFactory) { _timer = timer ?? throw new ArgumentNullException(nameof(timer)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _httpClientFactory = httpClientFactory ?? throw new ArgumentNullException(nameof(httpClientFactory)); _randomFactory = randomFactory ?? throw new ArgumentNullException(nameof(randomFactory)); _operationLogger = operationLogger ?? throw new ArgumentNullException(nameof(operationLogger)); }
public static Vector3D sampleWi(Vector3D n, IHemispherecalSampler sampler, IRandomFactory randomFactory) { Vector3D x, y; MathUtil.generateXYFromZ(n, out x, out y); Vector3D sample = sampler.sample(randomFactory); Vector3D wi = sample.X * x + sample.Y * y + sample.Z * n; wi.Normalize(); return(wi); }
/// <summary> /// Construct a starting HyperNEAT population. does not generate the /// initial random population of genomes. /// </summary> /// <param name="theSubstrate">The substrate ID.</param> /// <param name="populationSize">The population size.</param> public NEATPopulation(Substrate theSubstrate, int populationSize) : base(populationSize, new FactorHyperNEATGenome()) { SurvivalRate = DefaultSurvivalRate; WeightRange = 5; InitialConnectionDensity = 0.1; RandomNumberFactory = EncogFramework.Instance .RandomFactory.FactorFactory(); CurrentSubstrate = theSubstrate; InputCount = 6; OutputCount = 2; HyperNEATGenome.BuildCPPNActivationFunctions(_activationFunctions); }
/// <summary> /// Initializes a new instance of the <see cref="ClusterProber"/> class. /// HealthProber is the unit that checks the health state for all destinations(replica) of a cluster(service) /// HealthProbe would query the health controller of the destination and update the health state for every destination /// periodically base on the time interval user specified in cluster. /// </summary> public ClusterProber(string clusterId, ClusterConfig config, IDestinationManager destinationManager, IMonotonicTimer timer, ILogger <ClusterProber> logger, IOperationLogger <ClusterProber> operationLogger, HttpClient httpClient, IRandomFactory randomFactory) { ClusterId = clusterId ?? throw new ArgumentNullException(nameof(clusterId)); Config = config ?? throw new ArgumentNullException(nameof(config)); _destinationManager = destinationManager ?? throw new ArgumentNullException(nameof(destinationManager)); _timer = timer ?? throw new ArgumentNullException(nameof(timer)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _operationLogger = operationLogger ?? throw new ArgumentNullException(nameof(operationLogger)); _randomFactory = randomFactory ?? throw new ArgumentNullException(nameof(randomFactory)); _clusterProbeHttpClient = httpClient ?? throw new ArgumentNullException(nameof(httpClient)); _healthControllerUrl = new Uri(Config.HealthCheckOptions.Path, UriKind.Relative); _healthCheckInterval = Config.HealthCheckOptions.Interval; }
public Matte(double kd, Vector3D cd, Construction primitives, IIllumination lights, Tracer tracer, IRandomFactory randomFactory, IHemispherecalSamplerFactory hemiSamplerFactory) { this.kd = kd; this.colorDiffuse = cd; this.primitives = primitives; this.lights = lights; this.tracer = tracer; this.randomFactory = randomFactory; this.hemiSamplerFactory = hemiSamplerFactory; this.cacheRho = kd * cd; this.cacheF = Constant.INV_PI * cacheRho; this.lightFilter = (t) => lights.hasLight(t); }
public override InnerMap GoGenerate <M>(IInnerMapFactory <M> mapFactory, IRandomFactory randomFactory, Action <int, int, long, long> pixelChangedCallback) { if (typeof(M) != typeof(UndefinedInnerMap)) { throw new InvalidOperationException("Please provide the map type 'UndefinedInnerMap' to this algorithm, else it will take memory that is not required."); } var innerMap = mapFactory.Create(); Func <int, int, int, int, InnerMap> generateAction = (x, y, widthPart, heightPart) => GenerateMapPart(x, y, innerMap.Width, innerMap.Height, widthPart, heightPart, randomFactory); Action <InnerMap> storeAction = (x) => { }; var totalMap = new CachedInnerMap(innerMap.Width, innerMap.Height, tilesCached, Math.Min(Math.Min(innerMap.Width, innerMap.Height), tileSize), generateAction, storeAction); return(totalMap); }
static Default() { var systemRandomFactory = new SystemRandomFactory(); SystemRandomFactory = systemRandomFactory; SystemRandomWithSeedFactory = systemRandomFactory; var xorShift1024RandomFactory = new XorShift1024RandomFactory(); XorShift1024RandomFactory = xorShift1024RandomFactory; XorShift1024RandomWithSeedFactory = xorShift1024RandomFactory; RandomWithSeedFactory = xorShift1024RandomFactory; RandomFactory = xorShift1024RandomFactory; IdGenerator = new IdGenerator(XorShift1024RandomFactory.Create()); SnappyCompressor = new SnappyCompressor(); SnappyDecompressor = new SnappyDecompressor(); UtcDateTimeProvider = new UtcDateTimeProvider(); }
/// <summary> /// Construct a starting NEAT population. does not generate the initial /// random population of genomes. /// </summary> /// <param name="inputCount">The input neuron count.</param> /// <param name="outputCount">The output neuron count.</param> /// <param name="populationSize">The population size.</param> public NEATPopulation(int inputCount, int outputCount, int populationSize) : base(populationSize, null) { SurvivalRate = DefaultSurvivalRate; WeightRange = 5; InitialConnectionDensity = 0.1; RandomNumberFactory = EncogFramework.Instance .RandomFactory.FactorFactory(); InputCount = inputCount; OutputCount = outputCount; NEATActivationFunction = new ActivationSteepenedSigmoid(); if (populationSize == 0) { throw new NeuralNetworkError( "Population must have more than zero genomes."); } }
public Vector3D sample(IRandomFactory randomFactory) { double rand1, rand2; var randomer = randomFactory.makeRandom(); rand1 = randomer.NextDouble(); rand2 = randomer.NextDouble(); double cosPhi = Math.Cos(2.0 * Math.PI * rand1); double sinPhi = Math.Sin(2.0 * Math.PI * rand1); double cosTheta2 = 1.0 - rand2; double cosTheta = Math.Sqrt(cosTheta2); double sinTheta = Math.Sqrt(1.0 - cosTheta2); var u = sinTheta * cosPhi; var v = sinTheta * sinPhi; var w = cosTheta; return(new Vector3D(u, v, w)); }
/// <summary> /// Initializes a new instance of the <see cref="BackendProber"/> class. /// HealthProber is the unit that checks the health state for all destinations(replica) of a backend(service) /// HealthProbe would query the health controller of the destination and update the health state for every destination /// periodically base on the time interval user specified in backend. /// </summary> public BackendProber(string backendId, BackendConfig config, IDestinationManager destinationManager, IMonotonicTimer timer, ILogger <BackendProber> logger, IOperationLogger <BackendProber> operationLogger, HttpClient httpClient, IRandomFactory randomFactory) { Contracts.CheckValue(backendId, nameof(backendId)); Contracts.CheckValue(config, nameof(config)); Contracts.CheckValue(destinationManager, nameof(destinationManager)); Contracts.CheckValue(timer, nameof(timer)); Contracts.CheckValue(logger, nameof(logger)); Contracts.CheckValue(operationLogger, nameof(operationLogger)); Contracts.CheckValue(httpClient, nameof(httpClient)); Contracts.CheckValue(randomFactory, nameof(randomFactory)); BackendId = backendId; Config = config; _destinationManager = destinationManager; _timer = timer; _logger = logger; _operationLogger = operationLogger; _randomFactory = randomFactory; _healthControllerUrl = new Uri(Config.HealthCheckOptions.Path, UriKind.Relative); _healthCheckInterval = Config.HealthCheckOptions.Interval; _backendProbeHttpClient = httpClient; }
public ForwardedTransformFactory(IRandomFactory randomFactory) { _randomFactory = randomFactory ?? throw new ArgumentNullException(nameof(randomFactory)); }
/// <summary> /// Construct a starting NEAT population. does not generate the initial /// random population of genomes. /// </summary> /// <param name="inputCount">The input neuron count.</param> /// <param name="outputCount">The output neuron count.</param> /// <param name="populationSize">The population size.</param> public NEATPopulation(int inputCount, int outputCount, int populationSize) : base(populationSize, null) { SurvivalRate = DefaultSurvivalRate; WeightRange = 5; InitialConnectionDensity = 0.1; RandomNumberFactory = EncogFramework.Instance .RandomFactory.FactorFactory(); InputCount = inputCount; OutputCount = outputCount; NEATActivationFunction = new ActivationSteepenedSigmoid(); if (populationSize == 0) { throw new NeuralNetworkError( "Population must have more than zero genomes."); } }
/// <summary> /// Creates a new <see cref="TransformBuilder"/> /// </summary> public TransformBuilder(TemplateBinderFactory binderFactory, IRandomFactory randomFactory, ILogger <TransformBuilder> logger) { _binderFactory = binderFactory ?? throw new ArgumentNullException(nameof(binderFactory)); _randomFactory = randomFactory ?? throw new ArgumentNullException(nameof(randomFactory)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); }
/// <summary> /// Construct a starting HyperNEAT population. does not generate the /// initial random population of genomes. /// </summary> /// <param name="theSubstrate">The substrate ID.</param> /// <param name="populationSize">The population size.</param> public NEATPopulation(Substrate theSubstrate, int populationSize) : base(populationSize, new FactorHyperNEATGenome()) { SurvivalRate = DefaultSurvivalRate; WeightRange = 5; InitialConnectionDensity = 0.1; RandomNumberFactory = EncogFramework.Instance .RandomFactory.FactorFactory(); CurrentSubstrate = theSubstrate; InputCount = 6; OutputCount = 2; HyperNEATGenome.BuildCPPNActivationFunctions(_activationFunctions); }
public TorPasswordHasher(IRandomFactory randomFactory) { _randomFactory = randomFactory; }
public Tracer(Construction construction, IMaterial ambient, IRandomFactory randomFactory, IHemispherecalSamplerFactory samplerFactory) : this(construction, ambient, randomFactory, samplerFactory, 1.0) { }
public PowerOfTwoChoicesLoadBalancingPolicy(IRandomFactory randomFactory) { _randomFactory = randomFactory; }
public abstract InnerMap GoGenerate <M>(IInnerMapFactory <M> mapFactory, IRandomFactory randomFactory, Action <int, int, long, long> pixelChangedCallback) where M : InnerMap;
public RandomLoadBalancingPolicy(IRandomFactory randomFactory) { _randomFactory = randomFactory; }
public MainController(IFamousQuizData data, IRandomFactory factory) : base(data) { this.factory = factory; }
/// <summary> /// Private constructor. /// </summary> private EncogFramework() { RandomFactory = new BasicRandomFactory(); _properties[EncogVersion] = Version; _properties[EncogFileVersion] = FileVersion; _plugins = new List<EncogPluginBase>(); RegisterPlugin(new SystemLoggingPlugin()); RegisterPlugin(new SystemMethodsPlugin()); RegisterPlugin(new SystemTrainingPlugin()); RegisterPlugin(new SystemActivationPlugin()); }
/// <summary> /// An empty constructor for serialization. /// </summary> public NEATPopulation() { SurvivalRate = DefaultSurvivalRate; WeightRange = 5; InitialConnectionDensity = 0.1; RandomNumberFactory = EncogFramework.Instance .RandomFactory.FactorFactory(); }