Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Porting runtime to the web #336

Merged
merged 87 commits into from
Oct 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
dc5b2a4
[inspector] Add roughly implemented inspector, Frame view
maxkrieger Mar 10, 2020
9d9666d
[inspector] Put inspector inline for now because of styling bugs; add…
maxkrieger Mar 14, 2020
bc4584a
[inspector] fix scroll layout
maxkrieger Mar 14, 2020
07a20da
[inspector] Add shapes panel beginnings
maxkrieger Mar 15, 2020
266e25e
[inspector] Shape view layout fixes
maxkrieger Mar 15, 2020
517dfef
[inspector] Additional layout tweaks
maxkrieger Mar 15, 2020
4bac3de
[web-eval] start porting the evaluator to js; function signatures; st…
wodeni Apr 3, 2020
18a82d5
[web-eval] generated ts types for Style expressions and path
wodeni Apr 3, 2020
50c4af5
[web-eval] generate types for translation using JS Map
wodeni Apr 3, 2020
95edd0e
[web-eval] manually decode serialized state into typed object; add ty…
wodeni Apr 5, 2020
860d8e4
[web-eval] (wip) eval expr
wodeni Apr 22, 2020
03e480a
[web-eval] evaluate a single unary operation. Closely model the backe…
wodeni Apr 22, 2020
e732c7a
[web-eval] evaluate a single comp function
wodeni Apr 22, 2020
cc19858
[web-eval] resolve paths to properties
wodeni Apr 23, 2020
724b922
[web-eval] evaluate binops; set up enzyme
wodeni Apr 23, 2020
e840592
[web-eval] add some type annotations to get rid of compiler errors in…
wodeni Apr 23, 2020
923554a
[web-eval] fully evaluate a single shape
wodeni Apr 23, 2020
693682b
[web-eval] evaluate the entire translation and output a list of shapes
wodeni Apr 23, 2020
025068f
[web-eval] include typedoc config in tsconfig
wodeni Apr 24, 2020
9a3fbb7
[web-eval] start integrating the evaluator with the frontend; add typ…
wodeni Apr 24, 2020
5618a2d
[web-eval] rename propagateUpdates to insertPending; extra documantation
wodeni Apr 24, 2020
f8d65ef
[web-eval] add type to Canvas data and propagate this change to all l…
wodeni Apr 24, 2020
910d9ee
[web-eval] better Aeson decoder errors; insert varying state into tra…
wodeni Apr 24, 2020
5f64b87
[web-eval] resolve strange bug when updating evaluated shapes in the …
wodeni Apr 24, 2020
62bd765
[web-eval] repro 3 examples; fix bugs in resolving pending paths and …
wodeni Apr 26, 2020
a3aea9e
[web-eval] remove fsevent from dependency list
wodeni Apr 26, 2020
974a8e3
[web-opt] TFjs setup and some tests
wodeni Apr 26, 2020
74b1ee8
[web-opt] resolve some dependency issues and start porting optimizati…
wodeni Apr 27, 2020
5ef2dcf
[web-opt] wrote stepUntilConvergence but tfjs is having trouble findi…
wodeni Apr 27, 2020
23c1e3d
[web-opt] evaluator optionally output TF types; still buggy
wodeni Apr 27, 2020
c996ab8
[web-opt] fix the behavior of evaluator when tf flag is on
wodeni Apr 27, 2020
5c5cce5
debugging opt apply
wodeni Apr 27, 2020
f37a7a1
[web-opt] continuing to debug the y=f(x) problem
wodeni Apr 28, 2020
164e65e
[web-opt] found the problem that caused the y=f(x) no connection erro…
wodeni Apr 28, 2020
093a879
[web-opt] dummy terms in overall objective; fix varying map lookups; …
wodeni Apr 28, 2020
ce9dd0f
[web-opt] exclude tests in tsconfig
wodeni Apr 29, 2020
db78939
[web-opt] change tfjs backend to CPU; more constraints and objectives
wodeni Apr 30, 2020
304bd96
[web-opt] clean up optimizer code; start a template for EP
wodeni May 1, 2020
367e8fc
[web-runtime] add jsconfig for emacs tide mode for typescript
May 1, 2020
5db1a4a
[web-optimizer] [wip] annotate stepEP with the parts that need to be …
May 6, 2020
4786146
[web-optimizer] implement stepEP, but it's hard to test since UO was …
May 6, 2020
e0e7a60
[web-runtime] fix state bug where evalTranslation was using a stale v…
May 7, 2020
b92722c
[web-optimizer] port `overlapping` for rest of venn.sty
May 8, 2020
00de0a6
[web-examples] port tree.sty (functions `repel`, `centerArrow`, `abov…
May 9, 2020
f8ad738
[web-runtime] add vanilla gradient descent optimizer; seems to work o…
May 14, 2020
651bf1d
[web-runtime] [wip] add types for aw line search
May 14, 2020
d74fc1c
[web-runtime] [wip] fix aw line search types to flatten/unflatten ten…
May 15, 2020
937052e
[web-runtime] add first implementation of line search; doesn't seem t…
May 15, 2020
1be2155
[web-runtime] fix line search bug with wolfe cond (>=), now it seems …
May 15, 2020
ffa3c90
[web-runtime] set tf to cpu backend and production mode in the step f…
May 17, 2020
ef9e003
Merge branch 'inspector' into web-runtime
maxkrieger May 25, 2020
9da8cbb
[web-runtime-inspector] Complete merge, fix inspector
maxkrieger May 25, 2020
3b051e3
[web-runtime] Add documentation on inspector
maxkrieger May 25, 2020
d1334e9
[web-runtime] bring back tf optimizer and add parameter to swap betwe…
May 29, 2020
6f32722
[web-inspector] [bugfix] add cases to ShapeView to handle Square and …
Jun 1, 2020
2c69b5d
[web-runtime] [bugfix] generalize evaluator to perform operations (Bi…
Jun 2, 2020
8385530
[web-runtime] add Tuple case to evaluator and make variables block-sc…
Jun 5, 2020
d9adb07
[web-runtime] [bugfix] skip optimization if there are no varying vari…
Jun 26, 2020
9b8aaf2
Now sort shapes after each translation. Updated set theory example to…
strout18 Jul 8, 2020
a9e648a
updated Constraints to support continuous map diagram - extended minS…
strout18 May 29, 2020
27dbc70
reverted to not setting values explicitly
strout18 Jun 2, 2020
5b0a587
final cleanup, ready for pr
strout18 Jul 11, 2020
3397807
Merge pull request #356 from penrose/layer-hotfix
Jul 22, 2020
da6d449
Merge pull request #342 from penrose/stella
Jul 22, 2020
1a34368
[web-runtime] [bugfix] convert varying values to base numbers in reso…
Jul 28, 2020
93eb2b2
[web-runtime] [port/bugfix] add AD setting for computations; working …
Jul 28, 2020
369d5a5
[web-runtime] [temp] add SVG path for testing
Jul 28, 2020
c91bdac
[hyperbolic] Start building hyperbolic package
GeometryCollective Aug 19, 2020
061e7f5
[hyperbolic] Start adding horocycles
GeometryCollective Aug 20, 2020
62eefb9
[web-runtime] Heuristic that resolves #340
maxkrieger Aug 28, 2020
4011e3d
[web-runtime] Rename typo: utills/ -> utils/
maxkrieger Aug 28, 2020
22568a4
[web-runtime] Switch adaptor to get correct w/h
maxkrieger Aug 28, 2020
1ce4005
[web-runtime] Attempt to fallback to given font size
maxkrieger Aug 28, 2020
4963b0e
[evaluator-fix] change all evaluation + optimization-related function…
Aug 19, 2020
4d7c2a5
Merge pull request #370 from penrose/evaluator-fix
Sep 1, 2020
95d12fd
[hyperbolic] merge web-runtime into hyperbolic
Sep 2, 2020
011275d
[web-runtime + hyperbolic] fix backend function-name-calling bug (#35…
Sep 2, 2020
647ed05
[hyperbolic] Fixed bug: stop optimization if max iter OR eps criteria is
GeometryCollective Sep 2, 2020
8a1b49b
[web-runtime] add stepping until max or convergence, for perf compari…
Oct 1, 2020
04c700c
[web-runtime] add temp path for mod tab test: `runpenrose linear-alge…
Oct 1, 2020
58df960
[web-runtime] change base url to src and reorganize shape files
wodeni Oct 8, 2020
11cc9af
[web-runtime] move diagram generation modules under engine; clean up …
wodeni Oct 8, 2020
7b370fb
[web-runtime] move ui components under ui
wodeni Oct 8, 2020
6d845ff
[web-runtime] remove all relative imports
wodeni Oct 12, 2020
9d921e2
[web-perf] extend system with custom reverse-mode autodiff and solver…
Oct 12, 2020
c833cdc
Merge pull request #383 from penrose/web-perf-squashed
wodeni Oct 12, 2020
3c3d83f
[web-runtime] remove tfjs dependencies
wodeni Oct 13, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,5 @@ dist-newstyle/
examples/plugins/alloy/__temp.als__
.java-version
temp.als
.*.sw*

8 changes: 8 additions & 0 deletions UserGuide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
In `penrose/react-renderer/src`, run `npm start`
In `penrose/examples/` run `runpenrose my.sub my.sty my.domain`

Shape library:
https://github.com/penrose/penrose/wiki/Shape-and-function-library

Tensor flow math operations:
https://js.tensorflow.org/api/latest/#Operations
25 changes: 12 additions & 13 deletions automator/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const mathjax = require("mathjax-node");
const { propagateUpdate } = require("../react-renderer/src/PropagateUpdate");
const Canvas = require("../react-renderer/src/Canvas");
const Packets = require("../react-renderer/src/packets");
// const { loadImages } = require("../react-renderer/src/Util"); // TODO: implement image import
const ReactDOMServer = require("react-dom/server");
const { spawn } = require("child_process");
const chalk = require("chalk");
Expand Down Expand Up @@ -33,7 +32,7 @@ const nonZeroConstraints = (
) => {
const constrFns = state.constrFns;
const fnsWithVals = constrFns.map((f, i) => [f, constrVals[i]]);
const nonzeroConstr = fnsWithVals.filter(c => +c[1] > threshold);
const nonzeroConstr = fnsWithVals.filter((c) => +c[1] > threshold);
return nonzeroConstr;
};

Expand All @@ -47,10 +46,10 @@ const runPenrose = (packet: object) =>
penrose.stdin.setEncoding("utf-8");
penrose.stdin.write(JSON.stringify(packet) + "\n");
let data = "";
penrose.stdout.on("data", async d => {
penrose.stdout.on("data", async (d) => {
data += d.toString();
});
penrose.stdout.on("close", async cl => {
penrose.stdout.on("close", async (cl) => {
resolve(data);
});

Expand Down Expand Up @@ -79,7 +78,7 @@ const collectLabels = async (state: any, includeRendered: boolean) => {
svgNode: true,
useFontCache: false,
useGlobalCache: false,
ex: 12
ex: 12,
});
if (data.errors) {
console.error(
Expand Down Expand Up @@ -107,7 +106,7 @@ const collectLabels = async (state: any, includeRendered: boolean) => {

if (includeRendered) {
textGPI.rendered = {
contents: data.svgNode
contents: data.svgNode,
};
}
return [type, textGPI];
Expand All @@ -121,7 +120,7 @@ const collectLabels = async (state: any, includeRendered: boolean) => {
state.shapeOrdering
);
// update the state with newly generated labels and label dimensions
const updated = await propagateUpdate({ ...state, shapesr: sortedShapes });
const updated = await propagateUpdate({ ...state, shapes: sortedShapes });
return updated;
};

Expand All @@ -139,11 +138,11 @@ const singleProcess = async (
substanceName: sub,
styleName: sty,
domainName: dsl,
id: uniqid("instance-")
id: uniqid("instance-"),
}
) => {
// Fetch Substance, Style, and Domain files
const trio = [sub, sty, dsl].map(arg =>
const trio = [sub, sty, dsl].map((arg) =>
fs.readFileSync(`${prefix}/${arg}`, "utf8").toString()
);
console.log(`Compiling for ${out}/${sub} ...`);
Expand Down Expand Up @@ -205,15 +204,15 @@ const singleProcess = async (
compilation: convertHrtime(compileEnd).milliseconds,
labelling: convertHrtime(labelEnd).milliseconds,
optimization: convertHrtime(convergeEnd).milliseconds,
rendering: convertHrtime(reactRenderEnd).milliseconds
rendering: convertHrtime(reactRenderEnd).milliseconds,
},
violatingConstraints: constrs,
nonzeroConstraints: constrs.length > 0,
selectorMatches: optimizedState.selectorMatches,
optProblem: {
constraintCount: optimizedState.constrFns.length,
objectiveCount: optimizedState.objFns.length
}
objectiveCount: optimizedState.objFns.length,
},
};
if (!fs.existsSync(out)) {
fs.mkdirSync(out);
Expand Down Expand Up @@ -290,7 +289,7 @@ const batchProcess = async (
substanceName: name,
styleName,
domainName,
id
id,
}
);
if (folders) {
Expand Down
22 changes: 22 additions & 0 deletions examples/ThoughtsAndIssues.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Should whitespace be ignored in notation?

When a constructor's arguments are not named, the error message is cryptic

Should be possible to specify floating point numbers in any standard way (e.g., 0. instead of 0.0)

Should be possible to specify colors in hex

Should be possible to use notation in Style

Make it clearer what the canvas size is, and make it possible to set the canvas size

Maybe do automatic "upgrades" of integer to float in Style?

Shouldn't be forced to put open brace ({) on same line as block name in Style

Should allow local scoping, i.e., variables defined within a scope should be referencable within that scope without the scope name. E.g., Global { width = 1.23; height = width/2.0; }
(More generally: just think about scoping, and how we can perhaps have shorter references)

Substance should support Unicode characters

Should be possible to use arbitrary Unicode characters in notation
Loading