本文整理汇总了C#中Microsoft.Z3.Context.UpdateParamValue方法的典型用法代码示例。如果您正苦于以下问题:C# Context.UpdateParamValue方法的具体用法?C# Context.UpdateParamValue怎么用?C# Context.UpdateParamValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Z3.Context
的用法示例。
在下文中一共展示了Context.UpdateParamValue方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Run
public void Run()
{
Dictionary<string, string> cfg = new Dictionary<string, string>() {
{ "AUTO_CONFIG", "true" } };
using (Context ctx = new Context(cfg))
{
IntExpr[] x = new IntExpr[20];
IntExpr[] y = new IntExpr[20];
for (uint i = 0; i < 20; i++)
{
x[i] = ctx.MkIntConst(string.Format("x_{0}", i));
y[i] = ctx.MkIntConst(string.Format("y_{0}", i));
}
BoolExpr f = ctx.MkAnd(ctx.MkGe(ctx.MkAdd(x), ctx.MkInt(0)),
ctx.MkGe(ctx.MkAdd(y), ctx.MkInt(0)));
Console.WriteLine("now: " + ctx.GetParamValue("PP_MAX_DEPTH"));
ctx.UpdateParamValue("PP_MAX_DEPTH", "1");
Console.WriteLine(f);
ctx.UpdateParamValue("PP_MAX_DEPTH", "100");
ctx.UpdateParamValue("PP_MAX_NUM_LINES", "10");
Console.WriteLine(f);
ctx.UpdateParamValue("PP_MAX_NUM_LINES", "20");
ctx.UpdateParamValue("PP_MAX_WIDTH", "300");
Console.WriteLine(f);
Console.WriteLine("now: " + ctx.GetParamValue("PP_MAX_WIDTH"));
}
}
示例2: Run
public void Run()
{
using (Context ctx = new Context()) {
ctx.UpdateParamValue("DL_ENGINE","1");
ctx.UpdateParamValue("DL_PDR_USE_FARKAS","true");
// ctx.UpdateParamValue("VERBOSE","2");
var s = ctx.MkFixedpoint();
BoolSort B = ctx.BoolSort;
IntSort I = ctx.IntSort;
FuncDecl mc = ctx.MkFuncDecl("mc", new Sort[]{I, I}, B);
ArithExpr x = (ArithExpr)ctx.MkBound(0,I);
ArithExpr y = (ArithExpr)ctx.MkBound(1,I);
ArithExpr z = (ArithExpr)ctx.MkBound(2,I);
s.RegisterRelation(mc);
BoolExpr gt = ctx.MkGt(x, ctx.MkInt(100));
s.AddRule(ctx.MkImplies(gt,(BoolExpr)mc[x,ctx.MkSub(x,ctx.MkInt(10))]));
s.AddRule(ctx.MkImplies(ctx.MkAnd(ctx.MkNot(gt),
(BoolExpr) mc[ctx.MkAdd(x,ctx.MkInt(11)),y],
(BoolExpr) mc[y,z]),
(BoolExpr) mc[x,z]));
Console.WriteLine(s.Query(ctx.MkAnd((BoolExpr)mc[x,y], ctx.MkGt(y,ctx.MkInt(100)))));
Console.WriteLine(s.GetAnswer());
Console.WriteLine(s.Query(ctx.MkAnd((BoolExpr)mc[x,y], ctx.MkLt(y,ctx.MkInt(91)))));
Console.WriteLine(s.GetAnswer());
}
}
示例3: Run
public void Run()
{
using (Context ctx = new Context())
{
Console.WriteLine(ctx.MkPower(ctx.MkReal(2), ctx.MkReal(1, 2)).Simplify());
ctx.UpdateParamValue(":pp-decimal-precision", "50");
ctx.UpdateParamValue(":pp-decimal", "true");
Console.WriteLine(ctx.MkPower(ctx.MkReal(2), ctx.MkReal(1, 2)).Simplify());
ctx.UpdateParamValue(":pp-decimal-precision", "20");
Console.WriteLine(ctx.MkPower(ctx.MkReal(2), ctx.MkReal(1, 2)).Simplify());
}
}
示例4: Run
public void Run()
{
Dictionary<string, string> cfg = new Dictionary<string, string>() {
{ "AUTO_CONFIG", "true" } };
using (Context ctx = new Context(cfg))
{
try
{
Expr n = ctx.MkReal("1/0");
Console.WriteLine(n);
}
catch (Z3Exception ex)
{
Console.WriteLine("failed: " + ex.Message);
}
ctx.UpdateParamValue("PP_BOUNDED", "true");
Console.WriteLine("done");
}
}
示例5: Run
public void Run()
{
using (Context ctx = new Context())
{
RealExpr x = ctx.MkRealConst("x");
RealExpr y = ctx.MkRealConst("y");
Solver s = ctx.Then(ctx.MkTactic("simplify"), ctx.MkTactic("nlsat")).Solver;
s.Assert(ctx.MkEq(ctx.MkPower(x, ctx.MkReal(2)), ctx.MkReal(2)),
ctx.MkEq(ctx.MkPower(y, ctx.MkReal(3)), ctx.MkAdd(x, ctx.MkReal(1))));
Console.WriteLine(s.Check());
ctx.UpdateParamValue(":pp-decimal", "true");
Console.WriteLine(s.Model);
Console.WriteLine(s.Statistics);
foreach (string k in s.Statistics.Keys)
Console.WriteLine(k);
Console.WriteLine("NLSAT stages: " + s.Statistics["nlsat stages"].Value);
Console.WriteLine("NLSAT propagations: " + s.Statistics["nlsat propagations"].Value);
}
}
示例6: Run
public void Run()
{
using (Context ctx = new Context())
{
this.ctx = ctx;
ctx.UpdateParamValue("DL_GENERATE_EXPLANATIONS", "true");
red_car = new Car(false, 2, 2, 3, "red");
cars = new Car[]{
new Car(true, 0, 3, 0, "yellow"),
new Car(false, 3, 3, 0, "blue"),
new Car(false, 5, 2, 0, "brown"),
new Car(false, 0, 2, 1, "lgreen"),
new Car(true, 1, 2, 1, "light blue"),
new Car(true, 2, 2, 1, "pink"),
new Car(true, 2, 2, 4, "dark green"),
red_car,
new Car(true, 3, 2, 3, "purple"),
new Car(false, 5, 2, 3, "light yellow"),
new Car(true, 4, 2, 0, "orange"),
new Car(false, 4, 2, 4, "black"),
new Car(true, 5, 3, 1, "light purple")
};
this.num_cars = cars.Length;
this.B = ctx.MkBoolSort();
this.bv3 = ctx.MkBitVecSort(3);
List<Sort> domain = new List<Sort>();
foreach (var c in cars) domain.Add(bv3);
this.state = ctx.MkFuncDecl("state", domain.ToArray(), B);
this.fp = ctx.MkFixedpoint();
this.fp.RegisterRelation(state);
// Initial state:
Expr[] args = new Expr[num_cars];
for (int i = 0; i < num_cars; ++i) args[i] = num(cars[i].start);
fp.AddRule((BoolExpr)state[args]);
// Transitions:
for (int pos = 0; pos < num_cars; ++pos)
{
Car car = cars[pos];
for (int i = 0; i < dimension; ++i)
if (car.is_vertical)
{
move_down(i, pos, car);
move_up(i, pos, car);
}
else
{
move_left(i, pos, car);
move_right(i, pos, car);
}
}
// Print the current context:
Console.WriteLine("{0}", fp);
// Prepare the query:
for (int i = 0; i < num_cars; ++i) args[i] = (cars[i] == red_car) ? num(4) : bound(i);
BoolExpr goal = (BoolExpr)state[args];
fp.Query(goal);
// Extract a path:
get_instructions(fp.GetAnswer());
}
}
示例7: Run
public void Run()
{
using (Context ctx = new Context())
{
RealExpr x = ctx.MkRealConst("x");
RealExpr y = ctx.MkRealConst("y");
RealExpr z = ctx.MkRealConst("z");
IntExpr a = ctx.MkIntConst("a");
IntExpr b = ctx.MkIntConst("b");
IntExpr c = ctx.MkIntConst("c");
ctx.UpdateParamValue(":pp-flat-assoc", "false");
Console.WriteLine(ctx.MkAdd(x, y, ctx.MkInt2Real(a)));
Console.WriteLine(ctx.MkAdd(x, ctx.MkReal(1)));
Console.WriteLine(ctx.MkAdd(ctx.MkReal(2), y));
Console.WriteLine(ctx.MkMul(x, y));
Console.WriteLine(ctx.MkAdd(ctx.MkInt(2), ctx.MkInt(3)));
Console.WriteLine(ctx.MkMul(ctx.MkReal(2), x));
Console.WriteLine(ctx.MkAdd(ctx.MkInt2Real((IntExpr)ctx.MkAdd(ctx.MkInt(2), ctx.MkInt(3))), x));
Console.WriteLine(ctx.MkAdd((RealExpr)ctx.MkInt2Real((IntExpr)ctx.MkAdd(ctx.MkInt(2), ctx.MkInt(3))).Simplify(), x));
Console.WriteLine(ctx.MkAdd(a, b, ctx.MkInt(1)));
Console.WriteLine(ctx.MkDiv(x, y));
Console.WriteLine(ctx.MkDiv(x, ctx.MkReal(2)));
Console.WriteLine(ctx.MkDiv(ctx.MkReal(2), y));
Console.WriteLine(ctx.MkDiv(a, ctx.MkInt(2)));
Console.WriteLine(ctx.MkDiv(ctx.MkAdd(a, b), ctx.MkInt(2)));
Console.WriteLine(ctx.MkDiv(ctx.MkInt(3), a));
Console.WriteLine(ctx.MkMod(a, b));
Console.WriteLine(ctx.MkMod(a, ctx.MkInt(2)));
Console.WriteLine(ctx.MkMod(ctx.MkInt(3), a));
Console.WriteLine(ctx.MkSub(a, ctx.MkInt(2)));
Console.WriteLine(ctx.MkUnaryMinus(a));
Console.WriteLine(ctx.MkUnaryMinus(x));
Console.WriteLine(ctx.MkSub(a, b));
Console.WriteLine(a.IsAdd);
Console.WriteLine(ctx.MkAdd(a, b).IsAdd);
Console.WriteLine(ctx.MkSub(a, b).IsAdd);
Console.WriteLine(ctx.MkInt(10).IsAdd);
Console.WriteLine(ctx.MkMul(a, b).IsMul);
Console.WriteLine(ctx.MkMul(x, ctx.MkInt2Real(b)).IsMul);
Console.WriteLine(ctx.MkAdd(a, b).IsMul);
Console.WriteLine(ctx.MkDiv(a, ctx.MkInt(2)).IsDiv);
Console.WriteLine(ctx.MkDiv(ctx.MkReal(3), x).IsDiv);
Console.WriteLine(ctx.MkDiv(x,y).IsDiv);
Console.WriteLine(ctx.MkDiv(a, ctx.MkInt(2)).IsIDiv);
Console.WriteLine(ctx.MkAdd(ctx.MkInt(2), ctx.MkInt(3)).Simplify().IsAdd);
Console.WriteLine();
Console.WriteLine(a is ArithExpr);
Console.WriteLine(ctx.MkInt(2) is ArithExpr);
Console.WriteLine(ctx.MkAdd(a, b) is ArithExpr);
Console.WriteLine(ctx.MkBoolConst("p") is ArithExpr);
Console.WriteLine(ctx.MkInt(2) is IntNum);
Console.WriteLine(ctx.MkInt(2) is RatNum);
Console.WriteLine(ctx.MkReal(2, 3));
Console.WriteLine(ctx.MkReal(2, 3).IsReal);
Console.WriteLine(ctx.MkReal(2, 3) is ArithExpr);
Console.WriteLine(ctx.MkReal(2, 3).IsConst);
Console.WriteLine(ctx.MkReal(2, 3).Simplify() is RatNum);
Console.WriteLine(ctx.MkReal(2, 3).Simplify().IsRatNum);
Console.WriteLine(ctx.MkPower(ctx.MkReal(2), ctx.MkReal(1, 2)).Simplify().IsAlgebraicNumber);
Console.WriteLine(ctx.MkPower(ctx.MkReal(2), ctx.MkReal(1, 2)).Simplify() is AlgebraicNum);
Console.WriteLine(ctx.MkPower(ctx.MkReal(2), ctx.MkReal(1, 2)).IsAlgebraicNumber);
Console.WriteLine(ctx.MkPower(ctx.MkReal(2), ctx.MkReal(1, 2)) is AlgebraicNum);
Console.WriteLine(ctx.MkPower(ctx.MkReal(2), ctx.MkReal(1, 2)));
Console.WriteLine(ctx.MkPower(ctx.MkReal(2), ctx.MkReal(1, 3)));
}
}