1.2.1 • Published 4 years ago

dcgp v1.2.1

Weekly downloads
5
License
ISC
Repository
github
Last release
4 years ago

dcgp.js

JavaScript bindings for the differential Cartesian Genetic Programming library. The goal of this project is to provide a library that can run dcgp both on node.js and the web.

Installation

Install dcgp.js with npm:

npm install dcgp

Usage

import { initialise, KernelSet, Expression, algorithms } from 'dcgp'

await initialise(/* specify custom path to dcgp.wasm */);
const myKernelSet = new KernelSet('sum', 'diff', 'mul', 'div');
const myExpression = new Expression(2, 1, 2, 6, 5, 2, myKernelSet, 5);

// some simple dataset: y = 2x + 2
const inputs = [[0, 1, 2, 3, 4]];
const outputs = [[2, 4, 6, 8, 10]];

const { loss } = algorithms.muPlusLambda(myExpression, 2, 5, 50, inputs, outputs, [1]);

// Free memory 
myKernelSet.destroy()
myExpression.destroy()

Development

Anyone is welcome to help progress and improve this library. Tasks and issues can be found in the issues tab. If your problem/task is not in the tasks, feel free to create a new issue explaining your problem/task.

Prerequisite

  • docker

Installation

Note: the instructions shown below assume Linux or macOS. Comments are provided with instructions for Windows.

git clone https://github.com/mikeheddes/dcgp.js.git

cd dcgp.js

# Start the 32bit ubuntu image with all dcgp.js' dependencies installed
# Note: make sure the docker daemon is running
docker run -it -v "$(pwd):/root/repo" -w /root/repo mikeheddes/dcgp.js-dependencies bash

# Command for windows
# docker run -it -v "%CD%:/root/repo" -w /root/repo mikeheddes/dcgp.js-dependencies bash

# A bash environment will open
npm install

npm run build

# To test the generated bundle in the browser run the following command
npx http-server lib

# To leave the bash environment run
exit

VSCode IntelliSense support

To have IntelliSense support for the C++ files the include folder from the container needs to be copied to the local file system. For this you can use the following commands ones the docker images mikeheddes/dcgp.js-dependencies is running.

# Copy the container ID 
docker ps
docker cp REPLACE_WITH_THE_ID:/usr/local/include ./
docker cp REPLACE_WITH_THE_ID:/root/emsdk/emscripten/tag-1.38.30/system/include/ ./
docker cp REPLACE_WITH_THE_ID:/usr/include/eigen3 ./include/
1.2.1

4 years ago

1.2.0

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago

1.0.0-beta.6

5 years ago

1.0.0-beta.5

5 years ago

1.0.0-beta.4

5 years ago

1.0.0-beta.3

5 years ago

1.0.0-beta.2

5 years ago

1.0.0-beta.1

5 years ago

1.0.0-beta.0

5 years ago

0.5.1

5 years ago

0.5.0

5 years ago

0.4.7

5 years ago

0.4.6

5 years ago

0.4.5

5 years ago

0.4.4

5 years ago

0.4.3

5 years ago

0.4.2

5 years ago

0.4.1

5 years ago

0.4.0

5 years ago

0.3.0

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago

0.0.1

5 years ago