Esempio n. 1
0
        private Process GetOnlineProcess(DataDescription data, int len, Experiment ex)
        {
            string  test = ex == Experiment.Precision ? "o" : "rt";
            Process proc = TemplateProcess();

            proc.StartInfo.FileName = EnvPath + "../cmake-build-debug/incCD";

            proc.StartInfo.Arguments = $"-alg ogdimpute -test {test} -n {data.N} -m {data.M} -k {AlgoPack.TypicalTruncation} " +
                                       $"-in ./{SubFolderDataIn}{data.Code}_m{len}.txt " +
                                       $"-out ./{SubFolderDataOut}{AlgCode}{len}.txt" + " -xtra stream";

            return(proc);
        }
Esempio n. 2
0
        private Process GetOfflineProcess(DataDescription data, int len, int k, Experiment ex)
        {
            string  test = ex == Experiment.Precision ? "o" : "rt";
            Process proc = TemplateProcess();

            proc.StartInfo.FileName = EnvPath + "../cmake-build-debug/incCD";

            proc.StartInfo.Arguments = $"-alg cd-ssv -test {test} -n {data.N} -m {data.M} -k {k} " +
                                       $"-in ./{SubFolderDataIn}{data.Code}_m{len}.txt " +
                                       $"-out ./{SubFolderDataOut}{AlgCode}{len}_k{k}.txt";

            return(proc);
        }
Esempio n. 3
0
        private Process GetRuntimeMDISVDProcess(DataDescription data, int len, bool stream)
        {
            Process isvdproc = new Process();

            isvdproc.StartInfo.WorkingDirectory = EnvPath;
            isvdproc.StartInfo.FileName         = EnvPath + "../cmake-build-debug/incCD";
            isvdproc.StartInfo.CreateNoWindow   = true;
            isvdproc.StartInfo.WindowStyle      = ProcessWindowStyle.Hidden;
            isvdproc.StartInfo.UseShellExecute  = false;

            isvdproc.StartInfo.Arguments = $"-alg mdisvd -test rt -n {data.N} -m {data.M} -k {AlgoPack.TypicalTruncation} " +
                                           $"-in ./{SubFolderDataIn}{data.Code}_m{len}.txt " +
                                           $"-out ./{SubFolderDataOut}{AlgCode}{len}.txt " + (stream ? "-xtra stream" : "");

            return(isvdproc);
        }
Esempio n. 4
0
        private Process GetRuntimeSpiritProcess(DataDescription data, int tcase, bool streaming)
        {
            Process spiritproc = new Process();

            spiritproc.StartInfo.WorkingDirectory = EnvPath;
            spiritproc.StartInfo.FileName         = EnvPath + "../cmake-build-debug/algoCollection";
            spiritproc.StartInfo.CreateNoWindow   = true;
            spiritproc.StartInfo.WindowStyle      = ProcessWindowStyle.Hidden;
            spiritproc.StartInfo.UseShellExecute  = false;

            spiritproc.StartInfo.Arguments = $"-alg spirit -test rt -n {data.N} -m {data.M} -k {Truncation} " +
                                             $"-in ./{SubFolderDataIn}{data.Code}_m{tcase}.txt " +
                                             $"-out ./{SubFolderDataOut}{AlgCode}{tcase}.txt";

            return(spiritproc);
        }
Esempio n. 5
0
        private Process GetRuntimeOGDProcess(DataDescription data, int len)
        {
            Process ogdproc = new Process();

            ogdproc.StartInfo.WorkingDirectory = EnvPath;
            ogdproc.StartInfo.FileName         = EnvPath + "../cmake-build-debug/incCD";
            ogdproc.StartInfo.CreateNoWindow   = true;
            ogdproc.StartInfo.WindowStyle      = ProcessWindowStyle.Hidden;
            ogdproc.StartInfo.UseShellExecute  = false;

            ogdproc.StartInfo.Arguments = $"-alg ogdimpute -test rt -n {data.N} -m {data.M} -k {AlgoPack.TypicalTruncation} " +
                                          $"-in ./{SubFolderDataIn}{data.Code}_m{len}.txt " +
                                          $"-out ./{SubFolderDataOut}{AlgCode}{len}.txt";

            return(ogdproc);
        }
