Beispiel #1
0
 protected FltVarExprVar( FltVar var0, FltVar var1, FltVar var2 )
     : base(var0.Solver, new Variable[] { var0, var1, var2 })
 {
     m_Var0	= var0;
     m_Var1	= var1;
     m_Var2	= var2;
 }
Beispiel #2
0
 protected FltVarExprVar(FltVar var0, FltVar var1, FltVar var2) :
     base(var0.Solver, new Variable[] { var0, var1, var2 })
 {
     m_Var0 = var0;
     m_Var1 = var1;
     m_Var2 = var2;
 }
Beispiel #3
0
 protected FltVarExprVal(FltVar var0, FltVar var1, double val) :
     base(var0.Solver, new Variable[] { var0, var1 })
 {
     m_Var0   = var0;
     m_Var1   = var1;
     m_Value  = val;
     m_Domain = new FltDomain(val);
 }
Beispiel #4
0
        public FltVar[] Copy( FltVar[] other )
        {
            FltVar[] copy	= new FltVar[ other.Length ];
            for( int idx = 0; idx < other.Length; ++idx )
            {
                copy[ idx ]		= m_FltVarList[ other[ idx ].Index ];
            }

            return copy;
        }
Beispiel #5
0
        public FltVar[] ToArray()
        {
            FltVar[] list = new FltVar[Count];

            for (int idx = 0; idx < Count; ++idx)
            {
                list[idx] = At(idx);
            }

            return(list);
        }
Beispiel #6
0
        public void Test()
        {
            Solver solver	= new Solver( -100, 100 );
            FltVar a		= new FltVar( solver, 5, 10, "a" );
            FltVarNeg neg	= -a;
            FltVar b		= neg.Var0;

            solver.Add( neg );
            solver.Propagate();

            Assert.AreEqual( b.Domain, new FltDomain( -10, -5 ) );
        }
Beispiel #7
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 #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 FltVarExprValMulRev(double val, FltVar var1) :
     this(new FltVar(var1.Solver), val, var1)
 {
 }
Beispiel #11
0
 public FltVarExprDiv( FltVar var0, FltVar var1, FltVar var2 )
     : base(var0, var1, var2)
 {
 }
Beispiel #12
0
 public FltVarCmpValLess(FltVar var0, double val) :
     base(var0, val)
 {
 }
Beispiel #13
0
 public FltVarExprValAdd(FltVar var0, FltVar var1, double val) :
     base(var0, var1, val)
 {
 }
Beispiel #14
0
 public FltVarExprDiv( FltVar var1, FltVar var2 )
     : this(new FltVar( var1.Solver ), var1, var2)
 {
 }
Beispiel #15
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 #16
0
 public FltVarExprValAdd(FltVar var1, double val) :
     this(new FltVar(var1.Solver), var1, val)
 {
 }
Beispiel #17
0
 public FltVarList( Solver solver, FltVar[] list )
     : this(solver)
 {
     foreach( FltVar var in list )
     {
         Add( var );
     }
 }
Beispiel #18
0
 public FltVarExprValAddRev( FltVar var0, double val, FltVar var1 )
     : base(var0, var1, val)
 {
 }
Beispiel #19
0
 public FltVarCmpLess(FltVar var0, FltVar var1) :
     base(var0, var1)
 {
 }
Beispiel #20
0
 public FltVarCmpValGreater(FltVar var0, double val) :
     base(var0, val)
 {
 }
Beispiel #21
0
 public FltVarExprValMulRev(FltVar var0, double val, FltVar var1) :
     base(var0, var1, val)
 {
 }
Beispiel #22
0
 public FltVarCmpLess( FltVar var0, FltVar var1 )
     : base(var0, var1)
 {
 }
Beispiel #23
0
 public FltVarList(FltVar v0, FltVar v1, FltVar v2) :
     this(v0.Solver, new FltVar[] { v0, v1, v2 })
 {
 }
Beispiel #24
0
 public FltVarCmpValGreater( FltVar var0, double val )
     : base(var0, val)
 {
 }
Beispiel #25
0
 public FltVarCmpValLess( FltVar var0, double val )
     : base(var0, val)
 {
 }
Beispiel #26
0
 public FltVarExprValMul( FltVar var1, double val )
     : this(new FltVar( var1.Solver ), var1, val)
 {
 }
Beispiel #27
0
        public FltVar[] ToArray()
        {
            FltVar[] list	= new FltVar[ Count ];

            for( int idx = 0; idx < Count; ++idx )
            {
                list[ idx ]		= At( idx );
            }

            return list;
        }
Beispiel #28
0
 public FltVarCmpEqual(FltVar var0, FltVar var1) :
     base(var0, var1)
 {
 }
 public FltVarCmpValNotEqual(FltVar var0, double val) :
     base(var0, val)
 {
 }
Beispiel #30
0
 public FltVarExprValMul( FltVar var0, FltVar var1, double val )
     : base(var0, var1, val)
 {
 }
 public FltVarExprDiv(FltVar var1, FltVar var2) :
     this(new FltVar(var1.Solver), var1, var2)
 {
 }
Beispiel #32
0
 public FltVarList( FltVar v0, FltVar v1, FltVar v2 )
     : this(v0.Solver, new FltVar[] { v0, v1, v2 })
 {
 }
 public FltVarExprDiv(FltVar var0, FltVar var1, FltVar var2) :
     base(var0, var1, var2)
 {
 }
Beispiel #34
0
 public FltVarExprValAddRev( double val, FltVar var1 )
     : this(new FltVar( var1.Solver ), val, var1)
 {
 }
Beispiel #35
0
 public FltVarCmpValEqual( FltVar var0, double val )
     : base(var0, val)
 {
 }
Beispiel #36
0
 public FltVarCmpEqual( FltVar var0, FltVar var1 )
     : base(var0, var1)
 {
 }
Beispiel #37
0
        private static void Poly1()
        {
            Random rnd	= new Random(0);
            for( int i = 0; i < 10000000; ++i )
            {
                double a	= rnd.Next( -10, 10 );
                double b	= rnd.Next( -10, 10 ) ;
                double c	= rnd.Next( -10, 10 ) ;

                a=2;b=8;c=8;

                Solver s		= new Solver( -1000000, 1000000 );
                FltVar x		= new FltVar( s, "x" );
                FltVarExpr exp	= a*x*x+ b*x;
                s.Add( exp );
                s.Add( exp == -c );

                s.PrintConstraints();
                s.PrintVariables();

                Console.Out.WriteLine( "{0}.x^2 + {1}.x + {2} = 0", a, b, c );

                s.Solve( new FltGenerate( s, new FltVar[] { x } ) );
                Console.Out.WriteLine( x.ToString(true) );
                while( s.Next() )
                {
                    Console.Out.WriteLine( x.ToString(true) );
                }
            }
        }