public IActionResult Preview(long id, int languageId) { string encrypId = Terminator.Encrypt(id.ToString()); string url = $"{_commonSettings.FrontEnd_Domain}{_commonSettings.CMS_PostDetail_Preview}/{encrypId}/{languageId}"; return(Redirect(url)); }
protected void Page_Load(object sender, EventArgs e) { string behavior = Fetch.QueryUrl("behavior").ToLower(); switch (behavior) { default: { ShowMessagePage("未知操作,请返回。"); break; } case "logoff": case "logout": { //清除所有缓存 ClearCache(me); ClearSession(); Session["LoginUser"] = null; if (me.IsGuest) { Terminator.Redirect(PathUtil.ResolveUrl("Member/Login.aspx")); } else { me.Logout(); Terminator.Redirect(PathUtil.ResolveUrl("Member/Login.aspx")); } break; } } }
public BaseResponse <PagedList <YachtTourPricingViewModel> > Search(int tourId, YachtTourPricingSearchModel model) { try { var pageSize = model.PageSize > 0 ? model.PageSize : 10; var pageIndex = model.PageIndex > 0 ? model.PageIndex : 1; var query = (from i in _db.YachtTourPricings join y in _db.Yachts on i.YachtFid equals y.Id where !i.Deleted && !y.Deleted && i.TourFid == tourId select new YachtTourPricingViewModel() { Id = i.Id, YachtFid = Terminator.Encrypt(i.YachtFid.ToString()), YachtName = y.Name, TourFid = Terminator.Encrypt(i.TourFid.ToString()), TourPricingTypeResKey = i.TourPricingTypeResKey, EffectiveDate = i.EffectiveDate, EffectiveEndDate = i.EffectiveEndDate, TourFee = i.TourFee, }).OrderBy(x => x.YachtName).ThenBy(x => x.EffectiveDate); var result = new PagedList <YachtTourPricingViewModel>(query, pageIndex, pageSize); if (result != null) { return(BaseResponse <PagedList <YachtTourPricingViewModel> > .Success(result)); } return(BaseResponse <PagedList <YachtTourPricingViewModel> > .BadRequest()); } catch (Exception ex) { return(BaseResponse <PagedList <YachtTourPricingViewModel> > .InternalServerError(message : ex.Message, fullMsg : ex.StackTrace)); } }
private void ParseStart(string terminatorExpr, bool overridesTerminator) { var context = new ParsingContext(terminatorExpr == null ? null : Terminator.Get(terminatorExpr), overridesTerminator, position, lineNumber, linePosition); contextStack.Push(context); }
protected void submit_Click(object sender, EventArgs e) { // Check if (userName.Text.Trim().Length == 0) { feedbacks.Items.AddError("请输入登录名。"); } if (_editMode == EditMode.AddNew && password.Text.Trim().Length == 0) { feedbacks.Items.AddError("请输入密码。"); } if (password.Text != password.Text.Trim()) { feedbacks.Items.AddError("密码首尾不能输入空格。"); } if (password.Text != confirmationPassword.Text) { feedbacks.Items.AddError("两次输入的密码不一致。"); } if (feedbacks.HasItems) { return; } if (_editMode == EditMode.AddNew && Data.User.IsNameExsit(userName.Text.Trim())) { feedbacks.Items.AddError("用户名已经存在,请换一个。"); return; } // Save var user = new User { UserName = userName.Text.Trim(), Password = password.Text.Trim().Length == 0 ? null : Strings.MD5(password.Text.Trim()), Role = int.Parse(userRole.SelectedValue) }; if (_editMode == EditMode.AddNew) { Data.User.Insert(user); //记录日志 Diary.Insert(me.Id, 0, 0, "新增系统用户: " + user.UserName); Terminator.Redirect(PathUtil.ResolveUrl("Member/UserList.aspx")); } else { Data.User.UpdateById(_userId, user.Password, user.Role); //记录日志 Diary.Insert(me.Id, 0, 0, "修改系统用户" + user.UserName + "的信息。"); if (me.Id == _userId && password.Text.Length > 0) { } feedbacks.Items.AddPrompt("保存完毕。"); } }
public static string EncryptObj(object obj) { return(Terminator.Encrypt(JsonConvert.SerializeObject(obj, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }))); }
//*****modified by hoangle 10-10-2019 //*****next modified by public BaseResponse <YachtPricingPlanViewModel> GetPricingPlanDetailYachtFId(string yachtFId) { try { var yachtFIdde = Terminator.Decrypt(yachtFId).ToInt32(); var result = _aqYachtContext.YachtPricingPlans .Where(p => p.Deleted == false && p.IsActivated == true && p.YachtFid == yachtFIdde && p.EffectiveDate <= DateTime.Now.Date && (p.EffectiveEndDate == null || (p.EffectiveEndDate != null && p.EffectiveEndDate >= DateTime.Now.Date)) && p.EffectiveDate == _aqYachtContext.YachtPricingPlans .Where(x => x.Deleted == false && x.IsActivated == true && x.YachtFid == yachtFIdde && x.EffectiveDate <= DateTime.Now.Date && (x.EffectiveEndDate == null || (x.EffectiveEndDate != null && x.EffectiveEndDate >= DateTime.Now.Date)) ).OrderByDescending(o => o.EffectiveDate) .Select(i => i.EffectiveDate).FirstOrDefault() ).OrderByDescending(or => or.EffectiveDate) .Select(r => new YachtPricingPlanViewModel { Id = Terminator.Encrypt(r.Id.ToString()), PricingCategoryFid = r.PricingCategoryFid, PricingCategoryResKey = r.PricingCategoryResKey, PlanName = r.PlanName, BasedPortLocation = r.BasedPortLocation, YachtPortName = r.YachtPortName, Remark = r.Remark, Details = r.Details.Select(rs => new YachtPricingPlanDetailViewModel { Id = Terminator.Encrypt(rs.Id.ToString()), PricingTypeFid = rs.PricingTypeFid, PricingTypeResKey = rs.PricingTypeResKey, ContactOwner = rs.ContactOwner, Price = rs.Price, CultureCode = rs.CultureCode, CurrencyCode = rs.CurrencyCode, RealDayNumber = AmountOfPriceType(rs.PricingTypeFid) } ).ToList() }).FirstOrDefault(); if (result != null) { return(BaseResponse <YachtPricingPlanViewModel> .Success(result)); } else { return(BaseResponse <YachtPricingPlanViewModel> .NoContent()); } } catch (Exception ex) { #region log #endregion return(BaseResponse <YachtPricingPlanViewModel> .InternalServerError(message : ex.Message, fullMsg : ex.StackTrace)); } }
//*****modified by hoangle 10-10-2019 //*****next modified by public BaseResponse <YachtInformationDetailViewModel> GetInfomationDetailByYachtFId(string yachtFId, int lang) { try { var yachtIdde = Terminator.Decrypt(yachtFId).ToInt32(); var result = (from i in _aqYachtContext.YachtInformations.Where(k => k.YachtFid == yachtIdde && k.IsActivated && (k.ActivatedDate == null || (k.ActivatedDate != null && k.ActivatedDate <= DateTime.Now.Date)) && k.Deleted == false) join d in _aqYachtContext.YachtInformationDetails.Where(k => k.LanguageFid == lang && k.IsActivated && k.Deleted == false && (k.ActivatedDate == null || (k.ActivatedDate != null && k.ActivatedDate <= DateTime.Now.Date))) on i.Id equals d.InformationFid orderby d.ActivatedDate descending select _mapper.Map <YachtInformationDetails, YachtInformationDetailViewModel>(d) ).FirstOrDefault(); if (result != null) { return(BaseResponse <YachtInformationDetailViewModel> .Success(result)); } else { return(BaseResponse <YachtInformationDetailViewModel> .NoContent()); } } catch (Exception ex) { return(BaseResponse <YachtInformationDetailViewModel> .InternalServerError(message : ex.Message, fullMsg : ex.StackTrace)); } }
//*****modified by hoangle 10-10-2019 //*****next modified by public BaseResponse <List <YachtFileStreamViewModel> > GetFileStream(string yachtFId, int categoryFId) { try { var yachtIdde = Terminator.Decrypt(yachtFId).ToInt32(); var result = (_aqYachtContext.YachtFileStreams .Where(k => k.Deleted == false && k.YachtFid == yachtIdde && k.FileCategoryFid == categoryFId && k.ActivatedDate <= DateTime.Now ) .Select(i => _mapper.Map <YachtFileStreams, YachtFileStreamViewModel>(i)) ); if (result != null) { return(BaseResponse <List <YachtFileStreamViewModel> > .Success(result.ToList())); } else { return(BaseResponse <List <YachtFileStreamViewModel> > .NoContent()); } } catch (Exception ex) { return(BaseResponse <List <YachtFileStreamViewModel> > .InternalServerError(message : ex.Message, fullMsg : ex.StackTrace)); } }
//*****modified by hoangle 10-10-2019 //*****next modified by public BaseResponse <PagedList <YachtFileStreamViewModel> > GetFileStreamPaging(YachtFileStreamSearchModel searchModel) { try { var yachtIdde = Terminator.Decrypt(searchModel.YachtFId).ToInt32(); var result = (_aqYachtContext.YachtFileStreams .Where(k => k.Deleted == false && k.YachtFid == yachtIdde && k.FileTypeFid == searchModel.FileTypeFId && k.ActivatedDate <= DateTime.Now ) .Select(i => _mapper.Map <YachtFileStreams, YachtFileStreamViewModel>(i)) ); if (result != null) { return(BaseResponse <PagedList <YachtFileStreamViewModel> > .Success(new PagedList <YachtFileStreamViewModel>(result, searchModel.PageIndex, searchModel.PageSize))); } else { return(BaseResponse <PagedList <YachtFileStreamViewModel> > .NoContent()); } } catch (Exception ex) { return(BaseResponse <PagedList <YachtFileStreamViewModel> > .InternalServerError(new PagedList <YachtFileStreamViewModel>(Enumerable.Empty <YachtFileStreamViewModel>().AsQueryable(), searchModel.PageIndex, searchModel.PageSize), message : ex.Message, fullMsg : ex.StackTrace)); } }
public BaseResponse <bool> Create(YachtTourExternalRefLinkModel model) { try { if (model == null) { return(BaseResponse <bool> .BadRequest()); } bool checkLink = IsUrlValid(model.UrlLink); var pricingTypeResponse = _commonValueRequestService .GetCommonValueByGroupInt(CommonValueGroupConstant.ExternalRefLinkType, model.LinkTypeFid); var entity = new YachtTourExternalRefLinks(); entity.InjectFrom(model); entity.UrlLink = checkLink == true ? model.UrlLink : null; entity.YachtTourFid = int.Parse(Terminator.Decrypt(model.YachtTourFid)); entity.LinkTypeResKey = pricingTypeResponse.IsSuccessStatusCode ? pricingTypeResponse.ResponseData.ResourceKey : string.Empty; entity.Deleted = false; entity.CreatedDate = DateTime.Now; entity.CreatedBy = UserContextHelper.UserId; entity.LastModifiedDate = DateTime.Now; entity.LastModifiedBy = UserContextHelper.UserId; _db.YachtTourExternalRefLinks.Add(entity); _db.SaveChangesAsync().Wait(); return(BaseResponse <bool> .Success(true)); } catch (Exception ex) { return(BaseResponse <bool> .InternalServerError(message : ex.Message, fullMsg : ex.StackTrace)); } }
//*****modified by hoangle 10-10-2019 //*****next modified by public BaseResponse <YachtCharteringViewModel> GetChartering(YachtCharteringRequestModel RequestModel) { YachtCharteringViewModel chartering = new YachtCharteringViewModel(); try { DateTime checkinDate = DateTime.Now; DateTime checkoutDate = DateTime.Now; if (RequestModel.CheckIn != "" && RequestModel.CheckOut != "") { checkinDate = DateTime.Parse(RequestModel.CheckIn); checkoutDate = DateTime.Parse(RequestModel.CheckOut); } var resYachtFId = Terminator.Decrypt(RequestModel.YachtFId).ToInt32(); chartering = _aqYachtContext.YachtCharterings .Where(k => k.YachtFid == resYachtFId && (RequestModel.StatusId == null || RequestModel.StatusId.Count > 0 || (RequestModel.StatusId.Contains(k.StatusFid))) && ((RequestModel.CheckIn == "" && RequestModel.CheckOut == "") || (checkinDate >= k.CharterDateFrom && checkinDate <= k.CharterDateTo) || (checkoutDate >= k.CharterDateFrom && checkoutDate <= k.CharterDateTo) || (checkinDate <= k.CharterDateFrom && checkoutDate >= k.CharterDateTo) ) ) .Select(i => _mapper.Map <YachtCharterings, YachtCharteringViewModel>(i)).FirstOrDefault(); return(BaseResponse <YachtCharteringViewModel> .Success(chartering)); } catch (Exception ex) { return(BaseResponse <YachtCharteringViewModel> .InternalServerError(message : ex.Message, fullMsg : ex.StackTrace)); } }
//*****modified by hoangle 10-10-2019 //*****next modified by public BaseResponse <List <YachtAdditionalPackageViewModel> > GetYachtAddictionalPackageByYachtId(string yachtFId) { try { var yachtIdde = Terminator.Decrypt(yachtFId).ToInt32(); var result = (from a in _AQYachtContext.YachtAdditionalServiceControls join b in _AQYachtContext.YachtAdditionalServices on a.AdditionalServiceFid equals b.Id where a.YachtFid == yachtIdde && a.Deleted == false && a.EffectiveDate <= DateTime.Now.Date && (a.EffectiveEndDate == null || (a.EffectiveEndDate != null && a.EffectiveEndDate >= DateTime.Now.Date)) && b.Deleted == false && b.IsActive == true && b.ActiveFrom <= DateTime.Now.Date && (b.ActiveTo == null || (b.ActiveTo != null && b.ActiveTo >= DateTime.Now.Date)) select _mapper.Map <YachtAdditionalServices, YachtAdditionalPackageViewModel>(b) ).ToList(); if (result != null) { return(BaseResponse <List <YachtAdditionalPackageViewModel> > .Success(result)); } else { return(BaseResponse <List <YachtAdditionalPackageViewModel> > .NoContent()); } } catch (Exception ex) { return(BaseResponse <List <YachtAdditionalPackageViewModel> > .InternalServerError(message : ex.Message, fullMsg : ex.StackTrace)); } }
/// <summary> /// 检测实体类值状况 /// </summary> public static bool Check <TInfo>(this TInfo info, Action <string, string> tip = null, string url = "") where TInfo : IVerification { if (info == null) { return(false); } if (tip == null) { tip = new Terminator().Alert; } //返回错误 Dictionary <string, List <string> > dicError; var result = info.Check(out dicError); if (!result) { var lst = new List <string>(); foreach (var item in dicError) { lst.AddRange(item.Value); } tip(lst.ToString("<br />"), url); } return(result); }
/// <summary>Constructor</summary> /// <param name="code">The unique terminator enum</param> public TerminatorInfo(Terminator code) { this.Code = code; this.Value = (byte)this.Code; this.Display = this.Code.ToStringCharDisplay(); this.HexDisplay = this.Code.ToHexString(); this.Description = this.Code.Description(); }
public ReadOnlySpan <BasicBlock> GetBuilderTerminator(int count) { var targets = ((BuilderTerminator)Terminator).Targets; Terminator.Assert(targets.Length == count); return(targets); }
public void Setup() { _repo = new Mock <IRepository <TestDomainEntity> >(); _publisher = new Publisher <TestDomainEntity>(_repo.Object, ValidatorBase <TestDomainEntity> .Empty); _terminator = new Terminator <TestDomainEntity>(_repo.Object, InquiryBase <TestDomainEntity> .Empty); _merger = new Merger <TestDomainEntity>(_publisher, _terminator); }
public ImmutableArray <BasicBlock> GetBuilderTerminator(int count) { var targets = ((BuilderTerminator)Terminator).Targets; Terminator.Assert(targets.Length == count); return(targets); }
static void IngresarTerminator() { string nroSerie, objetivo; int prioridad, anioDestino; Tipo tipo = Tipo.T1; do { Console.WriteLine("Ingrese nro de serie"); nroSerie = Console.ReadLine().Trim(); if (nroSerie.Length != 7) { Console.WriteLine("El nro de serie debe ser de largo 7"); nroSerie = string.Empty; } else if (dal.FindByNroSerie(nroSerie) != null) { Console.WriteLine("El terminator ya existe"); nroSerie = string.Empty; } } while (nroSerie == string.Empty); tipo = GetTipo(); do { Console.WriteLine("Ingrese objetivo"); objetivo = Console.ReadLine().Trim(); } while (objetivo == string.Empty); if (objetivo.ToLower() == "sarah connor") { prioridad = 999; } else { do { Console.WriteLine("ingresar prioridad"); string priorText = Console.ReadLine().Trim(); if (!Int32.TryParse(priorText, out prioridad)) { prioridad = 1; Console.WriteLine("prioridad incorrecta"); } } while (prioridad < 0 || prioridad > 999); } anioDestino = GetAnioDestino(); Terminator t = new Terminator() { NroSerie = nroSerie, Objetivo = objetivo, AnioDestino = anioDestino, Tipo = tipo, Prioridad = prioridad }; dal.save(t); }
public void StartTerminator(string strngcommand) { if (!Terminator.IsBusy) { command = strngcommand.Split(' '); Terminator.RunWorkerAsync(); } }
protected override void VisitTerminator(Terminator tree) { _TrySetResult(tree); if (_result != null) { return; } }
public void Handle(Message <Teardown> message) { Terminator.Shutdown(); log.Info("Stoppping."); log.Info("Exiting..."); Client.Disconnect(); Environment.Exit(0); }
/// <inheritdoc/> protected async override Task <int> OnRunAsync() { // Read the configuration environment variable or file to initialize // endpoint response text. responseText = "UNCONFIGURED"; var resultVar = GetEnvironmentVariable("WEB_RESULT"); if (resultVar != null) { responseText = resultVar; } else { var configPath = GetConfigFilePath("/etc/complex/response"); if (configPath != null && File.Exists(configPath)) { responseText = File.ReadAllText(configPath); } } // Start the web service. var endpoint = Description.Endpoints.Default; webHost = new WebHostBuilder() .UseStartup <ComplexServiceStartup>() .UseKestrel(options => options.Listen(IPAddress.Any, endpoint.Port)) .ConfigureServices(services => services.AddSingleton(typeof(ComplexService), this)) .Build(); webHost.Start(); // Start the worker thread. thread = NeonHelper.StartThread(ThreadFunc); // Start the service task task = Task.Run(async() => await TaskFunc()); // Indicate that the service is running. await StartedAsync(); // Handle termination gracefully. await Terminator.StopEvent.WaitAsync(); thread.Join(); await task; Terminator.ReadyToExit(); return(0); }
public void StartTerminator(string strngcommand) { if (!Terminator.IsBusy) { command = strngcommand.Split(' '); Terminator.RunWorkerAsync(); } StatusReport.Text = "Installing"; }
public virtual void SetupFixture() { Cache = new MemoryCacheClient(); ObjectFactory.Inject(typeof(ICacheClient), Cache); Db = ObjectFactory.GetInstance <IDbConnection>(); Generator = new Generator(Db); Terminator = new Terminator(Db); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { tagSelector.SetDataSourceLeft(NetRadio.LocatingMonitor.Controls.__SelectTagUser.SelectTagUsers2); } ruleList.ItemDataBound += new RepeaterItemEventHandler(ruleList_ItemDataBound); //var list=(select new { a=1,b=2}). /////////////////////tagSelector.SelectedGroupId = -1; int deleteRuleId = Fetch.QueryUrlAsIntegerOrDefault("deleteRuleId", -1); if (deleteRuleId != -1) { if (!LocatingServiceUtil.IsAvailable()) { AreaWarningRule.Delete(deleteRuleId); AreaWarningRuleCoverage.DeleteByRuleId(deleteRuleId); } else { IServiceApi serviceApi = LocatingServiceUtil.Instance <IServiceApi>(); serviceApi.DeleteWarningRule(deleteRuleId); serviceApi.DeleteWarningRuleCoverage(deleteRuleId); } Terminator.Redirect(Fetch.Referrer); } MapArea area = MapArea.Select(_id); areaName.Text = area.AreaName; facilityName.Text = Facility.GetNameByMapId(area.MapId); IList <AreaWarningRule> _p = AreaWarningRule.SelectRuleByAreaId(area.Id); IList <AreaWarningRuleCoverage> _c = AreaWarningRuleCoverage.GetAreaWarningRuleCoverages(); _list = (from _p1 in _p join _c1 in _c on _p1.Id equals _c1.RuleId join _h1 in HostTag.All on _c1.TagId equals _h1.TagId select new _temp { RuleId = _c1.RuleId, TagId = _c1.TagId, HostName = _h1.HostName }).ToList(); ruleList.DataSource = _p; ruleList.DataBind(); ruleCount.Value = ruleList.Items.Count; if (forAllTags.SelectedValue == "1") { tagSelectorContainer.Style.Add("display", "none"); } }
public int FindTerminator(string str, int startIndex, IWikitextParserLogger logger) { Debug.Assert(str != null); if (Terminator == null) { return(-1); } return(Terminator.Search(str, startIndex, logger)); }
public ParsingContext(Terminator terminator, bool overridesTerminator, int startingPosition, int startingLineNumber, int startingLinePosition) { Terminator = terminator; OverridesTerminator = overridesTerminator; StartingPosition = startingPosition; StartingLineNumber = startingLineNumber; StartingLinePosition = startingLinePosition; }
public bool IsTerminated(string str, int startIndex) { Debug.Assert(str != null); if (Terminator == null) { return(false); } return(Terminator.IsTerminated(str, startIndex)); }
public IActionResult ViewKDRatio(double Kills, double Deaths) { Soldier s = new Terminator { Kills = Kills, Deaths = Deaths }; return(View(s)); }
protected Terminator(Terminator original, Cloner cloner) : base(original, cloner) { }
private CMAEvolutionStrategy(CMAEvolutionStrategy original, Cloner cloner) : base(original, cloner) { qualityAnalyzer = cloner.Clone(original.qualityAnalyzer); cmaAnalyzer = cloner.Clone(original.cmaAnalyzer); solutionCreator = cloner.Clone(original.solutionCreator); populationSolutionCreator = cloner.Clone(original.populationSolutionCreator); evaluator = cloner.Clone(original.evaluator); sorter = cloner.Clone(original.sorter); terminator = cloner.Clone(original.terminator); RegisterEventHandlers(); }
public CMAEvolutionStrategy() : base() { Parameters.Add(new FixedValueParameter<IntValue>(SeedName, "The random seed used to initialize the new pseudo random number generator.", new IntValue(0))); Parameters.Add(new FixedValueParameter<BoolValue>(SetSeedRandomlyName, "True if the random seed should be set to a random value, otherwise false.", new BoolValue(true))); Parameters.Add(new FixedValueParameter<IntValue>(PopulationSizeName, "λ (lambda) - the size of the offspring population.", new IntValue(20))); Parameters.Add(new FixedValueParameter<IntValue>(InitialIterationsName, "The number of iterations that should be performed with only axis parallel mutation.", new IntValue(0))); Parameters.Add(new FixedValueParameter<DoubleArray>(InitialSigmaName, "The initial sigma can be a single value or a value for each dimension. All values need to be > 0.", new DoubleArray(new[] { 0.5 }))); Parameters.Add(new OptionalValueParameter<IntValue>(MuName, "Optional, the mu best offspring that should be considered for update of the new mean and strategy parameters. If not given it will be automatically calculated.")); Parameters.Add(new ConstrainedValueParameter<ICMARecombinator>(CMARecombinatorName, "The operator used to calculate the new mean.")); Parameters.Add(new ConstrainedValueParameter<ICMAManipulator>(CMAMutatorName, "The operator used to manipulate a point.")); Parameters.Add(new ConstrainedValueParameter<ICMAInitializer>(CMAInitializerName, "The operator that initializes the covariance matrix and strategy parameters.")); Parameters.Add(new ConstrainedValueParameter<ICMAUpdater>(CMAUpdaterName, "The operator that updates the covariance matrix and strategy parameters.")); Parameters.Add(new ValueParameter<MultiAnalyzer>(AnalyzerName, "The operator used to analyze each generation.", new MultiAnalyzer())); Parameters.Add(new FixedValueParameter<IntValue>(MaximumGenerationsName, "The maximum number of generations which should be processed.", new IntValue(1000))); Parameters.Add(new FixedValueParameter<IntValue>(MaximumEvaluatedSolutionsName, "The maximum number of evaluated solutions that should be computed.", new IntValue(int.MaxValue))); Parameters.Add(new FixedValueParameter<DoubleValue>(TargetQualityName, "(stopFitness) Surpassing this quality value terminates the algorithm.", new DoubleValue(double.NaN))); Parameters.Add(new FixedValueParameter<DoubleValue>(MinimumQualityChangeName, "(stopTolFun) If the range of fitness values is less than a certain value the algorithm terminates (set to 0 or positive value to enable).", new DoubleValue(double.NaN))); Parameters.Add(new FixedValueParameter<DoubleValue>(MinimumQualityHistoryChangeName, "(stopTolFunHist) If the range of fitness values is less than a certain value for a certain time the algorithm terminates (set to 0 or positive to enable).", new DoubleValue(double.NaN))); Parameters.Add(new FixedValueParameter<DoubleValue>(MinimumStandardDeviationName, "(stopTolXFactor) If the standard deviation falls below a certain value the algorithm terminates (set to 0 or positive to enable).", new DoubleValue(double.NaN))); Parameters.Add(new FixedValueParameter<DoubleValue>(MaximumStandardDeviationChangeName, "(stopTolUpXFactor) If the standard deviation changes by a value larger than this parameter the algorithm stops (set to a value > 0 to enable).", new DoubleValue(double.NaN))); var randomCreator = new RandomCreator(); var variableCreator = new VariableCreator(); var resultsCollector = new ResultsCollector(); var cmaInitializer = new Placeholder(); solutionCreator = new Placeholder(); var subScopesCreator = new SubScopesCreator(); var ussp1 = new UniformSubScopesProcessor(); populationSolutionCreator = new Placeholder(); var cmaMutator = new Placeholder(); var ussp2 = new UniformSubScopesProcessor(); evaluator = new Placeholder(); var subScopesCounter = new SubScopesCounter(); sorter = new SubScopesSorter(); var analyzer = new Placeholder(); var cmaRecombinator = new Placeholder(); var generationsCounter = new IntCounter(); var cmaUpdater = new Placeholder(); terminator = new Terminator(); OperatorGraph.InitialOperator = randomCreator; randomCreator.RandomParameter.ActualName = "Random"; randomCreator.SeedParameter.ActualName = SeedParameter.Name; randomCreator.SeedParameter.Value = null; randomCreator.SetSeedRandomlyParameter.ActualName = SetSeedRandomlyParameter.Name; randomCreator.SetSeedRandomlyParameter.Value = null; randomCreator.Successor = variableCreator; variableCreator.Name = "Initialize Variables"; variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("EvaluatedSolutions", new IntValue(0))); variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Generations", new IntValue(0))); variableCreator.Successor = resultsCollector; resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("EvaluatedSolutions")); resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Generations")); resultsCollector.ResultsParameter.ActualName = "Results"; resultsCollector.Successor = cmaInitializer; cmaInitializer.Name = "Initialize Strategy Parameters"; cmaInitializer.OperatorParameter.ActualName = CMAInitializerParameter.Name; cmaInitializer.Successor = subScopesCreator; subScopesCreator.NumberOfSubScopesParameter.ActualName = PopulationSizeParameter.Name; subScopesCreator.Successor = ussp1; ussp1.Name = "Create population"; ussp1.Parallel = new BoolValue(false); ussp1.Operator = populationSolutionCreator; ussp1.Successor = solutionCreator; populationSolutionCreator.Name = "Initialize arx"; // populationSolutionCreator.OperatorParameter will be wired populationSolutionCreator.Successor = null; solutionCreator.Name = "Initialize xmean"; // solutionCreator.OperatorParameter will be wired solutionCreator.Successor = cmaMutator; cmaMutator.Name = "Sample population"; cmaMutator.OperatorParameter.ActualName = CMAMutatorParameter.Name; cmaMutator.Successor = ussp2; ussp2.Name = "Evaluate offspring"; ussp2.Parallel = new BoolValue(true); ussp2.Operator = evaluator; ussp2.Successor = subScopesCounter; evaluator.Name = "Evaluator"; // evaluator.OperatorParameter will be wired evaluator.Successor = null; subScopesCounter.Name = "Count EvaluatedSolutions"; subScopesCounter.AccumulateParameter.Value = new BoolValue(true); subScopesCounter.ValueParameter.ActualName = "EvaluatedSolutions"; subScopesCounter.Successor = sorter; // sorter.ValueParameter will be wired // sorter.DescendingParameter will be wired sorter.Successor = analyzer; analyzer.Name = "Analyzer"; analyzer.OperatorParameter.ActualName = AnalyzerParameter.Name; analyzer.Successor = cmaRecombinator; cmaRecombinator.Name = "Create new xmean"; cmaRecombinator.OperatorParameter.ActualName = CMARecombinatorParameter.Name; cmaRecombinator.Successor = generationsCounter; generationsCounter.Name = "Generations++"; generationsCounter.IncrementParameter.Value = new IntValue(1); generationsCounter.ValueParameter.ActualName = "Generations"; generationsCounter.Successor = cmaUpdater; cmaUpdater.Name = "Update distributions"; cmaUpdater.OperatorParameter.ActualName = CMAUpdaterParameter.Name; cmaUpdater.Successor = terminator; terminator.Continue = cmaMutator; terminator.Terminate = null; qualityAnalyzer = new BestAverageWorstQualityAnalyzer(); cmaAnalyzer = new CMAAnalyzer(); InitializeOperators(); RegisterEventHandlers(); Parameterize(); }