Esempio n. 6
0
        private Process GetRuntimeTrmfProcess(DataDescription data, int len)
        {
            Process trmfproc = new Process();

            trmfproc.StartInfo.WorkingDirectory = EnvPath;
            trmfproc.StartInfo.FileName         = "octave-cli";
            trmfproc.StartInfo.CreateNoWindow   = true;
            trmfproc.StartInfo.WindowStyle      = ProcessWindowStyle.Hidden;
            trmfproc.StartInfo.UseShellExecute  = false;

            string functionArgs = $"{len}, '{data.Code}', {Truncation}";

            trmfproc.StartInfo.Arguments = $"--eval \"experimentRun({functionArgs}, 1, {Truncation})\"";

            return(trmfproc);
        }
        private Process GetCdProcess(int n, int m, DataDescription data, int len, int k)
        {
            Process cdproc = new Process();

            cdproc.StartInfo.WorkingDirectory = EnvPath;
            cdproc.StartInfo.FileName         = EnvPath + "../cmake-build-debug/algoCollection";
            cdproc.StartInfo.CreateNoWindow   = true;
            cdproc.StartInfo.WindowStyle      = ProcessWindowStyle.Hidden;
            cdproc.StartInfo.UseShellExecute  = false;

            cdproc.StartInfo.Arguments = $"-test r -n {n} -m {m} -k {k} " +
                                         $"-in ./{SubFolderDataIn}{data.Code}_m{len}.txt " +
                                         $"-out ./{SubFolderDataOut}{AlgCode}{len}_k{k}.txt";

            return(cdproc);
        }
Esempio n. 8
0
        private Process GetRuntimeROSLProcess(DataDescription data, int len)
        {
            Process roslproc = new Process();

            roslproc.StartInfo.WorkingDirectory = EnvPath;
            roslproc.StartInfo.FileName         = EnvPath + "../cmake-build-debug/algoCollection";
            roslproc.StartInfo.CreateNoWindow   = true;
            roslproc.StartInfo.WindowStyle      = ProcessWindowStyle.Hidden;
            roslproc.StartInfo.UseShellExecute  = false;

            roslproc.StartInfo.Arguments = $"-alg rosl -test rt -n {data.N} -m {data.M} -k {Truncation} " +
                                           $"-in ./{SubFolderDataIn}{data.Code}_m{len}.txt " +
                                           $"-out ./{SubFolderDataOut}{AlgCode}{len}.txt";

            return(roslproc);
        }
        private Process GetRuntimeprocess(DataDescription data, int len)
        {
            Process proc = new Process();

            proc.StartInfo.WorkingDirectory = EnvPath;
            proc.StartInfo.FileName         = "python2";
            proc.StartInfo.CreateNoWindow   = true;
            proc.StartInfo.WindowStyle      = ProcessWindowStyle.Hidden;
            proc.StartInfo.UseShellExecute  = false;

            string functionArgs = $"--input \"{SubFolderDataIn}{data.Code}_m{len}.txt\" --output \"{SubFolderDataOut}{AlgCode}{len}.txt\"";

            proc.StartInfo.Arguments = $"main.py --epochs {Epochs} --batch_size 64 --model brits_i_univ {functionArgs} --runtime 1";

            return(proc);
        }
        private Process GetRuntimeMRNNProcess(DataDescription data, int len)
        {
            Process mrnnproc = new Process();

            mrnnproc.StartInfo.WorkingDirectory = EnvPath;
            mrnnproc.StartInfo.FileName         = "python";
            mrnnproc.StartInfo.CreateNoWindow   = true;
            mrnnproc.StartInfo.WindowStyle      = ProcessWindowStyle.Hidden;
            mrnnproc.StartInfo.UseShellExecute  = false;

            string functionArgs = $"\"{SubFolderDataIn}{data.Code}_m{len}.txt\", \"{SubFolderDataOut}{AlgCode}{len}.txt\", 1";

            mrnnproc.StartInfo.Arguments = "-c 'from testerMRNN import mrnn_recov; " +
                                           $"mrnn_recov({functionArgs})'";

            return(mrnnproc);
        }
