Beispiel #1
0
 public FltVarMatrix(Solver solver, int rowCount, int colCount, FltVarList list) :
     base(solver)
 {
     m_VarList  = list;
     m_RowCount = rowCount;
     m_ColCount = colCount;
 }
Beispiel #2
0
        public FltVarMatrix( Solver solver, int rowCount, int colCount, FltDomain domain )
            : base(solver)
        {
            m_VarList		= null;
            m_RowCount		= rowCount;
            m_ColCount		= colCount;

            InitMatrix( domain );
        }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #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));
        }
Beispiel #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);
                }
            }
        }
Beispiel #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);
        }
Beispiel #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 );
        }
Beispiel #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 );
        }
Beispiel #10
0
 public FltVarMatrix( Solver solver, int rowCount, int colCount, FltVarList list )
     : base(solver)
 {
     m_VarList		= list;
     m_RowCount		= rowCount;
     m_ColCount		= colCount;
 }
Beispiel #11
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 );
                }
            }
        }
Beispiel #12
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;
        }
Beispiel #13
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 );
        }
Beispiel #14
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;
        }
Beispiel #15
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;
        }