Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tfussell committed Mar 25, 2016
0 parents commit bf548aa
Show file tree
Hide file tree
Showing 70 changed files with 5,753 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
*~
#*#
.DS_Store
*.sdf
*.suo
*.opensdf
*.vcxproj.user
*.o
*.d
build*/
third-party/
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "viewer"]
path = viewer
url = [email protected]:tfussell/cort.git
branch = gh-pages
95 changes: 95 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
cmake_minimum_required(VERSION 3.4.3)

if(NOT DEFINED CMAKE_SUPPRESS_DEVELOPER_WARNINGS)
set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS 1 CACHE INTERNAL "No dev warnings")
endif()

option(DEBUG "Set to ON to for debug configuration" OFF)
option(ASMJS "Set to OFF to skip compiling ${PROJECT_NAME} as an emscripten library to be run in the browser" ON)
option(SERVER "Set to ON to compile a standalone executable which acts as a server" OFF)

if(ASMJS)
set(CMAKE_CXX_COMPILER em++)
set(CMAKE_C_COMPILER emcc)
include_directories(SYSTEM /usr/local/include)
set(CMAKE_CXX_CREATE_STATIC_LIBRARY "em++ <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
endif()


project(cort)


if(ASMJS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-warn-absolute-paths")
endif()

if(CMAKE_CONFIGURATION_TYPES)
if(DEBUG)
set(CMAKE_BUILD_TYPE "Debug")
else()
set(CMAKE_BUILD_TYPE "Release")
endif()
endif()

if(APPLE)
execute_process(COMMAND "sw_vers -productVersion | awk -F'.' '{print $1\".\"$2}'"
OUTPUT_VARIABLE OSX_VERSION)
set(CMAKE_OSX_DEPLOYMENT_TARGET ${OSX_VERSION})
endif(APPLE)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

set(PROJECT_VENDOR "Thomas Fussell")
set(PROJECT_CONTACT "[email protected]")
set(PROJECT_URL "https://github.com/tfussell/cort")
set(PROJECT_DESCRIPTION "A biological neural network simulation platform")

set(PROJECT_VERSION_MAJOR "0")
set(PROJECT_VERSION_MINOR "9")
set(PROJECT_VERSION_PATCH "0")
set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}")
set(PROJECT_VERSION_FULL "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")

set(LIBRARY_VERSION ${PROJECT_VERSION_FULL})

include_directories(source)

file(GLOB BRAIN_SOURCES source/brain/*.*pp)
source_group(brain FILES ${BRAIN_SOURCES})
file(GLOB INTERFACE_SOURCES source/interface/*.*pp)
source_group(interface FILES ${INTERFACE_SOURCES})
file(GLOB MATH_SOURCES source/math/*.*pp)
source_group(math FILES ${MATH_SOURCES})
file(GLOB SIMULATION_SOURCES source/simulation/*.*pp)
source_group(simulation FILES ${SIMULATION_SOURCES})

set(SOURCES ${BRAIN_SOURCES} ${INTERFACE_SOURCES} ${MATH_SOURCES} ${SIMULATION_SOURCES})

if(SERVER)
file(GLOB SERVER_SOURCES source/server/*.*pp)
source_group(server FILES ${SERVER_SOURCES})

add_executable(cort ${SOURCES} ${SERVER_SOURCES})
target_link_libraries(cort boost_system)

add_custom_command(TARGET cort
POST_BUILD
COMMAND cp cort ../viewer
COMMAND cd ../viewer && ./cort
DEPENDS cort)
else()
file(GLOB EMBIND_SOURCES source/embind/*.*pp)
source_group(embind FILES ${EMBIND_SOURCES})

add_library(cort.js STATIC ${SOURCES} ${EMBIND_SOURCES})

set_target_properties(cort.js PROPERTIES PREFIX "")
set_target_properties(cort.js PROPERTIES SUFFIX ".bc")

add_custom_command(TARGET cort.js
POST_BUILD
COMMAND emcc cort.js.bc -o cort.js --bind
COMMAND cp cort.js ../viewer/js/cort.js
COMMAND cd ../viewer && python3 -m http.server
DEPENDS cort.js.bc)
endif()
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2006-2014 Thomas Fussell

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<img height="100" src="http://tfussell.github.io/cort/images/cort.png"><br/>
====
cort is a platform for simulating, exploring, evolving, and interacting with biologically-inspired neural networks. It is written in C++, but can be compiled into JavaScript using Emscripten for easy cross-platform deployment.

To try cort, click on [this demo](http://tfussell.github.io/cort/demo).

Build
=====
This repository includes the latest emscripten compiled version of cort in bin/cort.html. If you'd like to compile cort yourself, make sure you have a C++ compiler that supports C++11, an updated browser, and emscripten.

1. Copy repository

git clone https://github.com/tfussell/cort
2. Compile using premake and platform build system

cd cort/build && ./build-emscripten.sh
3. Run/view the simulation

open cort/bin/cort.html

License
=======
cort is licenced under the MIT license.
cort uses a modified version of [nxxcxx's Neural-Network](https://github.com/nxxcxx/Neural-Network) for visualization which is in turn based on [three.js](http://threejs.org). Both of these are also licensed under the MIT license.
12 changes: 12 additions & 0 deletions docs/intro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Structure
=========
cort uses a modified client-server model. The optional client-side allows for visualization of and interaction with the current simulation and runs in the browser. The server-side is a simulation written in C++ containing a brain model defined by a JSON file.
From highest to lowest level, the structure of the server-side looks like:
Simulation - A simulation holds zero or more entities. There is only one simulation per instance of Cort. The simulation proceeds in a series of steps. In each step, every entity is updated in an arbitrary order. Every step represents a predetermined amount of time. A simulation continues until the application exits.
Entity - An entity is anything that can be simulated indepedently of other entities. It receives its inputs from other entities and the environment (part of the Simulation) and then creates outputs which affect other entities or change the environment. Every entity is created based on a JSON file.
Brain(Entity) - A brain is a type of entity. A brain is composed of zero or more layers.
Layer - A layer is a set of neurons which are created according to a certain pattern. We know that there is insufficient information in the human DNA to determine the type, position, behavior, etc. of every neuron so neurons must be created based on a generative algorithm. In general, a Layer is categorized by its dimension: 1D, 2D, or 3D.
Neuron - A neuron is the funademntal unit of compuation. Updating a neuron occurs in two steps. First, every neuron updates its membrane potential based on signals that were transmitted by presynaptic neurons and subsequently opened membrane receptors.
Connection
Synapse
Neurotransmitter
28 changes: 28 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "cort",
"version": "0.1.0",
"description": "a platform for simulating and interacting with neural networks",
"main": "index.js",
"directories": {
"doc": "docs"
},
"scripts": {
"test": "make -C build/gmake test"
},
"repository": {
"type": "git",
"url": "https://github.com/tfussell/cort"
},
"keywords": [
"bnn",
"ann",
"neural",
"threejs"
],
"author": "Thomas Fussell <[email protected]> (https://thomas.fussell.io)",
"license": "MIT",
"bugs": {
"url": "https://github.com/tfussell/cort/issues"
},
"homepage": "https://github.com/tfussell/cort"
}
Binary file added resources/cort.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit bf548aa

Please sign in to comment.