|
| 1 | +# Installation Guide for PyBDR |
| 2 | + |
| 3 | +PyBDR is a set-boundary based reachability analysis toolbox for Python. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +- **Conda or Miniconda** ([Download here](https://docs.conda.io/en/latest/miniconda.html)) |
| 8 | +- Git (for cloning the repository) |
| 9 | + |
| 10 | +## Quick Installation (3 Steps) |
| 11 | + |
| 12 | +```bash |
| 13 | +# Step 1: Create conda environment with all dependencies |
| 14 | +conda env create -f environment.yml |
| 15 | + |
| 16 | +# Step 2: Activate the environment |
| 17 | +conda activate pybdr |
| 18 | + |
| 19 | +# Step 3: Install PyBDR |
| 20 | +pip install -e . |
| 21 | +``` |
| 22 | + |
| 23 | +**That's it!** The `environment.yml` automatically installs Python 3.8+, all dependencies, and the required `cddlib` C library. |
| 24 | + |
| 25 | +## Alternative: Install in Existing Conda Environment |
| 26 | + |
| 27 | +If you already have a conda environment: |
| 28 | + |
| 29 | +```bash |
| 30 | +# Activate your environment |
| 31 | +conda activate your_env_name |
| 32 | + |
| 33 | +# Install cddlib C library |
| 34 | +conda install -c conda-forge cddlib |
| 35 | + |
| 36 | +# Install PyBDR (this will install all Python dependencies including codac pre-release) |
| 37 | +pip install -e . |
| 38 | +``` |
| 39 | + |
| 40 | +## For Developers |
| 41 | + |
| 42 | +```bash |
| 43 | +# Clone and setup |
| 44 | +git clone https://github.com/ASAG-ISCAS/PyBDR.git |
| 45 | +cd PyBDR |
| 46 | +conda env create -f environment.yml |
| 47 | +conda activate pybdr |
| 48 | + |
| 49 | +# Install with development dependencies |
| 50 | +pip install -e ".[dev]" |
| 51 | + |
| 52 | +# Run tests |
| 53 | +pytest |
| 54 | +``` |
| 55 | + |
| 56 | +## Verifying Installation |
| 57 | + |
| 58 | +After installation, verify that PyBDR is correctly installed: |
| 59 | + |
| 60 | +```python |
| 61 | +import pybdr |
| 62 | +from pybdr.geometry import Interval, Zonotope |
| 63 | +from pybdr.algorithm import ASB2008CDC |
| 64 | + |
| 65 | +# Create a simple interval |
| 66 | +interval = Interval([0, 1], [1, 2]) |
| 67 | +print(f"Interval created: {interval}") |
| 68 | + |
| 69 | +print("PyBDR successfully installed!") |
| 70 | +``` |
| 71 | + |
| 72 | +## Troubleshooting |
| 73 | + |
| 74 | +### Issue: `pycddlib` build fails with "cddlib/setoper.h not found" |
| 75 | + |
| 76 | +**Cause**: The `cddlib` C library is not installed. |
| 77 | + |
| 78 | +**Solution**: Make sure you've installed `cddlib` via conda: |
| 79 | + |
| 80 | +```bash |
| 81 | +conda install -c conda-forge cddlib |
| 82 | +``` |
| 83 | + |
| 84 | +### Issue: CVXPY installation fails |
| 85 | + |
| 86 | +**Solution**: CVXPY is included in `environment.yml`. If you're installing manually, use conda: |
| 87 | + |
| 88 | +```bash |
| 89 | +conda install -c conda-forge cvxpy |
| 90 | +``` |
| 91 | + |
| 92 | +### Issue: "No module named 'pybdr'" after installation |
| 93 | + |
| 94 | +**Solution**: Make sure you've activated the correct conda environment: |
| 95 | + |
| 96 | +```bash |
| 97 | +conda activate pybdr |
| 98 | +``` |
| 99 | + |
| 100 | +### Issue: Codac installation or "No module named 'codac'" |
| 101 | + |
| 102 | +**Cause**: Codac v2 is only available as a pre-release version. |
| 103 | + |
| 104 | +**Solution**: Codac pre-release is automatically included when you run `pip install -e .`. If you need to install it manually: |
| 105 | + |
| 106 | +```bash |
| 107 | +pip install "codac>=2.0.0.dev20" |
| 108 | +``` |
| 109 | + |
| 110 | +Or reinstall PyBDR: |
| 111 | + |
| 112 | +```bash |
| 113 | +pip install -e . --force-reinstall |
| 114 | +``` |
| 115 | + |
| 116 | +## Package Structure |
| 117 | + |
| 118 | +After installation, PyBDR provides the following modules: |
| 119 | + |
| 120 | +``` |
| 121 | +pybdr/ |
| 122 | +├── algorithm/ # Reachability analysis algorithms |
| 123 | +├── dynamic_system/ # System models (continuous, discrete, hybrid) |
| 124 | +├── geometry/ # Geometric representations (intervals, zonotopes, polytopes) |
| 125 | +├── model/ # Pre-defined system models |
| 126 | +├── util/ # Utility functions |
| 127 | +└── misc/ # Miscellaneous utilities |
| 128 | +``` |
| 129 | + |
| 130 | +## Updating PyBDR |
| 131 | + |
| 132 | +If you installed in development mode (`pip install -e .`), simply pull the latest changes: |
| 133 | + |
| 134 | +```bash |
| 135 | +cd PyBDR |
| 136 | +git pull origin master |
| 137 | +``` |
| 138 | + |
| 139 | +## Uninstalling |
| 140 | + |
| 141 | +To remove PyBDR: |
| 142 | + |
| 143 | +```bash |
| 144 | +pip uninstall pybdr |
| 145 | +``` |
| 146 | + |
| 147 | +To remove the entire conda environment: |
| 148 | + |
| 149 | +```bash |
| 150 | +conda deactivate |
| 151 | +conda env remove -n pybdr |
| 152 | +``` |
| 153 | + |
| 154 | +## Support |
| 155 | + |
| 156 | +For issues and questions: |
| 157 | + |
| 158 | +- GitHub Issues: https://github.com/ASAG-ISCAS/PyBDR/issues |
| 159 | +- Documentation: https://asag-iscas.github.io/docs.pybdr/ |
| 160 | + |
| 161 | +## Dependencies |
| 162 | + |
| 163 | +PyBDR depends on: |
| 164 | + |
| 165 | +- **numpy** (≥1.20.0): Numerical computations |
| 166 | +- **scipy** (≥1.7.0): Scientific computing |
| 167 | +- **pypoman** (≥0.5.4): Polytope manipulation |
| 168 | +- **cvxpy** (≥1.1.0): Convex optimization |
| 169 | +- **matplotlib** (≥3.3.0): Visualization |
| 170 | + |
| 171 | +**System dependencies (automatically installed via conda):** |
| 172 | + |
| 173 | +- **cddlib**: C library for polytope computations (required by pypoman) |
| 174 | + |
| 175 | +All dependencies are automatically installed when using the `environment.yml` file with conda. |
0 commit comments