Ejemplo n.º 1
0
        /// <summary>
        /// Displays the selected strategy parameters
        /// </summary>
        /// <param name="optimizeStrategy">Contains info regarding the strategy to be optimized</param>
        private void DisplaySelectedStrategy(OptimizationParametersBruteForce optimizeStrategy)
        {
            try
            {
                if (Logger.IsDebugEnabled)
                {
                    Logger.Debug("Displaying the strategy parameters", _type.FullName, "DisplaySelectedStrategy");
                }

                _parameters.Clear();

                // Get Strategy Info
                StrategyInfo = LoadCustomStrategy.GetCustomClassSummary(optimizeStrategy.StrategyType);

                // Save Ctor Arguments
                _ctorArguments = optimizeStrategy.CtorArguments;

                // Save Custom Strategy Type
                _strategyType = optimizeStrategy.StrategyType;

                // Save Parameters Details
                _parmatersDetails = optimizeStrategy.ParameterDetails;

                // Get all parameters
                for (int i = 0; i < optimizeStrategy.CtorArguments.Length; i++)
                {
                    ParameterInfo parameterInfo = new ParameterInfo
                    {
                        Index     = i,
                        Parameter = optimizeStrategy.ParameterDetails[i].Name,
                        Value     = optimizeStrategy.CtorArguments[i].ToString()
                    };

                    _currentDispatcher.Invoke(DispatcherPriority.Normal, (Action)(() =>
                    {
                        // Add to collection
                        _parameters.Add(parameterInfo);
                    }));
                }
            }
            catch (Exception exception)
            {
                Logger.Error(exception, _type.FullName, "DisplaySelectedStrategy");
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Starts optimization of the strategy using Brute Force
        /// </summary>
        /// <param name="ctrArgs">Arguments to be used to execute strategy</param>
        private void RunStrategyOptimizationBruteForce(object[] ctrArgs)
        {
            // Get View to display details for optimization engine
            var context = ContextRegistry.GetContext();

            _optimizationShell = context.GetObject("OptimizationShell") as Shell;

            if (_optimizationShell != null)
            {
                _optimizationShell.Show();

                // Create new object to use with Event Aggregator
                OptimizationParametersBruteForce optimizeStrategy = new OptimizationParametersBruteForce(_strategyType, ctrArgs, _parmatersInfo);

                // Publish Event to Notify Listeners
                EventSystem.Publish <OptimizationParametersBruteForce>(optimizeStrategy);
            }
        }