A Unified Computing Framework Based on Constrained Object Hierarchies (COH)
The GISMOL Toolkit is an open‑source Python framework implementing Constrained Object Hierarchies (COH) — a unified, declarative computational model for describing intelligent systems, agents, environments, learning processes, constraint‑based reasoning, and simulation.
GISMOL provides:
- A minimal but powerful COH object model
- Dynamic methods, attributes, and constraints
- Daemons for event‑driven or continuous simulation
- Integrated NeuralModule wrappers (PyTorch‑based)
- Tools for reinforcement learning, environment modeling, and policy learning
- A high‑performance Simulator for COH execution
- Interactive demos and visualizations, including a Gridworld RL environment with live training metrics and policy visualization
- A universal representation of systems as nested, constrained objects.
- Identity, structural, and behavioral constraints.
- Dynamically attachable methods, neural modules, and daemons.
- A fully event‑driven Simulator executing COH methods with time steps.
- Supports reactive agents, continuous daemons, and hybrid systems.
- Integrated Q-learning utilities.
- Policy networks via PyTorch wrapped in
NeuralModule. - Potential‑based reward shaping.
- Step‑wise and episode‑wise hooks for logging metrics.
- Built‑in
Daemon‑based visualizers (Matplotlib). - Heatmaps, policy arrows, agent trails, and constraint indicators.
- Option‑C Multi‑Panel Layout:
- Left: Gridworld
- Right: Policy Arrow Field
- Bottom: Training Loss & Episode Returns
- Keyboard control (W/A/S/D, arrows, space) with auto‑repeat.
- Consistent 1120×800 frame size.
- No frame mismatches.
- Export to GIF or MP4 (ffmpeg required for MP4).
.gitignoredefaults for Python, virtualenvs, cache directories.- Recommended Git LFS for large models, datasets, or media.
- Python 3.10+
- PyTorch 2.x
- Matplotlib
- ImageIO (for rendering/export)
- ffmpeg (optional, MP4 export)
pip install -r requirements.txtpip install -e .gismol/
│
├── core/ # COH core classes & engine
│ ├── coh.py # COH object model
│ ├── daemon.py # Daemon base class
│ ├── simulator.py # Simulator engine
│ ├── neural.py # NeuralModule (PyTorch)
│ └── __init__.py
│
├── examples/
│ ├── gridworld_advanced.py # Full demo with visualization + RL + export
│ ├── basic_demo.py
│ └── ...
│
├── tests/
│
├── README.md
└── setup.py
python examples/gridworld_advanced.py --mode interactiveControls:
| Key | Action |
|---|---|
| W / ↑ | Move up |
| S / ↓ | Move down |
| A / ← | Move left |
| D / → | Move right |
| Space | Wait |
| Hold keys | Auto‑repeat movement |
python examples/gridworld_advanced.py --mode train --episodes 30At the end of training, the demo:
- runs a greedy policy rollout
- exports
gridworld.gif(andgridworld.mp4if ffmpeg is available)
A Constrained Object Hierarchy is a tree of objects obeying:
- Identity Constraints: truths that must always hold
- Structural Constraints: shape and organization of the hierarchy
- Behavioral Constraints: methods and interactions
Every COH object contains:
- attributes: dynamic state
- children: nested objects
- methods: executable behaviors
- neural modules: learned components
- daemons: continuous processes
This allows building:
- RL environments
- Multi‑agent systems
- Planning/constraint systems
- Hybrid symbolic‑neural architectures
- Simulators and interactive demos
… all from the same unified model.
The advanced Gridworld environment demonstrates nearly every COH capability:
A rich environment ideal for:
- Teaching RL
- Demonstrating COH
- Comparing policies
- Visualizing value functions
- Experimenting with reward shaping
GIF requires only ImageIO:
imageio.mimsave("gridworld.gif", frames, fps=6)For MP4:
sudo apt install ffmpegor on macOS:
brew install ffmpegpip install -r requirements-dev.txtpytest -q- Black
- isort
- flake8
Contributions are welcome!
- Fork the repository
- Create a feature branch
- Add tests where appropriate
- Submit a pull request
Please follow:
- PEP8 style
- Write clear commit messages
- Avoid committing large binaries (use LFS)
- Stable release v1.0
- Additional RL algorithms (PPO, DQN, A2C)
- COH‑based multi‑agent GPU simulator
- WebGL visualization front‑end
- Tutorial notebooks
- Benchmark suite
MIT License — see LICENSE.
Dr. Harris Wang
Computing & Information Systems
Athabasca University, Canada
- A GitHub wiki
- A quickstart tutorial
- A logo/badge set
- A landing page for GitHub Pages