예제 #1
0
 public FltVarMatrix(Solver solver, int rowCount, int colCount, FltVarList list) :
     base(solver)
 {
     m_VarList  = list;
     m_RowCount = rowCount;
     m_ColCount = colCount;
 }
예제 #2
0
파일: FltVarMatrix.cs 프로젝트: nofear/Mara
        public FltVarMatrix( Solver solver, int rowCount, int colCount, FltDomain domain )
            : base(solver)
        {
            m_VarList		= null;
            m_RowCount		= rowCount;
            m_ColCount		= colCount;

            InitMatrix( domain );
        }
예제 #3
0
        public FltVarList Col(int vcol)
        {
            FltVarList list = new FltVarList(m_Solver);

            for (int row = 0; row < m_RowCount; ++row)
            {
                list.Add(Cell(row, vcol));
            }

            return(list);
        }
예제 #4
0
        public FltVarList Row(int vrow)
        {
            FltVarList list = new FltVarList(m_Solver);

            for (int col = 0; col < m_ColCount; ++col)
            {
                list.Add(Cell(vrow, col));
            }

            return(list);
        }
예제 #5
0
        public FltVarMatrix Matrix(int rowOffset, int colOffset, int rowCount, int colCount)
        {
            FltVarList list = new FltVarList(m_Solver);

            for (int row = 0; row < rowCount; ++row)
            {
                for (int col = 0; col < colCount; ++col)
                {
                    list.Add(Cell(rowOffset + row, colOffset + col));
                }
            }

            return(new FltVarMatrix(m_Solver, rowCount, colCount, list));
        }
예제 #6
0
        private void InitMatrix(FltDomain domain)
        {
            m_VarList = new FltVarList(m_Solver, m_RowCount * m_ColCount);

            for (int row = 0; row < m_RowCount; ++row)
            {
                for (int col = 0; col < m_ColCount; ++col)
                {
                    string name = row.ToString() + "." + col.ToString();

                    FltVar cell = new FltVar(m_Solver, domain, name);

                    m_VarList.Add(cell);
                }
            }
        }
예제 #7
0
        public FltVarList DiagRightTopToBottomLeft()
        {
            FltVarList list = new FltVarList(m_Solver);

            if (m_RowCount == m_ColCount)
            {
                int size = m_RowCount;

                for (int idx = 0; idx < size; ++idx)
                {
                    list.Add(Cell(idx, (size - 1) - idx));
                }
            }

            return(list);
        }
예제 #8
0
        public void Test()
        {
            Solver solver	= new Solver( -1000, 1000 );
            FltVar i0	= new FltVar( solver, 0, 10 );
            FltVar i1	= new FltVar( solver, 10, 20 );
            FltVar i2	= new FltVar( solver, 20, 30 );
            FltVar s	= new FltVar( solver, 30, 60 );

            FltVarList list		= new FltVarList( solver, new FltVar[] { i0, i1, i2 } );
            FltVarListSum sum	= list.Sum();

            solver.Add( sum );
            solver.Propagate();

            Assert.AreEqual( s.Domain, sum.Var0.Domain );
        }
예제 #9
0
        public void Test()
        {
            Solver solver	= new Solver( -1000, 1000 );
            FltVar a	= new FltVar( solver, -10, -5, "a" );
            FltVar b	= new FltVar( solver, -1, 1, "b" );
            FltVar c	= new FltVar( solver, 5, 10, "c" );
            FltVarList list	= new FltVarList( solver, new FltVar[] { a, b, c } );

            IntVar index			= new IntVar( solver );
            FltVarListIndex cons	= list.At( index );
            FltVar result			= cons.Var0;

            solver.Add( cons );
            solver.Propagate();

            result.Intersect( -8, 8 );
            result.Difference( -2, 6 );
            cons.Index.Difference( 1 );
        }
예제 #10
0
파일: FltVarMatrix.cs 프로젝트: nofear/Mara
 public FltVarMatrix( Solver solver, int rowCount, int colCount, FltVarList list )
     : base(solver)
 {
     m_VarList		= list;
     m_RowCount		= rowCount;
     m_ColCount		= colCount;
 }
예제 #11
0
파일: FltVarMatrix.cs 프로젝트: nofear/Mara
        private void InitMatrix( FltDomain domain )
        {
            m_VarList	= new FltVarList( m_Solver, m_RowCount * m_ColCount );

            for( int row = 0; row < m_RowCount; ++row )
            {
                for( int col = 0; col < m_ColCount; ++col )
                {
                    string name		= row.ToString() + "." + col.ToString();

                    FltVar cell		= new FltVar( m_Solver, domain, name );

                    m_VarList.Add( cell );
                }
            }
        }
예제 #12
0
파일: FltVarMatrix.cs 프로젝트: nofear/Mara
        public FltVarList Row( int vrow )
        {
            FltVarList list	= new FltVarList( m_Solver );

            for( int col = 0; col < m_ColCount; ++col )
            {
                list.Add( Cell( vrow, col ) );
            }

            return list;
        }
예제 #13
0
파일: FltVarMatrix.cs 프로젝트: nofear/Mara
        public FltVarMatrix Matrix( int rowOffset, int colOffset, int rowCount, int colCount )
        {
            FltVarList list	= new FltVarList( m_Solver );

            for( int row = 0; row < rowCount; ++row )
            {
                for( int col = 0; col < colCount; ++col )
                {
                    list.Add( Cell( rowOffset + row, colOffset + col ) );
                }
            }

            return new FltVarMatrix( m_Solver, rowCount, colCount, list );
        }
예제 #14
0
파일: FltVarMatrix.cs 프로젝트: nofear/Mara
        public FltVarList DiagRightTopToBottomLeft()
        {
            FltVarList list	= new FltVarList( m_Solver );

            if( m_RowCount == m_ColCount )
            {
                int size	= m_RowCount;

                for( int idx = 0; idx < size; ++idx )
                {
                    list.Add( Cell( idx, ( size - 1 ) - idx ) );
                }
            }

            return list;
        }
예제 #15
0
파일: FltVarMatrix.cs 프로젝트: nofear/Mara
        public FltVarList Col( int vcol )
        {
            FltVarList list	= new FltVarList( m_Solver );

            for( int row = 0; row < m_RowCount; ++row )
            {
                list.Add( Cell( row, vcol ) );
            }

            return list;
        }