当前位置: 首页>>代码示例>>C#>>正文


C# Class1.identify_main方法代码示例

本文整理汇总了C#中Class1.identify_main方法的典型用法代码示例。如果您正苦于以下问题:C# Class1.identify_main方法的具体用法?C# Class1.identify_main怎么用?C# Class1.identify_main使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Class1的用法示例。


在下文中一共展示了Class1.identify_main方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: IdentifyComputation

        public void IdentifyComputation()
        {
            //set generic simulator behavior - strategy
            //GenericSimulator.SimulatorBehavior = new MySincSimulatorBehavior2(); //useless - matlab DLL have different static instance
            try
            {
                BroadcastIdentifyStateMessage("Starting calculation ..." + DateTime.Now);
                logger.Log(NLog.LogLevel.Info, "starting calculation ");
                //invoke matlab Identification algorithm - does it use the GenericSimulator instance configured before???
                Class1 class1 = new Class1();
                logger.Log(NLog.LogLevel.Debug, "class1 init");
                //set experiment variables and values
                MWArray v_names = new MWCellArray(new MWCharArray(Enumerable.ToArray(variable_names)));
                MWArray experiment = new MWNumericArray(variable_values);
                //set identification parameters
                MWArray p_names = new MWCellArray(new MWCharArray(Enumerable.ToArray(parameters.Keys)));
                //set worker nodes urls
                //var host = AppHostBase.Instance.Config.ServiceEndpointsMetadataConfig.DefaultMetadataUri;
                //var myrepository = ((AppHostBase) EndpointHost.AppHost).Container.Resolve<WorkersRepository>();
                //MWArray worker_urls = new MWCellArray(new MWCharArray(myrepository.GetByModelName(modelname).Select(x => x.RestUrl).ToArray()));

                MWArray p_val = new MWNumericArray(parameters.Values.Select(parameter => parameter.Value).ToArray());
                MWArray p_min = new MWNumericArray(parameters.Values.Select(parameter => parameter.Min).ToArray());
                MWArray p_max = new MWNumericArray(parameters.Values.Select(parameter => parameter.Max).ToArray());
                MWArray p_is_fixed =
                    new MWLogicalArray(parameters.Values.Select(parameter => !parameter.IsActive).ToArray());
                //calculate identification
                Stopwatch sw = Stopwatch.StartNew();
                if (IAgenerations > 0) //set gaoptions
                {
                    MWArray generations = new MWNumericArray(IAgenerations);
                    MWArray populationsize = new MWNumericArray(IApopulationsize);
                    MWArray tolfun = new MWNumericArray(IAtolfun);
                    class1.identify_gaoptimset(generations, populationsize, tolfun);
                } //otherwise the matlab algorithm has it's own default values
                logger.Log(NLog.LogLevel.Debug, "mwarray init");
                var result = class1.identify_main(experiment, p_names, p_val, p_min, p_max, p_is_fixed, v_names, modelname, masterserviceurl);
                logger.Log(NLog.LogLevel.Debug, "identify_main done");
                sw.Stop();

                /*var fitted_params = result[1];
                var fitted_param_L2Enorm = result[2];
                var fitted_variablevalues = result[3];
                 * */
                //string fittedparams = "";
                //for (int i=1;i < fitted_params.
                //BroadcastIdentifyStateMessage("Elapsed time " + sw.Elapsed.ToString() + " Results: " + result);//fitted_params+" "+fitted_param_L2Enorm+" " + fitted_variablevalues);
                //var myresult = result.ToArray();

                BroadcastIdentifyResult(result.ToArray(),sw.Elapsed,class1.identify_getssq(),class1.identify_getcomputationcycles(),class1.identify_getsimulationtime());

            }
            catch (Exception e)
            {
                //TODO handle matlab exception
                BroadcastIdentifyStateMessage(e.Message+e.StackTrace);
                logger.Log(NLog.LogLevel.Error,"exception during identification "+e.Message+" stacktrace:"+e.StackTrace,e);
                var f = e;//.InnerException;
                while (f.InnerException != null)
                {
                    f = f.InnerException;
                    logger.Log(NLog.LogLevel.Error, "innerexception:" + f.Message + " stacktrace:" + f.StackTrace, f);
                }
            }
            //            StopIdentify();
            FinalizeIdentify();
        }
开发者ID:TomasKulhanek,项目名称:Physiovalues,代码行数:67,代码来源:IdentifyStateTicker.cs


注:本文中的Class1.identify_main方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。