Esempio n. 11
0
        private Process GetProcess(DataDescription data, int len, bool runtime)
        {
            Process proc = new Process();

            proc.StartInfo.WorkingDirectory = EnvPath;
            proc.StartInfo.FileName         = "python";
            proc.StartInfo.CreateNoWindow   = true;
            proc.StartInfo.WindowStyle      = ProcessWindowStyle.Hidden;
            proc.StartInfo.UseShellExecute  = false;

            string functionArgs = $"\"{SubFolderDataIn}{data.Code}_m{len}.txt\", \"{SubFolderDataOut}{AlgCode}{len}.txt\", {(runtime ? 1 : 0)}";

            proc.StartInfo.Arguments = "-c 'from recovery import rmv_main; " +
                                       $"rmv_main(\"{AlgCode}\", {functionArgs})'";

            return(proc);
        }
Esempio n. 12
0
        private Process GetRuntimeStmvlProcess(int finalN, int finalM, DataDescription data, int len)
        {
            Process stmvlproc = new Process();

            stmvlproc.StartInfo.WorkingDirectory = EnvPath;
            stmvlproc.StartInfo.FileName         = EnvPath + "../cmake-build-debug/algoCollection";
            stmvlproc.StartInfo.CreateNoWindow   = true;
            stmvlproc.StartInfo.WindowStyle      = ProcessWindowStyle.Hidden;
            stmvlproc.StartInfo.UseShellExecute  = false;

            stmvlproc.StartInfo.Arguments = $"-alg st-mvl -test rt -n {data.N} -m {data.M} -k {(int)(Alpha * 1000.0)} " +
                                            $"-xtra {SubFolderDataIn}{data.Code}_m{len}_latlng.txt " +
                                            $"-in ./{SubFolderDataIn}{data.Code}_m{len}.txt " +
                                            $"-out ./{SubFolderDataOut}{AlgCode}{len}.txt";

            return(stmvlproc);
        }
Esempio n. 13
0
        private Process GetSVTProcess(DataDescription data, int len)
        {
            Process svtproc = new Process();

            svtproc.StartInfo.WorkingDirectory = EnvPath;
            svtproc.StartInfo.FileName         = EnvPath + "../cmake-build-debug/algoCollection";
            svtproc.StartInfo.CreateNoWindow   = true;
            svtproc.StartInfo.WindowStyle      = ProcessWindowStyle.Hidden;
            svtproc.StartInfo.UseShellExecute  = false;

            svtproc.StartInfo.Arguments = $"-alg svt -test o -n {data.N} -m {data.M} -k {AlgoPack.TypicalTruncation} " +
                                          $"-in ./{SubFolderDataIn}{data.Code}_m{len}.txt " +
                                          $"-out ./{SubFolderDataOut}{AlgCode}{len}.txt " +
                                          $"-xtra {TauScale}";

            return(svtproc);
        }
Esempio n. 14
0
        private Process GetRuntimeSSAProcess(DataDescription data, int len)
        {
            Process ssaproc = new Process();

            ssaproc.StartInfo.WorkingDirectory = EnvPath;
            ssaproc.StartInfo.FileName         = "python";
            ssaproc.StartInfo.CreateNoWindow   = true;
            ssaproc.StartInfo.WindowStyle      = ProcessWindowStyle.Hidden;
            ssaproc.StartInfo.UseShellExecute  = false;

            string functionArgs = $"\"{SubFolderDataIn}{data.Code}_m{len}_ts.txt\", \"{SubFolderDataIn}{data.Code}_m{len}.txt\", \"{SubFolderDataOut}{AlgCode}{len}.txt\", 1, 2";

            ssaproc.StartInfo.Arguments = "-c 'from testScriptSynthControlALS import rmv_mydata; " +
                                          $"rmv_mydata({functionArgs})'";

            return(ssaproc);
        }
