public FltVarMatrix(Solver solver, int rowCount, int colCount, FltVarList list) : base(solver) { m_VarList = list; m_RowCount = rowCount; m_ColCount = colCount; }
public FltVarMatrix( Solver solver, int rowCount, int colCount, FltDomain domain ) : base(solver) { m_VarList = null; m_RowCount = rowCount; m_ColCount = colCount; InitMatrix( domain ); }
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); }
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); }
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)); }
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); } } }
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); }
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 ); }
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 ); }
public FltVarMatrix( Solver solver, int rowCount, int colCount, FltVarList list ) : base(solver) { m_VarList = list; m_RowCount = rowCount; m_ColCount = colCount; }
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 ); } } }
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; }
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 ); }
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; }
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; }