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; }
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; }
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); }
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; }
public FltVar[] ToArray() { FltVar[] list = new FltVar[Count]; for (int idx = 0; idx < Count; ++idx) { list[idx] = At(idx); } return(list); }
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 ) ); }
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 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 FltVarExprValMulRev(double val, FltVar var1) : this(new FltVar(var1.Solver), val, var1) { }
public FltVarExprDiv( FltVar var0, FltVar var1, FltVar var2 ) : base(var0, var1, var2) { }
public FltVarCmpValLess(FltVar var0, double val) : base(var0, val) { }
public FltVarExprValAdd(FltVar var0, FltVar var1, double val) : base(var0, var1, val) { }
public FltVarExprDiv( FltVar var1, FltVar var2 ) : this(new FltVar( var1.Solver ), var1, var2) { }
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 FltVarExprValAdd(FltVar var1, double val) : this(new FltVar(var1.Solver), var1, val) { }
public FltVarList( Solver solver, FltVar[] list ) : this(solver) { foreach( FltVar var in list ) { Add( var ); } }
public FltVarExprValAddRev( FltVar var0, double val, FltVar var1 ) : base(var0, var1, val) { }
public FltVarCmpLess(FltVar var0, FltVar var1) : base(var0, var1) { }
public FltVarCmpValGreater(FltVar var0, double val) : base(var0, val) { }
public FltVarExprValMulRev(FltVar var0, double val, FltVar var1) : base(var0, var1, val) { }
public FltVarCmpLess( FltVar var0, FltVar var1 ) : base(var0, var1) { }
public FltVarList(FltVar v0, FltVar v1, FltVar v2) : this(v0.Solver, new FltVar[] { v0, v1, v2 }) { }
public FltVarCmpValGreater( FltVar var0, double val ) : base(var0, val) { }
public FltVarCmpValLess( FltVar var0, double val ) : base(var0, val) { }
public FltVarExprValMul( FltVar var1, double val ) : this(new FltVar( var1.Solver ), var1, val) { }
public FltVar[] ToArray() { FltVar[] list = new FltVar[ Count ]; for( int idx = 0; idx < Count; ++idx ) { list[ idx ] = At( idx ); } return list; }
public FltVarCmpEqual(FltVar var0, FltVar var1) : base(var0, var1) { }
public FltVarCmpValNotEqual(FltVar var0, double val) : base(var0, val) { }
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) { }
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) { }
public FltVarExprValAddRev( double val, FltVar var1 ) : this(new FltVar( var1.Solver ), val, var1) { }
public FltVarCmpValEqual( FltVar var0, double val ) : base(var0, val) { }
public FltVarCmpEqual( FltVar var0, FltVar var1 ) : base(var0, var1) { }
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) ); } } }