Esempio n. 15
0
        private void TypeReferencer(DataDescription dataEntry)
        {
            //Check SymbolTable for dataEntry DataType.Name
            var types = dataEntry.SymbolTable.GetType(dataEntry.DataType);

            if (types.Count != 1)
            {
                return;
            }

            //Add this dataEntry to type references
            var typeToUpdate = types.First();

            if (typeToUpdate == null)
            {
                return;
            }

            typeToUpdate.References.Add(dataEntry);
        }
        private void CheckVariableDeclarations()
        {
            // Find all source/sources and give them types or references to definitions
            foreach (Identifier id in _program.VariableReferences)
            {
                //Identifier id = program.VariableReferences[key] as Identifier;
                DataDescription definition = _program.VariableDeclarations[id.Name] as DataDescription;
                ClassDefinition classDef;
                if (definition == null)
                {
                    //Console.WriteLine("No VariableDeclaration for "+id.Name);
                    //Check class defs
                    if (_program.Environment != null)
                    {
                        if (_program.Environment.ConfigurationSection != null)
                        {
                            if (_program.Environment.ConfigurationSection.Repository != null)
                            {
                                classDef = _program.ClassDeclarations[id.Name] as ClassDefinition;
                                if (classDef != null)
                                {
                                    id.ClassDefinition = classDef;
                                    continue;
                                }
                            }
                        }
                    }
                    //Built-in identifiers...
                    switch (id.Name.ToUpper())
                    {
                    case "ZERO":
                        break;

                    default:
                        throw new UndefinedVariableException(id.LineNumber, id.Name);
                    }
                }
                id.Definition = definition;
            }
        }
        private Process GetProcess(DataDescription data, int len, bool runtime)
        {
            Process proc = new Process();

            proc.StartInfo.WorkingDirectory = EnvPath;
            proc.StartInfo.FileName         = "octave-cli";
            proc.StartInfo.CreateNoWindow   = true;
            proc.StartInfo.WindowStyle      = ProcessWindowStyle.Hidden;
            proc.StartInfo.UseShellExecute  = false;

            string functionArgs = $"'{SubFolderDataIn}{data.Code}_m{len}.txt', '{SubFolderDataOut}{AlgCode}{len}.txt', {(runtime ? 1 : 0)}";

            if (proc.StartInfo.FileName.Contains("octave"))
            {
                proc.StartInfo.Arguments = $"--eval \"recovery('{AlgCode}', {functionArgs})\"";
            }
            else
            {
                proc.StartInfo.Arguments = $"-nodisplay -r \"recovery('{AlgCode}', {functionArgs})\"";
            }

            return(proc);
        }
Esempio n. 18
0
        private void AddToSymbolTable(DataDescription node)
        {
            var table = node.SymbolTable;

            if (node.CodeElement().IsGlobal&& table.CurrentScope != SymbolTable.Scope.GlobalStorage)
            {
                table = table.GetTableFromScope(SymbolTable.Scope.Global);
            }
            else
            {
                var parent = node.Parent as DataDescription;
                while (parent != null)
                {
                    if (parent.CodeElement().IsGlobal&& table.CurrentScope != SymbolTable.Scope.GlobalStorage)
                    {
                        table = table.GetTableFromScope(SymbolTable.Scope.Global);
                    }
                    parent = parent.Parent as DataDescription;
                }
            }

            table.AddVariable(node);
        }
Esempio n. 19
0
 protected override void PrecisionExperiment(ExperimentType et, ExperimentScenario es,
                                             DataDescription data, int tcase)
 {
     RunNnmf(GetNnmfProcess(data, tcase, "False", "False"));
 }
Esempio n. 20
0
 protected override void RuntimeExperiment(ExperimentType et, ExperimentScenario es, DataDescription data,
                                           int tcase)
 {
     if (et == ExperimentType.Streaming)
     {
         RunTkcm(GetStreamingTkcmProcess(data, tcase, es));
     }
     else
     {
         RunTkcm(GetRuntimeTkcmProcess(data, tcase, es));
     }
 }
Esempio n. 21
0
 protected override void RuntimeExperiment(ExperimentType et, ExperimentScenario es, DataDescription data,
                                           int tcase)
 {
     Run(et == ExperimentType.Streaming
         ? GetOnlineProcess(data, tcase, Experiment.Runtime)
         : GetOfflineProcess(data, tcase, Experiment.Runtime));
 }
Esempio n. 22
0
 public TypedDataNode(DataDescription node)
     : base(null)
 {
     this.Node = node;
 }
