示例#1
0
文件: Program.cs 项目: nofear/Mara
        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();
        }
示例#2
0
文件: Cover.cs 项目: nofear/Mara
 public Search( Cover cover )
     : base(cover.Solver)
 {
     m_Cover		= cover;
 }
示例#3
0
文件: Cover.cs 项目: nofear/Mara
 public AddIndex( Cover cover, int index )
     : base(cover.m_Solver)
 {
     m_Cover		= cover;
     m_Index		= index;
 }