Installation

This guide will help you install OptiX and its dependencies on your system.

System Requirements

Python Requirements

OptiX requires Python 3.12 or higher. Check your Python version:

python --version

If you need to install or upgrade Python, visit the official Python website.

Poetry Installation

OptiX uses Poetry for dependency management. Install Poetry:

curl -sSL https://install.python-poetry.org | python3 -

Verify Poetry installation:

poetry --version

Hardware Recommendations

Component

Minimum

Recommended

CPU

Dual-core processor

Quad-core or higher

RAM

4GB

8GB or more

Storage

1GB free space

5GB+ for development

Network

Internet connection for installation

Stable connection for updates

Installing OptiX

Clone the Repository

# Clone from GitHub
git clone https://github.com/yourusername/optix.git
cd OptiX

Install Dependencies

# Install all dependencies including development tools
poetry install

# Install only production dependencies
poetry install --no-dev

Activate Virtual Environment

# Activate the Poetry virtual environment
poetry shell

# Or run commands with Poetry
poetry run python your_script.py

Solver Installation

OptiX supports multiple optimization solvers. Install the ones you need:

Gurobi (Commercial)

Download and Install Gurobi

  1. Visit Gurobi Downloads

  2. Create a free account

  3. Download the appropriate version for your platform

  4. Follow the installation instructions for your operating system

Get a License

  1. Visit Gurobi Academic Licenses

  2. Register with your academic email

  3. Download the license file

  4. Follow activation instructions

Set Environment Variables

Add to your .bashrc or .zshrc:

export GUROBI_HOME="/opt/gurobi1000/linux64"
export PATH="${PATH}:${GUROBI_HOME}/bin"
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${GUROBI_HOME}/lib"

Install Python Interface

# Install Gurobi Python package
poetry run pip install gurobipy

# Verify installation
poetry run python -c "import gurobipy; print('Gurobi installed successfully')"

Alternative Installation Methods

Development Installation

For contributing to OptiX development:

# Clone the repository
git clone https://github.com/yourusername/optix.git
cd OptiX

# Install with development dependencies
poetry install --with dev,test,docs

# Install pre-commit hooks
poetry run pre-commit install

# Run tests to verify installation
poetry run pytest

Verification

Test your installation with this simple script:

# test_installation.py
from problem import OXLPProblem, ObjectiveType
from constraints import RelationalOperators
from solvers import solve, get_available_solvers

def test_installation():
    print("=== OptiX Installation Test ===")

    # Check available solvers
    solvers = get_available_solvers()
    print(f"Available solvers: {solvers}")

    # Create a simple problem
    problem = OXLPProblem()
    problem.create_decision_variable("x", "Test variable", 0, 10)

    problem.create_constraint(
        variables=[problem.variables[0].id],
        weights=[1],
        operator=RelationalOperators.LESS_THAN_EQUAL,
        value=5
    )

    problem.create_objective_function(
        variables=[problem.variables[0].id],
        weights=[1],
        objective_type=ObjectiveType.MAXIMIZE
    )

    # Test solving
    for solver in solvers:
        try:
            status, solution = solve(problem, solver)
            print(f"✅ {solver}: {status}")
            if solution:
                print(f"   Objective value: {solution[0].objective_value}")
        except Exception as e:
            print(f"❌ {solver}: {e}")

    print("\n✅ Installation test completed!")

if __name__ == "__main__":
    test_installation()

Run the test:

poetry run python test_installation.py

Troubleshooting

Common Issues

Poetry not found

# Add Poetry to PATH (macOS/Linux)
export PATH="$HOME/.local/bin:$PATH"

# Restart your terminal and try again

OR-Tools import error

# Reinstall OR-Tools
poetry run pip uninstall ortools-python
poetry install --force

Gurobi license error

# Check license status
grbgetkey your-license-key

# Verify license file location
echo $GRB_LICENSE_FILE

Permission errors (Linux/macOS)

# Fix permissions for Poetry installation
sudo chown -R $(whoami) ~/.local/share/pypoetry

Getting Help

If you encounter issues:

  1. Check the GitHub Issues page

  2. Review the ../development/troubleshooting section

  3. Join our community discussions

  4. Contact the development team

Tip

Quick Start: Once installed, head to the Quick Start Guide guide to create your first optimization problem!

Note

Performance Note: For large-scale problems, consider installing Gurobi for better performance, especially for mixed-integer programming problems.