Esempio n. 23
0
 protected override void PrecisionExperiment(ExperimentType et, ExperimentScenario es,
                                             DataDescription data, int tcase)
 {
     RunTkcm(GetTkcmProcess(data, tcase, es));
 }
Esempio n. 24
0
 protected abstract void RuntimeExperiment(ExperimentType et, ExperimentScenario es, DataDescription data, int tcase);
Esempio n. 25
0
 protected override void RuntimeExperiment(ExperimentType et, ExperimentScenario es, DataDescription data,
                                           int tcase)
 {
     RunSSA(GetRuntimeSSAProcess(data, tcase));
 }
Esempio n. 26
0
 protected override void PrecisionExperiment(ExperimentType et, ExperimentScenario es,
                                             DataDescription data, int tcase)
 {
     RunSVDImpute(GetSVDImputeProcess(data, tcase));
 }
Esempio n. 27
0
 // [/COBOL 2002]
 private void EnterDataDescriptionEntry(DataDescriptionEntry data)
 {
     SetCurrentNodeToTopLevelItem(data.LevelNumber.Value);
     var node = new DataDescription(data);
     Enter(node);
     if (!node.IsPartOfATypeDef) node.SymbolTable.AddVariable(node);
 }
Esempio n. 28
0
 protected override void PrecisionExperiment(ExperimentType et, ExperimentScenario es,
                                             DataDescription data, int tcase)
 {
     RunDynaMMo(GetDynaMMoProcess(data, tcase));
 }
 protected override void PrecisionExperiment(ExperimentType et, ExperimentScenario es,
                                             DataDescription data, int tcase)
 {
     KList.ForEach(k => RunCd(GetCdProcess(data.N, data.M, data, tcase, k)));
 }
Esempio n. 30
0
 private void EnterDataDescriptionEntry(DataDescriptionEntry data)
 {
     SetCurrentNodeToTopLevelItem(data.LevelNumber);
     var node = new DataDescription(data);
     Enter(node);
     AddToSymbolTable(node);
 }
        public DataDescription[] GetSubItems()
        {
            Log.Debug($"GetSubItems called on path {Path}");

            if (Path == null || Path == OPCEventFlowBehavior.SNAPSHOT_DATA) // If we're at the top, just return all server names:
            {
                return(opcServerOrm.Fetch()
                       .Select(x => new DataDescription(typeof(OPCDataProvider), x.GetEntity().EntityName, false)
                {
                    NestedVariableName = x.GetEntity().EntityName
                }).ToArray());
            }

            string[] pathSplit = Path.Split(new char[] { '.' }, 2); // {Server Name}.{remaining.tag.path}

            DynamicORM orm = new DynamicORM();

            HashSet <string>       nextPaths = new HashSet <string>();
            List <DataDescription> dds       = new List <DataDescription>();

            foreach (string key in OPCEngine.mostRecentValues.Keys) // keys are like "<guid>|Channel1.Device1.Tag1"
            {
                string[] keySplit   = key.Split('|');
                string   eventId    = keySplit[0];
                string   keyTagPath = keySplit[1];
                OPCEvent ev         = orm.Fetch(typeof(OPCEvent), eventId) as OPCEvent;
                if (ev == null)
                {
                    throw new Exception("OPCEvent not found with id " + eventId);
                }
                string serverName = (orm.Fetch(typeof(Folder), ev.EntityFolderID) as Folder)?.EntityName;
                if (string.IsNullOrEmpty(serverName))
                {
                    throw new Exception("Server name not found");
                }

                if (serverName != pathSplit[0])
                {
                    continue;
                }

                if (pathSplit.Length == 1) // This is the node for the server, so include everything under it:
                {
                    nextPaths.Add(keyTagPath.Split('.')[0]);
                }
                else
                {
                    // If "Channel1.Device1.Tag1" starts with "Channel1.Device1", for example:
                    if (keyTagPath.StartsWith(pathSplit[1]))
                    {
                        string   remainingPath  = keyTagPath.Substring(pathSplit[1].Length + 1); // "Tag1"
                        string[] splitRemaining = remainingPath.Split('.');
                        if (splitRemaining.Length == 1)                                          // This is a tag, so find its type
                        {
                            BaseTagValue tagValue;
                            if (!OPCEngine.mostRecentValues.TryGetValue(key, out tagValue))
                            {
                                throw new Exception("Could not find type for tag " + key);
                            }

                            if (dds.Any(d => d.Name == splitRemaining[0])) // Don't create duplicates - most recent value will be used.
                            {
                                continue;
                            }

                            DataDescription dd = TagValueUtils.GetDataDescriptionFromTagType(tagValue.GetType(), splitRemaining[0]);
                            dd.NestedVariableName = $"{this.Path}.{splitRemaining[0]}";
                            dds.Add(dd);
                        }
                        else
                        {
                            nextPaths.Add(splitRemaining[0]);
                        }
                    }
                }
            }

            foreach (string nextPath in nextPaths)
            {
                dds.Add(new DataDescription(typeof(OPCDataProvider), nextPath, false)
                {
                    NestedVariableName = $"{this.Path}.{nextPath}"
                });
            }

            return(dds.ToArray());
        }
