Esempio n. 1
0
        private static void Cover1()
        {
            ExactCover ec = new ExactCover( 8 );
            ec.Add( new int[] { 1, 0, 0, 0, 0, 0, 0, 0 }, "0" );
            ec.Add( new int[] { 0, 1, 0, 0, 0, 0, 0, 0 }, "1" );
            ec.Add( new int[] { 0, 0, 1, 0, 0, 0, 0, 0 }, "2" );
            ec.Add( new int[] { 0, 0, 0, 1, 0, 0, 0, 0 }, "3" );
            ec.Add( new int[] { 0, 0, 0, 0, 1, 0, 0, 0 }, "4" );
            ec.Add( new int[] { 0, 0, 0, 0, 0, 1, 0, 0 }, "5" );
            ec.Add( new int[] { 0, 0, 0, 0, 0, 0, 1, 0 }, "6" );
            ec.Add( new int[] { 0, 0, 0, 0, 0, 0, 0, 1 }, "7" );

            ec.Add( new int[] { 1, 1, 0, 0, 0, 0, 0, 0 }, "8" );
            ec.Add( new int[] { 0, 1, 1, 0, 0, 0, 0, 0 }, "9" );
            ec.Add( new int[] { 0, 0, 1, 1, 0, 0, 0, 0 }, "10" );
            ec.Add( new int[] { 0, 0, 0, 1, 1, 0, 0, 0 }, "11" );
            ec.Add( new int[] { 0, 0, 0, 0, 1, 1, 0, 0 }, "12" );
            ec.Add( new int[] { 0, 0, 0, 0, 0, 1, 1, 0 }, "13" );
            ec.Add( new int[] { 0, 0, 0, 0, 0, 0, 1, 1 }, "14" );

            ec.Add( new int[] { 1, 1, 1, 1, 0, 0, 0, 0 }, "15" );
            ec.Add( new int[] { 0, 0, 0, 0, 1, 1, 1, 1 }, "16" );

            Cover cover = new Cover( ec.Solver, 8, ec.List );
            Cover.Search goal = new Cover.Search( cover );

            ec.Solver.Solve( goal );
            ec.Solver.Out.WriteLine( cover.Index.Domain.Cardinality.ToString() + "\t" + cover.Index.ToString() );

            while( ec.Solver.Next() )
            {
                ec.Solver.Out.WriteLine( cover.Index.Domain.Cardinality.ToString() + "\t" + cover.Index.ToString() );
            }

            ec.Solver.PrintInformation();
        }
Esempio n. 2
0
File: Cover.cs Progetto: nofear/Mara
 public Search( Cover cover )
     : base(cover.Solver)
 {
     m_Cover		= cover;
 }
Esempio n. 3
0
File: Cover.cs Progetto: nofear/Mara
 public AddIndex( Cover cover, int index )
     : base(cover.m_Solver)
 {
     m_Cover		= cover;
     m_Index		= index;
 }