Esempio n. 1
0
        private OptimizedParameterDTO mapFrom(OptimizedParameterValue optimizedParameterValue, ParameterIdentification parameterIdentification)
        {
            var identificationParameter = parameterIdentification.IdentificationParameterByName(optimizedParameterValue.Name);

            if (identificationParameter == null)
            {
                return(null);
            }

            return(mapFrom(identificationParameter, optimizedParameterValue.Value, optimizedParameterValue.StartValue));
        }
Esempio n. 2
0
        private IEnumerable <ParameterConfidenceIntervalDTO> mapFrom(ICache <string, double> confidenceInterval, ParameterIdentification parameterIdentification, ParameterIdentificationRunResult runResult)
        {
            if (!confidenceInterval.Any())
            {
                return(Enumerable.Empty <ParameterConfidenceIntervalDTO>());
            }

            return(from optimizedParameter in runResult.BestResult.Values
                   let identificationParameter = parameterIdentification.IdentificationParameterByName(optimizedParameter.Name)
                                                 where identificationParameter?.Dimension != null
                                                 select confidenceIntervalDTOFrom(confidenceInterval, identificationParameter, optimizedParameter));
        }
Esempio n. 3
0
        public ICommand TransferParametersFrom(ParameterIdentification parameterIdentification, ParameterIdentificationRunResult runResult)
        {
            if (runResult.Status == RunStatus.Canceled)
            {
                var res = _dialogCreator.MessageBoxYesNo(Warning.ImportingParameterIdentificationValuesFromCancelledRun);
                if (res == ViewResult.No)
                {
                    return(new OSPSuiteEmptyCommand <TExecutionContext>());
                }
            }

            if (parameterIdentification.IsCategorialRunMode())
            {
                _dialogCreator.MessageBoxInfo(Warning.ImportingParameterIdentificationValuesFromCategorialRun);
            }

            var macroCommand = new OSPSuiteMacroCommand <TExecutionContext>
            {
                BuildingBlockType = ObjectTypes.Simulation,
                CommandType       = Command.CommandTypeEdit,
                ObjectType        = ObjectTypes.Simulation,
                Description       = Captions.ParameterIdentification.ParameterIdentificationTransferredToSimulations(parameterIdentification.Name)
            };

            foreach (var optimizedParameter in runResult.BestResult.Values)
            {
                var identificationParameter = parameterIdentification.IdentificationParameterByName(optimizedParameter.Name);
                if (identificationParameter == null)
                {
                    throw new OSPSuiteException(Error.IdentificationParameterCannotBeFound(optimizedParameter.Name));
                }

                macroCommand.AddRange(setOptimalParameterValueIn(identificationParameter, optimizedParameter.Value));
            }

            macroCommand.AddRange(parameterIdentification.AllFixedIdentificationParameters.SelectMany(x => setOptimalParameterValueIn(x, x.StartValue)));

            return(macroCommand);
        }