Skip to content

Commit

Permalink
bool-based Duals
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan-williams committed Sep 24, 2023
1 parent f3778a6 commit bfabfe4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 21 deletions.
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"email": "ryan@runsascoded.com"
},
"dependencies": {
"apvd": "https://gitpkg.now.sh/runsascoded/shapes?f2d9c27",
"apvd": "https://gitpkg.now.sh/runsascoded/shapes?1e0bd5c",
"bootstrap": "^5.3.1",
"next": "^13.4.13",
"next-utils": "https://gitpkg.now.sh/runsascoded/next-utils/dist?f44fed9",
Expand Down
17 changes: 7 additions & 10 deletions pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -425,16 +425,13 @@ export function Body({ logLevel, setLogLevel, }: { logLevel: LogLevel, setLogLev
const shape = set.shape;
const coords: Coord[] = mapShape<number, Coord[]>(shape, () => CircleCoords, () => XYRRCoords, () => XYRRTCoords)
return [
mapShape<number, any>(shape, s => ({ Circle: s }), s => ({ XYRR: s }), s => ({ XYRRT: s })),
coords.map(v => {
const row = new Array(numVars).fill(0)
const skip = shapeIdx < skipVars.length && skipVars[shapeIdx].includes(v)
if (!skip) {
row[curIdx] = 1
curIdx += 1
}
return row
}),
mapShape<number, any>(
shape,
s => ({ Circle: s }),
s => ({ XYRR: s }),
s => ({ XYRRT: s })
),
coords.map(v => shapeIdx >= skipVars.length || !skipVars[shapeIdx].includes(v)),
]
})
// console.log("inputs:", inputs)
Expand Down
6 changes: 1 addition & 5 deletions src/lib/regions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as apvd from "apvd";
import {Dual, Error, Input, Targets} from "apvd"
import {Dual, Error, Targets} from "apvd"
import {S, Set, Shape} from "./shape";

export type Point = {
Expand All @@ -11,9 +11,7 @@ export type Point = {
export type Errors = Map<string, Error>

export type Step = {
inputs: Input[]
sets: S[]
// shapes: Shape<number>[]
points: Point[]
edges: Edge[]
regions: Region[]
Expand Down Expand Up @@ -53,15 +51,13 @@ export function makeStep(step: apvd.Step, initialSets: Set[]): Step {
components.forEach(c => c.sets.forEach(({ idx, shape }) => {
sets[idx] = { ...initialSets[idx], shape: makeShape(shape) }
}))
// const shapes = sets.map(({ shape }) => makeShape(shape))
const newComponents = components.map(c => makeComponent(c, sets))
// console.log("initial sets:", sets)
const points = newComponents.flatMap(c => c.points)
const edges = newComponents.flatMap(c => c.edges)
const regions = newComponents.flatMap(c => c.regions)
return {
sets,
// shapes,
points,
edges,
regions,
Expand Down

0 comments on commit bfabfe4

Please sign in to comment.