Пример #1
0
        /// <summary>
        /// Creates a log file with a single incidence matrix
        /// Log file starts with v and b
        /// UNIX line endings
        /// </summary>
        /// <param name="logPath">Path of the log file</param>
        public static void CreateLogFile(string logPath, SteinerTripleSystem sts)
        {
            path = logPath;

            using (StreamWriter streamWriter = new StreamWriter(path, false))
            {
                //Write v and b to the first line of the logfile
                streamWriter.Write(sts.NumVertex().ToString() +" " + sts.NumTriples().ToString() + "\n");
                streamWriter.Write("\n");
            }

            AppendIncidenceMatrix(sts);
        }
        /// <summary>
        /// Removes a random number of blocks from the decomposition.
        /// </summary>
        private void RemoveRandBlocks(SteinerTripleSystem sts)
        {
            Random rand = new Random();

            for (int i = 0; i < sts.NumTriples(); i++)
            {
                bool removeBlock = rand.NextDouble() > ALPHA;

                if (removeBlock)
                {
                    Triple triple = sts.GetElement(i);
                    RemoveBlock(triple.X, triple.Y, triple.Z);
                }
            }
        }