public EstimatedProbabilisticTravelingSalesmanProblem() { Parameters.Add(new FixedValueParameter <IntValue>("RealizationsSize", "Size of the sample for the estimation-based evaluation", new IntValue(100))); Parameters.Add(new ValueParameter <ItemList <BoolArray> >("Realizations", "The list of samples drawn from all possible stochastic instances.", new ItemList <BoolArray>())); Operators.Add(new BestPTSPSolutionAnalyzer()); Operators.Add(new PTSPEstimatedInversionMoveEvaluator()); Operators.Add(new PTSPEstimatedInsertionMoveEvaluator()); Operators.Add(new PTSPEstimatedInversionLocalImprovement()); Operators.Add(new PTSPEstimatedInsertionLocalImprovement()); Operators.Add(new PTSPEstimatedTwoPointFiveLocalImprovement()); Operators.Add(new ExhaustiveTwoPointFiveMoveGenerator()); Operators.Add(new StochasticTwoPointFiveMultiMoveGenerator()); Operators.Add(new StochasticTwoPointFiveSingleMoveGenerator()); Operators.Add(new TwoPointFiveMoveMaker()); Operators.Add(new PTSPEstimatedTwoPointFiveMoveEvaluator()); Operators.RemoveAll(x => x is SingleObjectiveMoveGenerator); Operators.RemoveAll(x => x is SingleObjectiveMoveMaker); Operators.RemoveAll(x => x is SingleObjectiveMoveEvaluator); Encoding.ConfigureOperators(Operators.OfType <IOperator>()); foreach (var twopointfiveMoveOperator in Operators.OfType <ITwoPointFiveMoveOperator>()) { twopointfiveMoveOperator.TwoPointFiveMoveParameter.ActualName = "Permutation.TwoPointFiveMove"; } UpdateRealizations(); RegisterEventHandlers(); }
protected ParameterOptimizationProblem(IParameterVectorEvaluator evaluator) : base(evaluator, new UniformRandomRealVectorCreator()) { Parameters.Add(new FixedValueParameter <IntValue>(ProblemSizeParameterName, "The dimension of the parameter vector that is to be optimized.", new IntValue(1))); Parameters.Add(new ValueParameter <DoubleMatrix>(BoundsParameterName, "The bounds for each dimension of the parameter vector. If the number of bounds is smaller than the problem size then the bounds are reused in a cyclic manner.", new DoubleMatrix(new double[, ] { { 0, 100 } }, new string[] { "LowerBound", "UpperBound" }))); Parameters.Add(new ValueParameter <StringArray>(ParameterNamesParameterName, "The element names which are used to calculate the quality of a parameter vector.", new StringArray(new string[] { "Parameter0" }))); SolutionCreator.LengthParameter.ActualName = "ProblemSize"; Operators.AddRange(ApplicationManager.Manager.GetInstances <IRealVectorOperator>()); strategyVectorCreator = new StdDevStrategyVectorCreator(); strategyVectorCreator.LengthParameter.ActualName = ProblemSizeParameter.Name; strategyVectorCrossover = new StdDevStrategyVectorCrossover(); strategyVectorManipulator = new StdDevStrategyVectorManipulator(); strategyVectorManipulator.LearningRateParameter.Value = new DoubleValue(0.5); strategyVectorManipulator.GeneralLearningRateParameter.Value = new DoubleValue(0.5); Operators.Add(strategyVectorCreator); Operators.Add(strategyVectorCrossover); Operators.Add(strategyVectorManipulator); Operators.Add(new BestSolutionAnalyzer()); Operators.Add(new BestSolutionsAnalyzer()); UpdateParameters(); UpdateStrategyVectorBounds(); RegisterEventHandlers(); }
public IOperator RegisterUnaryCastOperator(OperandType operandType, int precedence, DoubleOperandFunctionMatrix matrix) { var text = operandType.ToString(); var castToOperand = new Operand(operandType); var op = new Operator( OperatorType.UnaryCastOperator, precedence, ShortCircuitMode.None, (operandStack, vSet, parserPosition) => { var result = OperatorActions.DoUnaryCastOperation(matrix, operandStack, vSet, castToOperand); if (result != null) { throw new ExpressionEvaluatorException(parserPosition, ExpressionEvaluatorException.ExceptionCause.BadUnaryOperand, "Cast to (" + text + ") cannot be applied to operand of type " + result.Item1); } }, text ); Operators.Add(text, op); OperatorMatrices.Add(op, matrix); return(op); }
public IOperator RegisterOperator( string text, int precedence, DoubleOperandFunctionMatrix matrix, ShortCircuitMode shortCircuit = ShortCircuitMode.None, OperatorType operatorType = OperatorType.Operator) { var op = new Operator(operatorType, precedence, shortCircuit, (operandStack, vSet, parserPosition) => { var result = OperatorActions.DoOperation(matrix, operandStack, vSet); if (result != null) { throw new ExpressionEvaluatorException( parserPosition, ExpressionEvaluatorException.ExceptionCause.BadOperand, "Operator '" + text + "' cannot be applied to operands of type " + result.Item1 + " and " + result.Item2); } }, text ); Operators.Add(text, op); OperatorMatrices.Add(op, matrix); return(op); }
private void InitializeOperators() { Operators.Add(new TSPImprovementOperator()); Operators.Add(new TSPMultipleGuidesPathRelinker()); Operators.Add(new TSPPathRelinker()); Operators.Add(new TSPSimultaneousPathRelinker()); Operators.Add(new TSPSimilarityCalculator()); Operators.Add(new QualitySimilarityCalculator()); Operators.Add(new NoSimilarityCalculator()); Operators.Add(new BestTSPSolutionAnalyzer()); Operators.Add(new TSPAlleleFrequencyAnalyzer()); Operators.Add(new PopulationSimilarityAnalyzer(Operators.OfType <ISolutionSimilarityCalculator>())); ParameterizeAnalyzers(); var operators = new HashSet <IPermutationOperator>(new IPermutationOperator[] { new OrderCrossover2(), new InversionManipulator(), new StochasticInversionMultiMoveGenerator() }, new TypeEqualityComparer <IPermutationOperator>()); foreach (var op in ApplicationManager.Manager.GetInstances <IPermutationOperator>()) { operators.Add(op); } Operators.AddRange(operators); ParameterizeOperators(); UpdateMoveEvaluators(); }
private void InitializeOperators() { Operators.Add(new SymbolicTimeSeriesPrognosisSingleObjectiveTrainingBestSolutionAnalyzer()); Operators.Add(new SymbolicTimeSeriesPrognosisSingleObjectiveValidationBestSolutionAnalyzer()); Operators.Add(new SymbolicTimeSeriesPrognosisSingleObjectiveOverfittingAnalyzer()); ParameterizeOperators(); }
private void InitializeOperators() { var defaultOperators = new HashSet <IPermutationOperator>(new IPermutationOperator[] { new PartiallyMatchedCrossover(), new Swap2Manipulator(), new ExhaustiveSwap2MoveGenerator() }); Operators.AddRange(defaultOperators); Operators.AddRange(ApplicationManager.Manager.GetInstances <IPermutationOperator>().Except(defaultOperators, new TypeEqualityComparer <IPermutationOperator>())); Operators.RemoveAll(x => x is ISingleObjectiveMoveEvaluator); Operators.AddRange(ApplicationManager.Manager.GetInstances <IQAPMoveEvaluator>()); Operators.Add(new BestQAPSolutionAnalyzer()); Operators.Add(new QAPAlleleFrequencyAnalyzer()); Operators.Add(new QAPExhaustiveInsertionLocalImprovement()); Operators.Add(new QAPExhaustiveInversionLocalImprovement()); Operators.Add(new QAPStochasticScrambleLocalImprovement()); Operators.Add(new QAPExhaustiveSwap2LocalImprovement()); Operators.Add(new HammingSimilarityCalculator()); Operators.Add(new QAPSimilarityCalculator()); Operators.Add(new QualitySimilarityCalculator()); Operators.Add(new PopulationSimilarityAnalyzer(Operators.OfType <ISolutionSimilarityCalculator>())); ParameterizeAnalyzers(); ParameterizeOperators(); }
private void InitializeOperators() { NKBitFlipMoveEvaluator nkEvaluator = new NKBitFlipMoveEvaluator(); Encoding.ConfigureOperator(nkEvaluator); Operators.Add(nkEvaluator); }
public async Task AddOperatorAsync([Remainder] string Remainder = null) { if (Operators.ContainsKey(Context.Message.Author.Id)) { foreach (SocketUser user in Context.Message.MentionedUsers) { if (!Operators.ContainsKey(user.Id)) { Operators.Add(user.Id); RainBorg.Log("Command", "{0} added as an operator by {1}", user.Id, Context.User.Username); } } await Config.Save(); try { // Add reaction to message IEmote emote = Context.Guild.Emotes.First(e => e.Name == RainBorg.successReact); await Context.Message.AddReactionAsync(emote); } catch { await Context.Message.AddReactionAsync(new Emoji("👌")); } } }
public async Task AddOperatorAsync(params ulong[] users) { if (Operators.ContainsKey(Context.Message.Author.Id)) { foreach (ulong user in users) { try { if (!Operators.ContainsKey(Context.Client.GetUser(user).Id)) { Operators.Add(Context.Client.GetUser(user).Id); RainBorg.Log("Command", "{0} added as an operator by {1}", user, Context.User.Username); } } catch { } } await Config.Save(); try { // Add reaction to message IEmote emote = Context.Guild.Emotes.First(e => e.Name == RainBorg.successReact); await Context.Message.AddReactionAsync(emote); } catch { await Context.Message.AddReactionAsync(new Emoji("👌")); } } }
private void AfterDeserialization() { RegisterEventHandlers(); // compatibility bool changed = false; if (!Operators.OfType <SymbolicRegressionSingleObjectiveTrainingParetoBestSolutionAnalyzer>().Any()) { Operators.Add(new SymbolicRegressionSingleObjectiveTrainingParetoBestSolutionAnalyzer()); changed = true; } if (!Operators.OfType <SymbolicRegressionSingleObjectiveValidationParetoBestSolutionAnalyzer>().Any()) { Operators.Add(new SymbolicRegressionSingleObjectiveValidationParetoBestSolutionAnalyzer()); changed = true; } if (!Operators.OfType <SymbolicRegressionSolutionsAnalyzer>().Any()) { Operators.Add(new SymbolicRegressionSolutionsAnalyzer()); changed = true; } if (changed) { ParameterizeOperators(); } }
private void UpdateMoveEvaluators() { foreach (ISingleObjectiveTestFunctionMoveEvaluator op in Operators.OfType <ISingleObjectiveTestFunctionMoveEvaluator>().ToList()) { Operators.Remove(op); } foreach (ISingleObjectiveTestFunctionMoveEvaluator op in ApplicationManager.Manager.GetInstances <ISingleObjectiveTestFunctionMoveEvaluator>()) { if (op.EvaluatorType == Evaluator.GetType()) { Operators.Add(op); #region Synchronize evaluator specific parameters with the parameters of the corresponding move evaluators if (op is ISphereMoveEvaluator) { SphereEvaluator e = (Evaluator as SphereEvaluator); e.AlphaParameter.ValueChanged += new EventHandler(SphereEvaluator_Parameter_ValueChanged); e.CParameter.ValueChanged += new EventHandler(SphereEvaluator_Parameter_ValueChanged); ISphereMoveEvaluator em = (op as ISphereMoveEvaluator); em.C = e.C; em.Alpha = e.Alpha; } else if (op is IRastriginMoveEvaluator) { RastriginEvaluator e = (Evaluator as RastriginEvaluator); e.AParameter.ValueChanged += new EventHandler(RastriginEvaluator_Parameter_ValueChanged); IRastriginMoveEvaluator em = (op as IRastriginMoveEvaluator); em.A = e.A; } #endregion } } ParameterizeOperators(); OnOperatorsChanged(); }
private void InitializeOperators() { Operators.Clear(); ApplyEncoding(); Operators.Add(new BestSchedulingSolutionAnalyzer()); ParameterizeOperators(); }
private void InitializeOperators() { var solutionCreatorParameter = SolutionCreatorParameter as ConstrainedValueParameter <IVRPCreator>; solutionCreatorParameter.ValidValues.Clear(); Operators.Clear(); if (ProblemInstance != null) { Operators.AddRange( ProblemInstance.Operators.Concat( ApplicationManager.Manager.GetInstances <IGeneralVRPOperator>().Cast <IOperator>()).OrderBy(op => op.Name)); Operators.Add(new VRPSimilarityCalculator()); Operators.Add(new QualitySimilarityCalculator()); Operators.Add(new PopulationSimilarityAnalyzer(Operators.OfType <ISolutionSimilarityCalculator>())); IVRPCreator defaultCreator = null; foreach (IVRPCreator creator in Operators.Where(o => o is IVRPCreator)) { solutionCreatorParameter.ValidValues.Add(creator); if (creator is Encodings.Alba.RandomCreator) { defaultCreator = creator; } } Operators.Add(new AlbaLambdaInterchangeLocalImprovementOperator()); if (defaultCreator != null) { solutionCreatorParameter.Value = defaultCreator; } } ParameterizeOperators(); }
private void AfterDeserialization() { // BackwardsCompatibility3.4 #region Backwards compatible code, remove with 3.5 if (!Parameters.ContainsKey(ModelCreatorParameterName)) { Parameters.Add(new ValueParameter <ISymbolicClassificationModelCreator>(ModelCreatorParameterName, "", new AccuracyMaximizingThresholdsModelCreator())); } bool changed = false; if (!Operators.OfType <SymbolicClassificationSingleObjectiveTrainingParetoBestSolutionAnalyzer>().Any()) { Operators.Add(new SymbolicClassificationSingleObjectiveTrainingParetoBestSolutionAnalyzer()); changed = true; } if (!Operators.OfType <SymbolicClassificationSingleObjectiveValidationParetoBestSolutionAnalyzer>().Any()) { Operators.Add(new SymbolicClassificationSingleObjectiveValidationParetoBestSolutionAnalyzer()); changed = true; } if (changed) { ParameterizeOperators(); } #endregion RegisterEventHandlers(); }
public override T Evaluate(DifferentialGeometry dg) { T t1 = _tex1.Evaluate(dg), t2 = _tex2.Evaluate(dg); var amt = _amount.Evaluate(dg); return(Operators.Add(Operators.Multiply(t1, (1f - amt)), Operators.Multiply(t2, amt))); }
private void btnAdd_Click(object sender, EventArgs e) { obj = new Operators(); obj.num1 = Convert.ToInt32(txtNum1.Text); obj.num2 = Convert.ToInt32(txtNum2.Text); lblres.Text = obj.Add().ToString(); }
public AnalyticalProbabilisticTravelingSalesmanProblem() { Operators.Add(new BestPTSPSolutionAnalyzer()); Operators.Add(new PTSPAnalyticalInversionMoveEvaluator()); Operators.Add(new PTSPAnalyticalInsertionMoveEvaluator()); Operators.Add(new PTSPAnalyticalInversionLocalImprovement()); Operators.Add(new PTSPAnalyticalInsertionLocalImprovement()); Operators.Add(new PTSPAnalyticalTwoPointFiveLocalImprovement()); Operators.Add(new ExhaustiveTwoPointFiveMoveGenerator()); Operators.Add(new StochasticTwoPointFiveMultiMoveGenerator()); Operators.Add(new StochasticTwoPointFiveSingleMoveGenerator()); Operators.Add(new TwoPointFiveMoveMaker()); Operators.Add(new PTSPAnalyticalTwoPointFiveMoveEvaluator()); Operators.RemoveAll(x => x is SingleObjectiveMoveGenerator); Operators.RemoveAll(x => x is SingleObjectiveMoveMaker); Operators.RemoveAll(x => x is SingleObjectiveMoveEvaluator); Encoding.ConfigureOperators(Operators.OfType <IOperator>()); foreach (var twopointfiveMoveOperator in Operators.OfType <ITwoPointFiveMoveOperator>()) { twopointfiveMoveOperator.TwoPointFiveMoveParameter.ActualName = "Permutation.TwoPointFiveMove"; } }
public void BarCodeScan(object obj) { string barCode = obj.ToString(); BarCode = ""; if (BarCodeList.Contains(barCode)) { BarCodeList.Remove(barCode); Operators.Remove(Operators.Single(item => item.BarCode.Equals(barCode))); for (int i = 0; i < Operators.Count; i++) { Operators[i].LineNum = i + 1; } return; } var userResult = new BLL.ExtraBLL.WorkGroupInfoBLL().GetUserInfoByBarCode(barCode); if (userResult.Result) { Operators.Add(new OperatorModel() { LineNum = Operators.Count + 1, UserName = userResult.Data.UserName, BarCode = userResult.Data.UserBarcode }); BarCodeList.Add(barCode); } else { MessageBox.Show(userResult.Msg, "提示", MessageBoxButton.OK, MessageBoxImage.Warning); } }
private void InitializeOperators() { Operators.RemoveAll(x => x.GetType().IsGenericType&& x.GetType().GetGenericTypeDefinition() == typeof(CFGTrainingBestSolutionAnalyzer <>)); Operators.Add(new CFGPythonTrainingBestSolutionAnalyzer()); Operators.Add(new CFGPythonExceptionAnalyzer()); Operators.Add(new CFGPythonIndividualExceptionAnalyzer()); ParameterizeOperators(); }
private void InitializeOperators() { Operators.Add(new SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer()); Operators.Add(new SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer()); Operators.Add(new SymbolicExpressionTreePhenotypicSimilarityCalculator()); Operators.Add(new SymbolicClassificationPhenotypicDiversityAnalyzer(Operators.OfType <SymbolicExpressionTreePhenotypicSimilarityCalculator>())); ParameterizeOperators(); }
public void It_should_throw_an_exception_for_a_non_numeric_type() { var exception = Assert.Throws <ArgumentException>( () => Operators.Add(new DateTime(2018, 05, 22), new DateTime(2018, 05, 23)) ); Assert.AreEqual("The specified type is not a numeric type.", exception.Message); }
private void InitializeOperators() { Operators.Add(new HammingSimilarityCalculator()); Operators.Add(new QualitySimilarityCalculator()); Operators.Add(new PopulationSimilarityAnalyzer(Operators.OfType <ISolutionSimilarityCalculator>())); Parameterize(); }
public TextFilter() { Name = "Text"; Operators.Add(new FilterOperator("Contains", false)); Operators.Add(new FilterOperator("StartsWith", false)); Operators.Add(new FilterOperator("EndsWith", false)); CurrentOperator = Operators.First(); }
private void InitializeOperators() { Operators.AddRange(ApplicationManager.Manager.GetInstances <ISymbolicExpressionTreeOperator>().OfType <IOperator>()); Operators.Add(new BestAntTrailAnalyzer()); Operators.Add(new MinAverageMaxSymbolicExpressionTreeLengthAnalyzer()); Operators.Add(new SymbolicExpressionSymbolFrequencyAnalyzer()); ParameterizeAnalyzers(); ParameterizeOperators(); }
public DateFilter() { Name = "Date"; Operators.Add(new FilterOperator("Equals", false)); Operators.Add(new FilterOperator("Before", false)); Operators.Add(new FilterOperator("After", false)); Operators.Add(new FilterOperator("Between", true)); CurrentOperator = Operators.First(); }
private void InitializeOperators() { Operators.AddRange(ApplicationManager.Manager.GetInstances <IIntegerVectorOperator>()); Operators.Add(new SymbolicExpressionSymbolFrequencyAnalyzer()); Operators.Add(new SymbolicDataAnalysisVariableFrequencyAnalyzer()); Operators.Add(new MinAverageMaxSymbolicExpressionTreeLengthAnalyzer()); Operators.Add(new SymbolicExpressionTreeLengthAnalyzer()); ParameterizeOperators(); }
private void InitializeOperators() { Operators.Add(new BestOrienteeringSolutionAnalyzer()); ParameterizeAnalyzer(); Operators.Add(new OrienteeringLocalImprovementOperator()); Operators.Add(new OrienteeringShakingOperator()); ParameterizeOperators(); }
[Test] public void FindsDefaultOperator() { var operators = new Operators <string, Processor <string> >(); operators.Add(new DefaultCreate()); var result = operators.FindOperator <CreateOperator <string> >(new [] { new IdentifierName("test"), null }); Assert.AreEqual(typeof(DefaultCreate), result.GetType()); }
private void opParam_ValueChanged(object sender, EventArgs e) { IValueParameter opParam = (IValueParameter)sender; if (opParam.Value != null) { Operators.Add((IOperator)opParam.Value); } }