UNPKG

@logic-pad/core

Version:
50 lines (49 loc) 1.54 kB
import { RegionConstrainer } from 'grilops'; export default class Z3SolverContext { constructor(grid) { Object.defineProperty(this, "grid", { enumerable: true, configurable: true, writable: true, value: grid }); Object.defineProperty(this, "_regionConstrainer", { enumerable: true, configurable: true, writable: true, value: void 0 }); this.grid = grid; } get solver() { return this.grid.solver; } get lattice() { return this.grid.lattice; } get symbolSet() { return this.grid.symbolSet; } get ctx() { return this.grid.ctx.context; } get z3() { return this.grid.ctx.z3; } get regionConstrainer() { if (!this._regionConstrainer) { this._regionConstrainer = new RegionConstrainer(this.grid.ctx, this.lattice, this.solver, true, false, 1); for (const p of this.lattice.points) { for (const np of this.lattice.edgeSharingNeighbors(this.grid.grid, p)) { this.solver.add(this.grid .cellAt(p) .eq(this.grid.cellAt(np.location)) .eq(this._regionConstrainer.regionIdGrid .get(p) .eq(this._regionConstrainer.regionIdGrid.get(np.location)))); } } } return this._regionConstrainer; } }