lume / kiwi Goto Github PK
View Code? Open in Web Editor NEWFast TypeScript implementation of the Cassowary constraint solving algorithm (soon for AssemblyScript / WebAssembly).
Home Page: https://codepen.io/trusktr/pen/abMLVxa
License: Other
Fast TypeScript implementation of the Cassowary constraint solving algorithm (soon for AssemblyScript / WebAssembly).
Home Page: https://codepen.io/trusktr/pen/abMLVxa
License: Other
Is there any easy way to see which variables have changed during a call to solver.updateVariables
? The api doesn't seem to give me a convenient way to incrementally update anything depending on the kiwi solver's state (such as UI), without checking each variable individually.
2 possible approaches for the API that spring to mind are:
type VariableConstructor = (name?: string, callback: (variable: Kiwi.Variable, new_value: any) => void) => Kiwi.Variable;
solver.updateVariables
type VariableValue = any;
type SolverUpdateVariables = (this: Kiwi.Solver) => [Kiwi.Variable, VariableValue][];
Thoughts?
Hey, it looks like the new version doesn't ship the types.
Could not find a declaration file for module '@lume/kiwi'. '...../node_modules/@lume/kiwi/dist/kiwi.js' implicitly has an 'any' type.
Try `npm i --save-dev @types/lume__kiwi` if it exists or add a new declaration (.d.ts) file containing `declare module '@lume/kiwi';`
"main": "dist/kiwi.js",
"types": "dist/kiwi.d.ts",
As far as I can tell, this library doesn't support squares or square roots. As a result, I'm not sure if the library even supports adding constraints that are distance-based. For example, a point (x1, y1) and point (x2, y2) with a constant distance as a constraint. Am I missing something?
Cheers Community,
I would like to build a lesson planner and am looking for a constrain solver in NodeJS. Currently I have found OptaPlanner as a Java variant and your kiwi.js npm package.
Does anyone have experience with constrain solvers in NodeJs environment (kiwi.js) and maybe with timetables?
Current "hard" constrains are:
The idea behind the constraint solver should be an automatic assignment of subjects/teachers/classes within given timeslots.
Thanks for your help!
Currently Kiwi code is compiled down to very old JavaScript, for which there's no need and will be a performance hit. Compile it to modern JavaScript. Also remove the UMD build, and just ship ES Modules.
I am trying to model a home battery solution, where I want to optimize profit from buying/selling energy.
The result should charge the battery on cheap hours, and sell it on expensive hours, given the constraints.
The battery has a minimum and maximum capacity (SOC: 0 ... 5 kWh)
The charging / discharging speed has a minimum and a maximum (load: -2 ... 2 kW)
The energy prices vary per hour, and are known 24 hours in advance. (price[1] .... price[24])
What I am able to do is model the SOC and LOAD constraints. And I can model the profit.hour[n] = load.hour[n] x price.hour[n].
The total profit (objective function) would be profit.hour[1] + profit.hour[2] + ..... + profit.hour[24]
But now the big issue: How do I optimize to get maximum profit? (or alternatively minimize for cost)? I would like to see for each hour what the optimum load should be.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.