Esempio n. 32
0
 public override bool Visit(DataDescription dataEntry)
 {
     TypeReferencer(dataEntry);
     return(base.Visit(dataEntry));
 }
Esempio n. 33
0
 // [/COBOL 2002]
 private void AddToSymbolTable(DataDescription node)
 {
     if (node.IsPartOfATypeDef) return;
     var table = node.SymbolTable;
     if (node.CodeElement().IsGlobal)
         while(table.CurrentScope != SymbolTable.Scope.Global)
             table = table.EnclosingScope;
     table.AddVariable(node);
 }
Esempio n. 34
0
        public virtual void StartDataDescriptionEntry(DataDescriptionEntry entry)
        {
            var dataTypeDescriptionEntry = entry as DataTypeDescriptionEntry;

            if (dataTypeDescriptionEntry != null)
            {
                StartTypeDefinitionEntry(dataTypeDescriptionEntry);
            }
            else
            {
                SetCurrentNodeToTopLevelItem(entry.LevelNumber);

                //Update DataType of CodeElement by searching info on the declared Type into SymbolTable.
                //Note that the AST is not complete here, but you can only refer to a Type that has previously been defined.
                var node = new DataDescription(entry);
                if (_CurrentTypeDefinition != null)
                {
                    node.ParentTypeDefinition = _CurrentTypeDefinition;
                }
                Enter(node);

                if (entry.Indexes != null && entry.Indexes.Any())
                {
                    var table = node.SymbolTable;
                    foreach (var index in entry.Indexes)
                    {
                        if (node.CodeElement().IsGlobal)
                        {
                            table = table.GetTableFromScope(SymbolTable.Scope.Global);
                        }

                        var indexNode = new IndexDefinition(index);
                        Enter(indexNode, null, table);
                        if (_CurrentTypeDefinition != null)
                        {
                            indexNode.ParentTypeDefinition = _CurrentTypeDefinition;
                        }
                        table.AddVariable(indexNode);
                        Exit();
                    }
                }

                var types = node.SymbolTable.GetType(node);
                if (types.Count == 1)
                {
                    entry.DataType.RestrictionLevel = types[0].DataType.RestrictionLevel;
                }
                //else do nothing, it's an error that will be handled by Cobol2002Checker

                if (_IsInsideWorkingStorageContext)
                {
                    node.SetFlag(Node.Flag.WorkingSectionNode, true);      //Set flag to know that this node belongs to Working Storage Section
                }
                if (_IsInsideLinkageSectionContext)
                {
                    node.SetFlag(Node.Flag.LinkageSectionNode, true);      //Set flag to know that this node belongs to Linkage Section
                }
                if (_IsInsideLocalStorageSectionContext)
                {
                    node.SetFlag(Node.Flag.LocalStorageSectionNode, true); //Set flag to know that this node belongs to Local Storage Section
                }
                if (_IsInsideFileSectionContext)
                {
                    node.SetFlag(Node.Flag.FileSectionNode, true);         //Set flag to know that this node belongs to File Section
                }
                if (_IsInsideGlobalStorageSection)
                {
                    node.SetFlag(Node.Flag.GlobalStorageSection, true);         //Set flag to know that this node belongs to Global Storage Section
                }
                AddToSymbolTable(node);
            }
        }