protected RunCollection(RunCollection original, Cloner cloner) : base(original, cloner) { updateOfRunsInProgress = false; optimizerName = original.optimizerName; resultNames = new List <string>(original.resultNames); parameterNames = new List <string>(original.parameterNames); dataTypes = new Dictionary <string, HashSet <Type> >(); foreach (string s in original.dataTypes.Keys) { dataTypes[s] = new HashSet <Type>(original.dataTypes[s]); } constraints = new RunCollectionConstraintCollection(original.constraints.Select(x => cloner.Clone(x))); modifiers = new CheckedItemList <IRunCollectionModifier>(original.modifiers.Select(cloner.Clone)); foreach (IRunCollectionConstraint constraint in constraints) { constraint.ConstrainedValue = this; } RegisterConstraintsEvents(); RegisterConstraintEvents(constraints); foreach (var run in this) { RegisterRunParametersEvents(run); RegisterRunResultsEvents(run); } UpdateFiltering(true); }
public MultiSymbolicExpressionTreeCrossover() : base() { Parameters.Add(new LookupParameter <ISymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The symbolic expression tree on which the operator should be applied.")); Parameters.Add(new ValueLookupParameter <IntValue>(MaximumSymbolicExpressionTreeLengthParameterName, "The maximal length (number of nodes) of the symbolic expression tree.")); Parameters.Add(new ValueLookupParameter <IntValue>(MaximumSymbolicExpressionTreeDepthParameterName, "The maximal depth of the symbolic expression tree (a tree with one node has depth = 0).")); Parameters.Add(new ScopeTreeLookupParameter <ISymbolicExpressionTree>(ParentsParameterName, "The parent symbolic expression trees which should be crossed.")); List <ISymbolicExpressionTreeCrossover> list = new List <ISymbolicExpressionTreeCrossover>(); foreach (Type type in ApplicationManager.Manager.GetTypes(typeof(ISymbolicExpressionTreeCrossover))) { if (this.GetType().Assembly != type.Assembly && typeof(SubtreeCrossover).Assembly != type.Assembly) { continue; } if (typeof(IMultiOperator <ISymbolicExpressionTreeCrossover>).IsAssignableFrom(type)) { continue; } list.Add((ISymbolicExpressionTreeCrossover)Activator.CreateInstance(type)); } CheckedItemList <ISymbolicExpressionTreeCrossover> checkedItemList = new CheckedItemList <ISymbolicExpressionTreeCrossover>(); checkedItemList.AddRange(list.OrderBy(op => op.Name)); Operators = checkedItemList;//.AsReadOnly(); read only is not used because a problem might add more crossover classes Operators_ItemsAdded(this, new CollectionItemsChangedEventArgs <IndexedItem <ISymbolicExpressionTreeCrossover> >(Operators.CheckedItems)); SelectedOperatorParameter.ActualName = "SelectedCrossoverOperator"; }
public MultiSymbolicDataAnalysisExpressionCreator() : base() { Parameters.Add(new LookupParameter <ISymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The symbolic expression tree on which the operator should be applied.")); Parameters.Add(new ValueLookupParameter <IntValue>(MaximumSymbolicExpressionTreeLengthParameterName, "The maximal length (number of nodes) of the symbolic expression tree.")); Parameters.Add(new ValueLookupParameter <IntValue>(MaximumSymbolicExpressionTreeDepthParameterName, "The maximal depth of the symbolic expression tree (a tree with one node has depth = 0).")); Parameters.Add(new ValueLookupParameter <ISymbolicExpressionGrammar>(SymbolicExpressionTreeGrammarParameterName, "The tree grammar that defines the correct syntax of symbolic expression trees that should be created.")); Parameters.Add(new LookupParameter <ISymbolicExpressionGrammar>(ClonedSymbolicExpressionTreeGrammarParameterName, "An immutable clone of the concrete grammar that is actually used to create and manipulate trees.")); List <ISymbolicDataAnalysisSolutionCreator> list = new List <ISymbolicDataAnalysisSolutionCreator>(); foreach (Type type in ApplicationManager.Manager.GetTypes(typeof(ISymbolicDataAnalysisSolutionCreator))) { if (this.GetType().Assembly != type.Assembly) { continue; } if (typeof(IMultiOperator <ISymbolicDataAnalysisSolutionCreator>).IsAssignableFrom(type)) { continue; } list.Add((ISymbolicDataAnalysisSolutionCreator)Activator.CreateInstance(type)); } CheckedItemList <ISymbolicDataAnalysisSolutionCreator> checkedItemList = new CheckedItemList <ISymbolicDataAnalysisSolutionCreator>(); checkedItemList.AddRange(list.OrderBy(op => op.Name)); Operators = checkedItemList.AsReadOnly(); Operators_ItemsAdded(this, new CollectionItemsChangedEventArgs <IndexedItem <ISymbolicDataAnalysisSolutionCreator> >(Operators.CheckedItems)); }
public MultiSelector() : base() { Parameters.Add(new ValueParameter <BoolValue>("CopySelected", "True if the selected sub-scopes should be copied, otherwise false.", new BoolValue(true))); Parameters.Add(new ValueLookupParameter <IntValue>("NumberOfSelectedSubScopes", "The number of sub-scopes which should be selected.")); Parameters.Add(new ValueLookupParameter <BoolValue>("Maximization", "True if the current problem is a maximization problem, otherwise false.")); Parameters.Add(new ScopeTreeLookupParameter <DoubleValue>("Quality", "The quality value contained in each sub-scope which is used for selection.")); Parameters.Add(new ScopeTreeLookupParameter <DoubleArray>("CaseQualities", "The quality of every single training case for each individual.")); CopySelectedParameter.Hidden = true; List <ISelector> list = new List <ISelector>(); foreach (Type type in ApplicationManager.Manager.GetTypes(typeof(ISelector))) { if (typeof(MultiProportionalSelector) == type) { continue; } if (typeof(IMultiOperator <ISelector>).IsAssignableFrom(type)) { continue; } list.Add((ISelector)Activator.CreateInstance(type)); } CheckedItemList <ISelector> checkedItemList = new CheckedItemList <ISelector>(); checkedItemList.AddRange(list.OrderBy(op => op.Name)); Operators = checkedItemList.AsReadOnly(); Operators_ItemsAdded(this, new CollectionItemsChangedEventArgs <IndexedItem <ISelector> >(Operators.CheckedItems)); SelectedOperatorParameter.ActualName = "SelectedSelectionOperator"; }
public MultiProportionalSelector() : base() { #region Create parameters Parameters.Add(new ValueLookupParameter <BoolValue>("Maximization", "True if the problem is a maximization problem.")); Parameters.Add(new ScopeTreeLookupParameter <DoubleValue>("Quality", "The quality of the solutions.")); Parameters.Add(new ScopeTreeLookupParameter <DoubleArray>("CaseQualities", "The quality of every single training case for each individual.")); Parameters.Add(new ValueLookupParameter <IntValue>("NumberOfSelectedSubScopes", "The number of scopes that should be selected.")); Parameters.Add(new ValueLookupParameter <BoolValue>("CopySelected", "True if the scopes should be copied, false if they should be moved.", new BoolValue(true))); Parameters.Add(new ValueParameter <ICheckedItemList <ISelector> >("Selectors", "The selection operators.")); Parameters.Add(new LookupParameter <IRandom>("Random", "The random number generator to use.")); Parameters.Add(new ScopeParameter("CurrentScope", "The current scope from which sub-scopes should be selected.")); CopySelectedParameter.Hidden = true; #endregion List <ISelector> list = new List <ISelector>(); foreach (Type type in ApplicationManager.Manager.GetTypes(typeof(ISelector))) { if (this.GetType() == type) { continue; } if (typeof(IMultiOperator <ISelector>).IsAssignableFrom(type)) { continue; } list.Add((ISelector)Activator.CreateInstance(type)); } CheckedItemList <ISelector> checkedItemList = new CheckedItemList <ISelector>(); checkedItemList.AddRange(list.OrderBy(op => op.Name)); Selectors = checkedItemList.AsReadOnly(); Initialize(); }
public MultiSymbolicExpressionTreeArchitectureManipulator() : base() { Parameters.Add(new LookupParameter <ISymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The symbolic expression tree on which the operator should be applied.")); Parameters.Add(new ValueLookupParameter <IntValue>(MaximumFunctionDefinitionsParameterName, "The maximal allowed number of automatically defined functions.")); Parameters.Add(new ValueLookupParameter <IntValue>(MaximumFunctionArgumentsParameterName, "The maximal allowed number of arguments of a automatically defined functions.")); Parameters.Add(new ValueLookupParameter <IntValue>(MaximumSymbolicExpressionTreeLengthParameterName, "The maximal length (number of nodes) of the symbolic expression tree.")); Parameters.Add(new ValueLookupParameter <IntValue>(MaximumSymbolicExpressionTreeDepthParameterName, "The maximal depth of the symbolic expression tree (a tree with one node has depth = 0).")); List <ISymbolicExpressionTreeManipulator> list = new List <ISymbolicExpressionTreeManipulator>(); foreach (Type type in ApplicationManager.Manager.GetTypes(typeof(ISymbolicExpressionTreeManipulator))) { if (this.GetType().Assembly != type.Assembly) { continue; } if (typeof(IMultiOperator <ISymbolicExpressionTreeManipulator>).IsAssignableFrom(type)) { continue; } list.Add((ISymbolicExpressionTreeManipulator)Activator.CreateInstance(type)); } CheckedItemList <ISymbolicExpressionTreeManipulator> checkedItemList = new CheckedItemList <ISymbolicExpressionTreeManipulator>(); checkedItemList.AddRange(list.OrderBy(op => op.Name)); Operators = checkedItemList.AsReadOnly(); Operators_ItemsAdded(this, new CollectionItemsChangedEventArgs <IndexedItem <ISymbolicExpressionTreeManipulator> >(Operators.CheckedItems)); SelectedOperatorParameter.ActualName = "SelectedManipulationOperator"; }
private void Initialize() { updateOfRunsInProgress = false; parameterNames = new List <string>(); resultNames = new List <string>(); dataTypes = new Dictionary <string, HashSet <Type> >(); constraints = new RunCollectionConstraintCollection(); modifiers = new CheckedItemList <IRunCollectionModifier>(); RegisterConstraintsEvents(); }
public ICheckedItemList <StringValue> CreateVariableItemList(IEnumerable <string> checkedItems = null) { ICheckedItemList <StringValue> itemList = new CheckedItemList <StringValue>(); foreach (string name in PreprocessingData.GetDoubleVariableNames()) { var n = new StringValue(name); itemList.Add(n, (checkedItems == null) ? true : checkedItems.Contains(name)); } return(new ReadOnlyCheckedItemList <StringValue>(itemList)); }
private static ICheckedItemList <StringValue> CreateVariableItemList(IPreprocessingData preprocessingData) { ICheckedItemList <StringValue> itemList = new CheckedItemList <StringValue>(); foreach (string name in preprocessingData.GetDoubleVariableNames()) { var n = new StringValue(name); bool isInputTarget = preprocessingData.InputVariables.Contains(name) || preprocessingData.TargetVariable == name; itemList.Add(n, isInputTarget); } return(new ReadOnlyCheckedItemList <StringValue>(itemList)); }
public SolutionMessageBuilder() : base() { name = ItemName; description = ItemDescription; convertersList = new CheckedItemList<IItemToSolutionMessageConverter>(); convertersList.Add(new BoolConverter()); convertersList.Add(new DateTimeValueConverter()); convertersList.Add(new DoubleConverter()); convertersList.Add(new IntegerConverter()); convertersList.Add(new StringConverter()); convertersList.Add(new TimeSpanValueConverter()); RegisterEventHandlers(); }
public SolutionMessageBuilder() : base() { name = ItemName; description = ItemDescription; convertersList = new CheckedItemList <IItemToSolutionMessageConverter>(); convertersList.Add(new BoolConverter()); convertersList.Add(new DateTimeValueConverter()); convertersList.Add(new DoubleConverter()); convertersList.Add(new IntegerConverter()); convertersList.Add(new StringConverter()); convertersList.Add(new TimeSpanValueConverter()); RegisterEventHandlers(); }
private void InitializeOperators() { var list = ApplicationManager.Manager.GetInstances <ISymbolicExpressionTreeCrossover>().ToList(); var dataAnalysisCrossovers = from type in ApplicationManager.Manager.GetTypes(typeof(ISymbolicDataAnalysisExpressionCrossover <T>)) where this.GetType().Assembly == type.Assembly where !typeof(IMultiOperator <ISymbolicExpressionTreeCrossover>).IsAssignableFrom(type) select(ISymbolicDataAnalysisExpressionCrossover <T>) Activator.CreateInstance(type); list.AddRange(dataAnalysisCrossovers); var checkedItemList = new CheckedItemList <ISymbolicExpressionTreeCrossover>(); checkedItemList.AddRange(list.OrderBy(op => op.Name)); Operators = checkedItemList; Operators_ItemsAdded(this, new CollectionItemsChangedEventArgs <IndexedItem <ISymbolicExpressionTreeCrossover> >(Operators.CheckedItems)); }
protected DataAnalysisProblemData(IDataset dataset, IEnumerable <string> allowedInputVariables, IEnumerable <ITransformation> transformations = null) { if (dataset == null) { throw new ArgumentNullException("The dataset must not be null."); } if (allowedInputVariables == null) { throw new ArgumentNullException("The allowed input variables must not be null."); } if (allowedInputVariables.Except(dataset.DoubleVariables).Except(dataset.StringVariables).Any()) { throw new ArgumentException("All allowed input variables must be present in the dataset and of type double or string."); } var variables = dataset.VariableNames.Where(variable => dataset.VariableHasType <double>(variable) || dataset.VariableHasType <string>(variable)); var inputVariables = new CheckedItemList <StringValue>(variables.Select(x => new StringValue(x).AsReadOnly())); foreach (StringValue x in inputVariables) { inputVariables.SetItemCheckedState(x, allowedInputVariables.Contains(x.Value)); } int trainingPartitionStart = 0; int trainingPartitionEnd = dataset.Rows / 2; int testPartitionStart = dataset.Rows / 2; int testPartitionEnd = dataset.Rows; var transformationsList = new ItemList <ITransformation>(transformations ?? Enumerable.Empty <ITransformation>()); Parameters.Add(new FixedValueParameter <Dataset>(DatasetParameterName, "", (Dataset)dataset)); Parameters.Add(new FixedValueParameter <ReadOnlyCheckedItemList <StringValue> >(InputVariablesParameterName, "", inputVariables.AsReadOnly())); Parameters.Add(new FixedValueParameter <IntRange>(TrainingPartitionParameterName, "", new IntRange(trainingPartitionStart, trainingPartitionEnd))); Parameters.Add(new FixedValueParameter <IntRange>(TestPartitionParameterName, "", new IntRange(testPartitionStart, testPartitionEnd))); Parameters.Add(new FixedValueParameter <ReadOnlyItemList <ITransformation> >(TransformationsParameterName, "", transformationsList.AsReadOnly())); TransformationsParameter.Hidden = true; ((ValueParameter <Dataset>)DatasetParameter).ReactOnValueToStringChangedAndValueItemImageChanged = false; RegisterEventHandlers(); }
private void AfterDeserialization() { if (constraints == null) { constraints = new RunCollectionConstraintCollection(); } if (modifiers == null) { modifiers = new CheckedItemList <IRunCollectionModifier>(); } RegisterConstraintsEvents(); RegisterConstraintEvents(constraints); foreach (var run in this) { RegisterRunParametersEvents(run); RegisterRunResultsEvents(run); } UpdateFiltering(true); }
private void AfterDeserialization() { // BackwardsCompatibility3.3 #region Backwards compatible code, remove with 3.4 #pragma warning disable 0612 if (converters != null) { if (convertersList == null) { convertersList = new CheckedItemList <IItemToSolutionMessageConverter>(); } foreach (IItemToSolutionMessageConverter c in converters) { convertersList.Add(c); } converters.Clear(); converters = null; } #pragma warning restore 0612 #endregion RegisterEventHandlers(); }
public OKBProblemView() { InitializeComponent(); var calculatorListView = new CheckedItemListView <ICharacteristicCalculator>() { Anchor = AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right | AnchorStyles.Top, Location = new Point(flaSplitContainer.Padding.Left, calculateButton.Location.Y + calculateButton.Height + calculateButton.Padding.Bottom + 3), }; calculatorListView.Size = new Size(flaSplitContainer.Panel1.Size.Width - flaSplitContainer.Panel1.Padding.Horizontal, flaSplitContainer.Panel1.Height - calculatorListView.Location.Y - flaSplitContainer.Panel1.Padding.Bottom); calculatorList = new CheckedItemList <ICharacteristicCalculator>(); calculatorList.ItemsAdded += CalculatorListOnChanged; calculatorList.ItemsRemoved += CalculatorListOnChanged; calculatorList.ItemsReplaced += CalculatorListOnChanged; calculatorList.CollectionReset += CalculatorListOnChanged; calculatorList.CheckedItemsChanged += CalculatorListOnChanged; calculatorListView.Content = calculatorList.AsReadOnly(); flaSplitContainer.Panel1.Controls.Add(calculatorListView); calculateButton.Text = string.Empty; calculateButton.Image = VSImageLibrary.Play; refreshButton.Text = string.Empty; refreshButton.Image = VSImageLibrary.Refresh; cloneProblemButton.Text = string.Empty; cloneProblemButton.Image = VSImageLibrary.Clone; downloadCharacteristicsButton.Text = string.Empty; downloadCharacteristicsButton.Image = VSImageLibrary.Refresh; uploadCharacteristicsButton.Text = string.Empty; uploadCharacteristicsButton.Image = VSImageLibrary.Save; refreshSolutionsButton.Text = string.Empty; refreshSolutionsButton.Image = VSImageLibrary.Refresh; uploadSolutionsButton.Text = string.Empty; uploadSolutionsButton.Image = VSImageLibrary.Save; }
protected SolutionMessageBuilder(SolutionMessageBuilder original, Cloner cloner) : base(original, cloner) { convertersList = cloner.Clone(original.convertersList); RegisterEventHandlers(); }
public TransformationContent(TransformationContent original, Cloner cloner) : base(original, cloner) { Data = original.Data; CheckedTransformationList = new CheckedItemList <ITransformation>(original.CheckedTransformationList); }
public MultiProportionalSelector() : base() { #region Create parameters Parameters.Add(new ValueLookupParameter<BoolValue>("Maximization", "True if the problem is a maximization problem.")); Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The quality of the solutions.")); Parameters.Add(new ScopeTreeLookupParameter<DoubleArray>("CaseQualities", "The quality of every single training case for each individual.")); Parameters.Add(new ValueLookupParameter<IntValue>("NumberOfSelectedSubScopes", "The number of scopes that should be selected.")); Parameters.Add(new ValueLookupParameter<BoolValue>("CopySelected", "True if the scopes should be copied, false if they should be moved.", new BoolValue(true))); Parameters.Add(new ValueParameter<ICheckedItemList<ISelector>>("Selectors", "The selection operators.")); Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator to use.")); Parameters.Add(new ScopeParameter("CurrentScope", "The current scope from which sub-scopes should be selected.")); CopySelectedParameter.Hidden = true; #endregion List<ISelector> list = new List<ISelector>(); foreach (Type type in ApplicationManager.Manager.GetTypes(typeof(ISelector))) { if (this.GetType() == type) continue; if (typeof(IMultiOperator<ISelector>).IsAssignableFrom(type)) continue; list.Add((ISelector)Activator.CreateInstance(type)); } CheckedItemList<ISelector> checkedItemList = new CheckedItemList<ISelector>(); checkedItemList.AddRange(list.OrderBy(op => op.Name)); Selectors = checkedItemList.AsReadOnly(); Initialize(); }
public SymbolicExpressionGrammarView() { InitializeComponent(); symbols = new CheckedItemList<ISymbol>(); symbols.CheckedItemsChanged += new CollectionItemsChangedEventHandler<IndexedItem<ISymbol>>(symbols_CheckedItemsChanged); }
public SymbolicExpressionGrammarView() { InitializeComponent(); symbols = new CheckedItemList <ISymbol>(); symbols.CheckedItemsChanged += new CollectionItemsChangedEventHandler <IndexedItem <ISymbol> >(symbols_CheckedItemsChanged); }
protected DataAnalysisProblemData(IDataset dataset, IEnumerable<string> allowedInputVariables, IEnumerable<ITransformation> transformations = null) { if (dataset == null) throw new ArgumentNullException("The dataset must not be null."); if (allowedInputVariables == null) throw new ArgumentNullException("The allowedInputVariables must not be null."); if (allowedInputVariables.Except(dataset.DoubleVariables).Any()) throw new ArgumentException("All allowed input variables must be present in the dataset and of type double."); var inputVariables = new CheckedItemList<StringValue>(dataset.DoubleVariables.Select(x => new StringValue(x))); foreach (StringValue x in inputVariables) inputVariables.SetItemCheckedState(x, allowedInputVariables.Contains(x.Value)); int trainingPartitionStart = 0; int trainingPartitionEnd = dataset.Rows / 2; int testPartitionStart = dataset.Rows / 2; int testPartitionEnd = dataset.Rows; var transformationsList = new ItemList<ITransformation>(transformations ?? Enumerable.Empty<ITransformation>()); Parameters.Add(new FixedValueParameter<Dataset>(DatasetParameterName, "", (Dataset)dataset)); Parameters.Add(new FixedValueParameter<ReadOnlyCheckedItemList<StringValue>>(InputVariablesParameterName, "", inputVariables.AsReadOnly())); Parameters.Add(new FixedValueParameter<IntRange>(TrainingPartitionParameterName, "", new IntRange(trainingPartitionStart, trainingPartitionEnd))); Parameters.Add(new FixedValueParameter<IntRange>(TestPartitionParameterName, "", new IntRange(testPartitionStart, testPartitionEnd))); Parameters.Add(new FixedValueParameter<ReadOnlyItemList<ITransformation>>(TransformationsParameterName, "", transformationsList.AsReadOnly())); TransformationsParameter.Hidden = true; ((ValueParameter<Dataset>)DatasetParameter).ReactOnValueToStringChangedAndValueItemImageChanged = false; RegisterEventHandlers(); }
public TransformationContent(TransformationContent original, Cloner cloner) : base(original, cloner) { Data = original.Data; CheckedTransformationList = new CheckedItemList<ITransformation>(original.CheckedTransformationList); }
public ICheckedItemList<StringValue> CreateVariableItemList(IEnumerable<string> checkedItems = null) { ICheckedItemList<StringValue> itemList = new CheckedItemList<StringValue>(); foreach (string name in PreprocessingData.GetDoubleVariableNames()) { var n = new StringValue(name); itemList.Add(n, (checkedItems == null) ? true : checkedItems.Contains(name)); } return new ReadOnlyCheckedItemList<StringValue>(itemList); }
public TransformationContent(IPreprocessingData data, FilterLogic filterLogic) { Data = data; CheckedTransformationList = new CheckedItemList <ITransformation>(); FilterLogic = filterLogic; }
public TransformationContent(IPreprocessingData data, FilterLogic filterLogic) { Data = data; CheckedTransformationList = new CheckedItemList<ITransformation>(); FilterLogic = filterLogic; }
private void AfterDeserialization() { // BackwardsCompatibility3.3 #region Backwards compatible code, remove with 3.4 #pragma warning disable 0612 if (converters != null) { if (convertersList == null) convertersList = new CheckedItemList<IItemToSolutionMessageConverter>(); foreach (IItemToSolutionMessageConverter c in converters) convertersList.Add(c); converters.Clear(); converters = null; } #pragma warning restore 0612 #endregion RegisterEventHandlers(); }