Пример #1
0
        public TruthTableValues Simplify()
        {
            /* Get a clone version of the table that is going to be simplified */
            var Simplified = this.Value.Clone() as TruthTableValues;

            /* CalculatePrimeImplicants the prime implicant values with the QuineMcCluskey algorithm*/
            var primeImplicants = QuineMcCluskey.SimplifyTable(Simplified);

            /* Get the number of rows so we can iterate through them and remove the positive results from the table */
            int numberOfRows = Simplified.First().Value.Count();

            /* Remove the positive resulte from the table */
            for (int i = 0; i < numberOfRows; i++)
            {
                var currentRow = i - (numberOfRows - Simplified.First().Value.Count);
                if (Simplified[Simplified.Keys.Last()][currentRow] == "1")
                {
                    Simplified.DeleteRowValues(currentRow);
                }
            }

            /* Fill the prime implicant values into the table*/
            foreach (var res in primeImplicants)
            {
                Simplified[Simplified.Keys.Last()].Add("1");
                for (int i = 0; i < res.RowData.Length; i++)
                {
                    Simplified.ElementAt(i).Value.Add(res.RowData[i].ToString());
                }
            }

            return(Simplified);
        }
Пример #2
0
        private void btnExecutar_Click(object sender, EventArgs e)
        {
            // Carrega todos os Mintermos e Don't Cares do arquivo TXT
            List <Mintermo> ColunaMintermos = ViewMain.CarregarMintermosSoap(caminhoArquivo);

            // Executa o Método responsável pelo Quine McCluskey
            QuineMcCluskey Quine = new QuineMcCluskey(ViewMain.numeroVariaveis);

            Quine.Executa(ColunaMintermos, txtLog);
        }