/// <summary> /// Constructs a Z3 solver to be used. /// </summary> internal void ConstructSolver(Z3BaseParams parameters) { // If Z3 is there already, kill it if (_context != null) { DestructSolver(false); } _context = new Context(); _optSolver = _context.MkOptimize(); var p = _context.MkParams(); switch (parameters.OptKind) { case OptimizationKind.BoundingBox: p.Add("priority", _context.MkSymbol("box")); break; case OptimizationKind.Lexicographic: p.Add("priority", _context.MkSymbol("lex")); break; case OptimizationKind.ParetoOptimal: p.Add("priority", _context.MkSymbol("pareto")); break; default: Debug.Assert(false, String.Format("Unknown optimization option {0}", parameters.OptKind)); break; } switch (parameters.CardinalityAlgorithm) { case CardinalityAlgorithm.FuMalik: p.Add("maxsat_engine", _context.MkSymbol("fu_malik")); break; case CardinalityAlgorithm.CoreMaxSAT: p.Add("maxsat_engine", _context.MkSymbol("core_maxsat")); break; default: Debug.Assert(false, String.Format("Unknown cardinality algorithm option {0}", parameters.CardinalityAlgorithm)); break; } switch (parameters.PseudoBooleanAlgorithm) { case PseudoBooleanAlgorithm.WeightedMaxSAT: p.Add("wmaxsat_engine", _context.MkSymbol("wmax")); break; case PseudoBooleanAlgorithm.IterativeWeightedMaxSAT: p.Add("wmaxsat_engine", _context.MkSymbol("iwmax")); break; case PseudoBooleanAlgorithm.BisectionWeightedMaxSAT: p.Add("wmaxsat_engine", _context.MkSymbol("bwmax")); break; case PseudoBooleanAlgorithm.WeightedPartialMaxSAT2: p.Add("wmaxsat_engine", _context.MkSymbol("wpm2")); break; default: Debug.Assert(false, String.Format("Unknown pseudo-boolean algorithm option {0}", parameters.PseudoBooleanAlgorithm)); break; } switch (parameters.ArithmeticStrategy) { case ArithmeticStrategy.Basic: p.Add("engine", _context.MkSymbol("basic")); break; case ArithmeticStrategy.Farkas: p.Add("engine", _context.MkSymbol("farkas")); break; default: Debug.Assert(false, String.Format("Unknown arithmetic strategy option {0}", parameters.ArithmeticStrategy)); break; } _optSolver.Parameters = p; }
internal Handle(Optimize opt, uint h) { this.opt = opt; this.handle = h; }