treemun-sim


Nametreemun-sim JSON
Version 1.1.5 PyPI version JSON
download
home_pagehttps://github.com/fulloaf/treemun
SummaryGrowth, yield, and management simulator for Chilean plantation forests
upload_time2025-09-15 10:27:15
maintainerNone
docs_urlNone
authorFelipe Ulloa-Fierro
requires_python>=3.8
licenseNone
keywords plantation forest simulation biomass growth management policies optimization forest management
VCS
bugtrack_url
requirements numpy pandas
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Treemun: a growth and yield simulator for chilean plantation forest

[![PyPI version](https://badge.fury.io/py/treemun-sim.svg)](https://badge.fury.io/py/treemun-sim)
[![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

A Python package that implements a discrete-time simulation framework for evaluating management policies in Pinus radiata and Eucalyptus globulus forest stands, with integrated optimization capabilities for forest management planning.

**Key Features:**
- Forest growth simulation for Pinus and Eucalyptus species
- Multiple configurable management policies
- Total aereal biomass calculation using allometric equations (based on Miranda et al. (2023) report)
- Random forest landscape generation (instance building)
- Includes a forest management optimization model example
- Support for multiple optimization solvers
- Data preparation for optimization algorithms
- Guaranteed reproducibility through seeds

## Mathematical Model

The optimization module implements a Mixed-Integer Linear Programming (MILP) model for strategic forest management planning, extending Johnson and Scheurman's (1977) Model I formulation to address multi-species plantation management.

**Problem Formulation**

The model addresses the landscape-level forest management problem where a heterogeneous forest landscape is partitioned into a set I of management units (stands) that can be managed using different policies j ∈ J over a planning horizon T. The objective is to determine the optimal policy assignment for each stand to maximize the **Net Present Value (NPV)** of biomass collection while ensuring sustainability and even-flow constraints.

**Decision Variables and Parameters**

**Decision Variables:**

- *x<sub>ij</sub>*: Binary variable indicating whether policy *j* is assigned to stand *i* (*x<sub>ij</sub>* = 1 if assigned, 0 otherwise)
- *v<sub>t</sub>*: Auxiliary continuous variable tracking total biomass collected in period *t*

**Parameters:**
- *a<sub>ijt</sub>*: Biomass collected from stand *i* under policy *j* in period *t* (m³)
- *a<sub>ij</sub><sup>T</sup>*: Standing biomass in stand *i* under policy *j* at the end of planning horizon (m³)
- *r<sup>t</sup>*: Biomass revenue in period *t* ($/m³)
- *τ*: Annual discount rate
- *B*: Minimum required standing biomass at planning horizon end (m³)


### Model Formulation

0. **Objective Function** (NPV Maximization):
   $$\text{maximize } \sum_{i \in I} \sum_{j \in J} \sum_{t \in T} \frac{r^t \cdot a_{ijt} \cdot x_{ij}}{(1+\tau)^t}$$

**Subject to:**

1. **Single Policy Assignment Constraint:**
   $$\sum_{j \in J} x_{ij} = 1 \quad \forall i \in I$$

2. **Biomass Collection Tracking:**
   $$\sum_{i \in I} \sum_{j \in J} a_{ijt} \cdot x_{ij} = v_t \quad \forall t \in T$$

3. **Even-Flow Constraint** (Non-decreasing harvest):
   $$v_{t+1} \geq v_t \quad \forall t \in T \setminus \{|T|\}$$

4. **Sustainability Constraint:**
   $$\sum_{i \in I} \sum_{j \in J} a_{ij}^T \cdot x_{ij} \geq B$$

5. **Variable Domains:**
   $$x_{ij} \in \{0,1\} \quad \forall i \in I, j \in J$$
   $$v_t \geq 0 \quad \forall t \in T$$

This formulation seek to identify landscape’s policy plan that maximizes the NPV across the planning horizon (Eq. 0) considering that: (i) at most one policy j is selected for each stand i (Eq. 1), (ii) the biomass collected is non-decreasing over time, therefore the biomass collected in period t + 1 must be at least as much as in period t (Eqs. 2 & 3), and (iii) at the end of the planning horizon, a minimum total amount of standing biomass (defined as B) is guaranteed (Eq. 4). The last restriction (Eq. 5) refers to the nature of the variables. 

## Installation

### Basic Installation
```bash
pip install treemun-sim
```

### Installation with Optimization Solvers
```bash
# With free CBC solver (recommended)
pip install treemun-sim[solvers]

# With commercial solvers (requires licenses)
pip install treemun-sim[solvers-extended]

# Complete installation with development tools
pip install treemun-sim[complete]
```

### Solver Requirements
- **CBC**: ✅ Included with `[solvers]` installation
- **CPLEX**: Requires IBM ILOG CPLEX license

## Basic Usage

### Forest Simulation
```python
import treemun_sim as tm

# Simulation with default parameters
forest, summary, final_biomass, collected_biomass = tm.simular_bosque()

print(f"Generated {len(forest)} stand-policy combinations")
print(f"Total optimization data points: {len(collected_biomass)}")
```

### Forest Management Optimization
```python
import treemun_sim as tm

# Generate forest data

horizon = 15
num_stands = 100

forest, summary, final_biomass, collected_biomass = tm.simular_bosque(
    horizonte=horizon,
    num_rodales=num_stands
)

# Create optimization model
model = tm.forest_management_optimization_model(
    bosque=forest,
    a_i_j_T=final_biomass,
    a_i_j_t=collected_biomass,
    horizon=horizon,
    pine_revenue=12,           # $/m³
    eucalyptus_revenue=10,     # $/m³
    min_ending_biomass=25000,  # m³
    discount_rate=0.08         # 8% annual
)

# Solve model
results = tm.solve_model(model, solver_name='cbc', gap=0.01)

# Extract solution
solution = tm.extract_results(model, results)

if solution:
    print(f"Optimal NPV: ${solution['objective_value']:,.2f}")
    print(f"Pine stands managed: {solution['total_pinus_stand_treated']}")
    print(f"Pine stands planning: {solution['pinus_stand_plan']}")
    print(f"Eucalyptus stands managed: {solution['total_eucalyptus_stand_treated']}")
    print(f"Eucalyptus stands planning: {solution['eucalyptus_stand_plan']}")
    print("Total biomass collected per period:", solution['total_harvest_per_period'])
```

## Visual Examples

The following figures illustrate how different management policies affect biomass dynamics over time (30 years horizon) for representative stands:

### Pinus radiata Stand Simulation
![Pinus radiata policies](treemun/docs/images/grafico_final_policies_pino.png)

The figure shows three management policies applied to a single Pinus radiata stand:
- **Policy 1**: Thinning at 12 years, harvest at 24 years (longer rotation)
- **Policy 2**: Thinning at 9 years, harvest at 18 years (intensive management)
- **Policy 3**: Thinning at 11 years, harvest at 20 years (intermediate strategy)

Each policy produces different biomass trajectories, affecting both total yield and temporal distribution of harvests.

### Eucalyptus globulus Stand Simulation
![Eucalyptus globulus policies](treemun/docs/images/grafico_final_policies_eucalipto.png)

The figure demonstrates three harvest-only policies for an Eucalyptus globulus stand:
- **Policy 1**: 10-year rotations (frequent short rotations)
- **Policy 2**: 11-year rotations (moderate cycle)
- **Policy 3**: 12-year rotations (longer maturation period)

The visualization shows how rotation length affects cumulative biomass production and harvest timing across the planning horizon.

These examples demonstrate the package's capability to simulate complex stand dynamics under different management regimes, providing the foundation data for optimization models.

## Advanced Usage

### Custom Simulation Parameters
```python
import treemun_sim as tm

# Custom simulation
forest, summary, final_biomass, collected_biomass = tm.simular_bosque(
    policies_pino=[(9, 18), (10, 20), (11, 22)],  # (thinning, harvest)
    policies_eucalyptus=[(9,), (10,), (11,)],     # (harvest,)
    horizonte=15,
    num_rodales=100,
    semilla=1234
)

# Results analysis
for i, df in enumerate(forest[:3]):  # First 3 stands
    print(f"Stand {i+1}:")
    print(f"  - Species: {df['Especie'].iloc[0]}")
    print(f"  - Policy: {df['politica'].iloc[0]}")
    print(f"  - Final biomass: {df['biomasa'].iloc[-1]:.2f} tons")
```

### Variable Revenue in Optimization
```python
# Variable revenue over time
pine_revenues = [10, 11, 12, 13, 14]  # Increasing revenues for 5-year horizon
eucalyptus_revenues = [8, 9, 10, 11, 12]

model = tm.forest_management_optimization_model(
    bosque=forest,
    a_i_j_T=final_biomass,
    a_i_j_t=collected_biomass,
    horizon=15,
    pine_revenue=pine_revenues,        # Variable revenue
    eucalyptus_revenue=eucalyptus_revenues,
    min_ending_biomass=25000,
    discount_rate=0.08
)
```

## API Reference

### Simulation Function

#### `simular_bosque()`

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `policies_pino` | `List[Tuple[int, int]]` | 16 policies | Pine policies: `[(thinning_age, harvest_age), ...]` |
| `policies_eucalyptus` | `List[Tuple[int]]` | 4 policies | Eucalyptus policies: `[(harvest_age,), ...]` |
| `horizonte` | `int` | 30 | Time horizon in years |
| `num_rodales` | `int` | 100 | Number of stands to generate |
| `semilla` | `int` | 5555 | Seed for reproducibility |

### Optimization Functions

#### `forest_management_optimization_model()`

| Parameter | Type | Description |
|-----------|------|-------------|
| `bosque` | `List[pd.DataFrame]` | Forest simulation data |
| `a_i_j_T` | `Dict` | Final standing biomass by stand-policy |
| `a_i_j_t` | `Dict` | Harvestable biomass by period |
| `horizon` | `int` | Planning horizon in years |
| `pine_revenue` | `float` or `List[float]` | Pine biomass revenue ($/m³) |
| `eucalyptus_revenue` | `float` or `List[float]` | Eucalyptus biomass revenue ($/m³) |
| `min_ending_biomass` | `float` | Minimum final period biomass guaranteed |
| `discount_rate` | `float` | Annual discount rate for NPV |

#### `solve_model()`

| Parameter | Type | Description |
|-----------|------|-------------|
| `model` | `ConcreteModel` | Pyomo optimization model |
| `solver_name` | `str` | Solver name ('cbc', 'cplex') |
| `gap` | `float` | Relative optimality gap (default: 0.01) |
| `executable_path` | `str` | Path to solver executable (optional) |
| `tee` | `bool` | Display solver output (default: True) |

#### `extract_results()`

Returns a dictionary with:
- `objective_value`: Optimal NPV for the planning
- `total_harvest_per_period`: Schedule for collected biomass 
- `pinus_stand_plan`: Policy assignments for pine stands
- `eucalyptus_stand_plan`: Policy assignments for eucalyptus stands
- `total_pinus_stand_treated`: Count of pine stands
- `total_eucalyptus_stand_treated`: Count of eucalyptus stands

## Output Data Structure

### Forest DataFrame
Each element in `forest` contains:
- `periodo`: Time period (1 to horizonte)
- `edad_rodal`: Stand age in each period
- `biomasa`: Total biomass in tons
- `bioOPT`: biomass collected in tons (considers only thinned and harvested biomass amounts)
- `condición`: Management status ("sin manejo" (no managed) / "con manejo" (managed)
- `kitral_class`: Classification according to Kitral's System (Chilean fuel model)
- `politica`: Applied policy identifier 

### Optimization Dictionaries
`collected_biomass structure:
```python
{
    (period, species, policy, stand_id): biomass_value,
    ...
}
```

`final_biomass structure:
```python
{
    (stand_id, policy): biomass_value,
    ...
}
```

## Supported Species

### Pinus
- **Policies**: Thinning + Harvest
- **Constraint**: Thinning age < harvest age 
- **Default policies**: 16 combinations (thinning ages: 9-12 years; harvest ages: 18-24 years)

### Eucalyptus
- **Policies**: Harvest only
- **Harvest ages**: Any year
- **Default policies**: 4 options (9-12 years)

## Use Cases

- **Forest research**: Analysis of different management strategies
- **Tactical and Strategic planning**: Mid/Long-term forest management optimization
- **Sustainability assessment**: Balancing economic and ecological objectives
- **Policy evaluation**: Comparing management alternatives performances
- **Education**: Teaching forest management and optimization concepts

## Solver Installation Guide

### Free Solvers
```bash
# CBC (recommended - included with treemun-sim[solvers])
pip install pulp

```

### Commercial Solvers
```bash
# CPLEX (requires IBM license)
pip install cplex

```

## Contributing

Contributions are welcome. To contribute:

1. Fork the repository
2. Create a feature branch
3. Commit your changes
4. Push to the branch
5. Open a Pull Request

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## Author

**Felipe Ulloa-Fierro**
- Email: felipe.ulloa@utalca.cl
- Institution: Universidad de Talca

## Reference

A. Miranda, B. Mola-Yudego, and V. Hinojosa. Stand-level biomass prediction models in Eucalyptus Globulus and Pinus Radiata plantations in south-central Chile. Technical report, University of Eastern Finland, September 2023.

Johnson, K. N., & Scheurman, H. L. (1977). Techniques for prescribing optimal timber harvest and investment under different objectives—discussion and synthesis. *Forest Science*, 23(suppl_1), a0001–z0001. https://doi.org/10.1093/FORESTSCIENCE/23.S1.A0001


## Citation

If you use Treemun in your research, you can cite it as:

```
Ulloa-Fierro, F. (2025). Treemun: A Growth and Yield Simulator for Chilean Plantation Forest. 
Python Package Version 1.1.5 https://pypi.org/project/treemun-sim/

```

## Acknowledgements

Author thanks to European Union’s Horizon 2020 Research and Innovation Programme under grant agreements Nos. 101037419–FIRE-RES and 101007950–DecisionES, and the support of National Agency for Research and Development (ANID, Chile) through the grant FONDECYT N.1220830, through the Complex Engineering Systems Institute PIA/PUENTE AFB230002.



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/fulloaf/treemun",
    "name": "treemun-sim",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "plantation forest, simulation, biomass growth, management policies, optimization, forest management",
    "author": "Felipe Ulloa-Fierro",
    "author_email": "felipe.ulloa@utalca.cl",
    "download_url": "https://files.pythonhosted.org/packages/0f/73/a3d1c4d88fc725a5609d645bc38de588e625fbe4126a756b1ee581d1c287/treemun_sim-1.1.5.tar.gz",
    "platform": null,
    "description": "# Treemun: a growth and yield simulator for chilean plantation forest\n\n[![PyPI version](https://badge.fury.io/py/treemun-sim.svg)](https://badge.fury.io/py/treemun-sim)\n[![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nA Python package that implements a discrete-time simulation framework for evaluating management policies in Pinus radiata and Eucalyptus globulus forest stands, with integrated optimization capabilities for forest management planning.\n\n**Key Features:**\n- Forest growth simulation for Pinus and Eucalyptus species\n- Multiple configurable management policies\n- Total aereal biomass calculation using allometric equations (based on Miranda et al. (2023) report)\n- Random forest landscape generation (instance building)\n- Includes a forest management optimization model example\n- Support for multiple optimization solvers\n- Data preparation for optimization algorithms\n- Guaranteed reproducibility through seeds\n\n## Mathematical Model\n\nThe optimization module implements a Mixed-Integer Linear Programming (MILP) model for strategic forest management planning, extending Johnson and Scheurman's (1977) Model I formulation to address multi-species plantation management.\n\n**Problem Formulation**\n\nThe model addresses the landscape-level forest management problem where a heterogeneous forest landscape is partitioned into a set I of management units (stands) that can be managed using different policies j \u2208 J over a planning horizon T. The objective is to determine the optimal policy assignment for each stand to maximize the **Net Present Value (NPV)** of biomass collection while ensuring sustainability and even-flow constraints.\n\n**Decision Variables and Parameters**\n\n**Decision Variables:**\n\n- *x<sub>ij</sub>*: Binary variable indicating whether policy *j* is assigned to stand *i* (*x<sub>ij</sub>* = 1 if assigned, 0 otherwise)\n- *v<sub>t</sub>*: Auxiliary continuous variable tracking total biomass collected in period *t*\n\n**Parameters:**\n- *a<sub>ijt</sub>*: Biomass collected from stand *i* under policy *j* in period *t* (m\u00b3)\n- *a<sub>ij</sub><sup>T</sup>*: Standing biomass in stand *i* under policy *j* at the end of planning horizon (m\u00b3)\n- *r<sup>t</sup>*: Biomass revenue in period *t* ($/m\u00b3)\n- *\u03c4*: Annual discount rate\n- *B*: Minimum required standing biomass at planning horizon end (m\u00b3)\n\n\n### Model Formulation\n\n0. **Objective Function** (NPV Maximization):\n   $$\\text{maximize } \\sum_{i \\in I} \\sum_{j \\in J} \\sum_{t \\in T} \\frac{r^t \\cdot a_{ijt} \\cdot x_{ij}}{(1+\\tau)^t}$$\n\n**Subject to:**\n\n1. **Single Policy Assignment Constraint:**\n   $$\\sum_{j \\in J} x_{ij} = 1 \\quad \\forall i \\in I$$\n\n2. **Biomass Collection Tracking:**\n   $$\\sum_{i \\in I} \\sum_{j \\in J} a_{ijt} \\cdot x_{ij} = v_t \\quad \\forall t \\in T$$\n\n3. **Even-Flow Constraint** (Non-decreasing harvest):\n   $$v_{t+1} \\geq v_t \\quad \\forall t \\in T \\setminus \\{|T|\\}$$\n\n4. **Sustainability Constraint:**\n   $$\\sum_{i \\in I} \\sum_{j \\in J} a_{ij}^T \\cdot x_{ij} \\geq B$$\n\n5. **Variable Domains:**\n   $$x_{ij} \\in \\{0,1\\} \\quad \\forall i \\in I, j \\in J$$\n   $$v_t \\geq 0 \\quad \\forall t \\in T$$\n\nThis formulation seek to identify landscape\u2019s policy plan that maximizes the NPV across the planning horizon (Eq. 0) considering that: (i) at most one policy j is selected for each stand i (Eq. 1), (ii) the biomass collected is non-decreasing over time, therefore the biomass collected in period t + 1 must be at least as much as in period t (Eqs. 2 & 3), and (iii) at the end of the planning horizon, a minimum total amount of standing biomass (defined as B) is guaranteed (Eq. 4). The last restriction (Eq. 5) refers to the nature of the variables. \n\n## Installation\n\n### Basic Installation\n```bash\npip install treemun-sim\n```\n\n### Installation with Optimization Solvers\n```bash\n# With free CBC solver (recommended)\npip install treemun-sim[solvers]\n\n# With commercial solvers (requires licenses)\npip install treemun-sim[solvers-extended]\n\n# Complete installation with development tools\npip install treemun-sim[complete]\n```\n\n### Solver Requirements\n- **CBC**: \u2705 Included with `[solvers]` installation\n- **CPLEX**: Requires IBM ILOG CPLEX license\n\n## Basic Usage\n\n### Forest Simulation\n```python\nimport treemun_sim as tm\n\n# Simulation with default parameters\nforest, summary, final_biomass, collected_biomass = tm.simular_bosque()\n\nprint(f\"Generated {len(forest)} stand-policy combinations\")\nprint(f\"Total optimization data points: {len(collected_biomass)}\")\n```\n\n### Forest Management Optimization\n```python\nimport treemun_sim as tm\n\n# Generate forest data\n\nhorizon = 15\nnum_stands = 100\n\nforest, summary, final_biomass, collected_biomass = tm.simular_bosque(\n    horizonte=horizon,\n    num_rodales=num_stands\n)\n\n# Create optimization model\nmodel = tm.forest_management_optimization_model(\n    bosque=forest,\n    a_i_j_T=final_biomass,\n    a_i_j_t=collected_biomass,\n    horizon=horizon,\n    pine_revenue=12,           # $/m\u00b3\n    eucalyptus_revenue=10,     # $/m\u00b3\n    min_ending_biomass=25000,  # m\u00b3\n    discount_rate=0.08         # 8% annual\n)\n\n# Solve model\nresults = tm.solve_model(model, solver_name='cbc', gap=0.01)\n\n# Extract solution\nsolution = tm.extract_results(model, results)\n\nif solution:\n    print(f\"Optimal NPV: ${solution['objective_value']:,.2f}\")\n    print(f\"Pine stands managed: {solution['total_pinus_stand_treated']}\")\n    print(f\"Pine stands planning: {solution['pinus_stand_plan']}\")\n    print(f\"Eucalyptus stands managed: {solution['total_eucalyptus_stand_treated']}\")\n    print(f\"Eucalyptus stands planning: {solution['eucalyptus_stand_plan']}\")\n    print(\"Total biomass collected per period:\", solution['total_harvest_per_period'])\n```\n\n## Visual Examples\n\nThe following figures illustrate how different management policies affect biomass dynamics over time (30 years horizon) for representative stands:\n\n### Pinus radiata Stand Simulation\n![Pinus radiata policies](treemun/docs/images/grafico_final_policies_pino.png)\n\nThe figure shows three management policies applied to a single Pinus radiata stand:\n- **Policy 1**: Thinning at 12 years, harvest at 24 years (longer rotation)\n- **Policy 2**: Thinning at 9 years, harvest at 18 years (intensive management)\n- **Policy 3**: Thinning at 11 years, harvest at 20 years (intermediate strategy)\n\nEach policy produces different biomass trajectories, affecting both total yield and temporal distribution of harvests.\n\n### Eucalyptus globulus Stand Simulation\n![Eucalyptus globulus policies](treemun/docs/images/grafico_final_policies_eucalipto.png)\n\nThe figure demonstrates three harvest-only policies for an Eucalyptus globulus stand:\n- **Policy 1**: 10-year rotations (frequent short rotations)\n- **Policy 2**: 11-year rotations (moderate cycle)\n- **Policy 3**: 12-year rotations (longer maturation period)\n\nThe visualization shows how rotation length affects cumulative biomass production and harvest timing across the planning horizon.\n\nThese examples demonstrate the package's capability to simulate complex stand dynamics under different management regimes, providing the foundation data for optimization models.\n\n## Advanced Usage\n\n### Custom Simulation Parameters\n```python\nimport treemun_sim as tm\n\n# Custom simulation\nforest, summary, final_biomass, collected_biomass = tm.simular_bosque(\n    policies_pino=[(9, 18), (10, 20), (11, 22)],  # (thinning, harvest)\n    policies_eucalyptus=[(9,), (10,), (11,)],     # (harvest,)\n    horizonte=15,\n    num_rodales=100,\n    semilla=1234\n)\n\n# Results analysis\nfor i, df in enumerate(forest[:3]):  # First 3 stands\n    print(f\"Stand {i+1}:\")\n    print(f\"  - Species: {df['Especie'].iloc[0]}\")\n    print(f\"  - Policy: {df['politica'].iloc[0]}\")\n    print(f\"  - Final biomass: {df['biomasa'].iloc[-1]:.2f} tons\")\n```\n\n### Variable Revenue in Optimization\n```python\n# Variable revenue over time\npine_revenues = [10, 11, 12, 13, 14]  # Increasing revenues for 5-year horizon\neucalyptus_revenues = [8, 9, 10, 11, 12]\n\nmodel = tm.forest_management_optimization_model(\n    bosque=forest,\n    a_i_j_T=final_biomass,\n    a_i_j_t=collected_biomass,\n    horizon=15,\n    pine_revenue=pine_revenues,        # Variable revenue\n    eucalyptus_revenue=eucalyptus_revenues,\n    min_ending_biomass=25000,\n    discount_rate=0.08\n)\n```\n\n## API Reference\n\n### Simulation Function\n\n#### `simular_bosque()`\n\n| Parameter | Type | Default | Description |\n|-----------|------|---------|-------------|\n| `policies_pino` | `List[Tuple[int, int]]` | 16 policies | Pine policies: `[(thinning_age, harvest_age), ...]` |\n| `policies_eucalyptus` | `List[Tuple[int]]` | 4 policies | Eucalyptus policies: `[(harvest_age,), ...]` |\n| `horizonte` | `int` | 30 | Time horizon in years |\n| `num_rodales` | `int` | 100 | Number of stands to generate |\n| `semilla` | `int` | 5555 | Seed for reproducibility |\n\n### Optimization Functions\n\n#### `forest_management_optimization_model()`\n\n| Parameter | Type | Description |\n|-----------|------|-------------|\n| `bosque` | `List[pd.DataFrame]` | Forest simulation data |\n| `a_i_j_T` | `Dict` | Final standing biomass by stand-policy |\n| `a_i_j_t` | `Dict` | Harvestable biomass by period |\n| `horizon` | `int` | Planning horizon in years |\n| `pine_revenue` | `float` or `List[float]` | Pine biomass revenue ($/m\u00b3) |\n| `eucalyptus_revenue` | `float` or `List[float]` | Eucalyptus biomass revenue ($/m\u00b3) |\n| `min_ending_biomass` | `float` | Minimum final period biomass guaranteed |\n| `discount_rate` | `float` | Annual discount rate for NPV |\n\n#### `solve_model()`\n\n| Parameter | Type | Description |\n|-----------|------|-------------|\n| `model` | `ConcreteModel` | Pyomo optimization model |\n| `solver_name` | `str` | Solver name ('cbc', 'cplex') |\n| `gap` | `float` | Relative optimality gap (default: 0.01) |\n| `executable_path` | `str` | Path to solver executable (optional) |\n| `tee` | `bool` | Display solver output (default: True) |\n\n#### `extract_results()`\n\nReturns a dictionary with:\n- `objective_value`: Optimal NPV for the planning\n- `total_harvest_per_period`: Schedule for collected biomass \n- `pinus_stand_plan`: Policy assignments for pine stands\n- `eucalyptus_stand_plan`: Policy assignments for eucalyptus stands\n- `total_pinus_stand_treated`: Count of pine stands\n- `total_eucalyptus_stand_treated`: Count of eucalyptus stands\n\n## Output Data Structure\n\n### Forest DataFrame\nEach element in `forest` contains:\n- `periodo`: Time period (1 to horizonte)\n- `edad_rodal`: Stand age in each period\n- `biomasa`: Total biomass in tons\n- `bioOPT`: biomass collected in tons (considers only thinned and harvested biomass amounts)\n- `condici\u00f3n`: Management status (\"sin manejo\" (no managed) / \"con manejo\" (managed)\n- `kitral_class`: Classification according to Kitral's System (Chilean fuel model)\n- `politica`: Applied policy identifier \n\n### Optimization Dictionaries\n`collected_biomass structure:\n```python\n{\n    (period, species, policy, stand_id): biomass_value,\n    ...\n}\n```\n\n`final_biomass structure:\n```python\n{\n    (stand_id, policy): biomass_value,\n    ...\n}\n```\n\n## Supported Species\n\n### Pinus\n- **Policies**: Thinning + Harvest\n- **Constraint**: Thinning age < harvest age \n- **Default policies**: 16 combinations (thinning ages: 9-12 years; harvest ages: 18-24 years)\n\n### Eucalyptus\n- **Policies**: Harvest only\n- **Harvest ages**: Any year\n- **Default policies**: 4 options (9-12 years)\n\n## Use Cases\n\n- **Forest research**: Analysis of different management strategies\n- **Tactical and Strategic planning**: Mid/Long-term forest management optimization\n- **Sustainability assessment**: Balancing economic and ecological objectives\n- **Policy evaluation**: Comparing management alternatives performances\n- **Education**: Teaching forest management and optimization concepts\n\n## Solver Installation Guide\n\n### Free Solvers\n```bash\n# CBC (recommended - included with treemun-sim[solvers])\npip install pulp\n\n```\n\n### Commercial Solvers\n```bash\n# CPLEX (requires IBM license)\npip install cplex\n\n```\n\n## Contributing\n\nContributions are welcome. To contribute:\n\n1. Fork the repository\n2. Create a feature branch\n3. Commit your changes\n4. Push to the branch\n5. Open a Pull Request\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Author\n\n**Felipe Ulloa-Fierro**\n- Email: felipe.ulloa@utalca.cl\n- Institution: Universidad de Talca\n\n## Reference\n\nA. Miranda, B. Mola-Yudego, and V. Hinojosa. Stand-level biomass prediction models in Eucalyptus Globulus and Pinus Radiata plantations in south-central Chile. Technical report, University of Eastern Finland, September 2023.\n\nJohnson, K. N., & Scheurman, H. L. (1977). Techniques for prescribing optimal timber harvest and investment under different objectives\u2014discussion and synthesis. *Forest Science*, 23(suppl_1), a0001\u2013z0001. https://doi.org/10.1093/FORESTSCIENCE/23.S1.A0001\n\n\n## Citation\n\nIf you use Treemun in your research, you can cite it as:\n\n```\nUlloa-Fierro, F. (2025). Treemun: A Growth and Yield Simulator for Chilean Plantation Forest. \nPython Package Version 1.1.5 https://pypi.org/project/treemun-sim/\n\n```\n\n## Acknowledgements\n\nAuthor thanks to European Union\u2019s Horizon 2020 Research and Innovation Programme under grant agreements Nos. 101037419\u2013FIRE-RES and 101007950\u2013DecisionES, and the support of National Agency for Research and Development (ANID, Chile) through the grant FONDECYT N.1220830, through the Complex Engineering Systems Institute PIA/PUENTE AFB230002.\n\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Growth, yield, and management simulator for Chilean plantation forests",
    "version": "1.1.5",
    "project_urls": {
        "Bug Reports": "https://github.com/fulloaf/treemun/issues",
        "Documentation": "https://github.com/fulloaf/treemun#readme",
        "Homepage": "https://github.com/fulloaf/treemun",
        "Source": "https://github.com/fulloaf/treemun"
    },
    "split_keywords": [
        "plantation forest",
        " simulation",
        " biomass growth",
        " management policies",
        " optimization",
        " forest management"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "b14b45296da9c743ee7d2c53504e1ffa762c731b6c3c3e2f8732a3687625796d",
                "md5": "45c60c7aeb4ed45ccf77075255c8119e",
                "sha256": "419071e1a9c45617f25d4327df2c097758b616e4c46aef7f64cbd06ccdfe9336"
            },
            "downloads": -1,
            "filename": "treemun_sim-1.1.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "45c60c7aeb4ed45ccf77075255c8119e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 20017,
            "upload_time": "2025-09-15T10:27:13",
            "upload_time_iso_8601": "2025-09-15T10:27:13.605369Z",
            "url": "https://files.pythonhosted.org/packages/b1/4b/45296da9c743ee7d2c53504e1ffa762c731b6c3c3e2f8732a3687625796d/treemun_sim-1.1.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "0f73a3d1c4d88fc725a5609d645bc38de588e625fbe4126a756b1ee581d1c287",
                "md5": "28038a1ea560216c45de973b9c0db53f",
                "sha256": "38419df0b81458a5902770b295555e198aacf736acc0e8203e39586f1006f827"
            },
            "downloads": -1,
            "filename": "treemun_sim-1.1.5.tar.gz",
            "has_sig": false,
            "md5_digest": "28038a1ea560216c45de973b9c0db53f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 24198,
            "upload_time": "2025-09-15T10:27:15",
            "upload_time_iso_8601": "2025-09-15T10:27:15.244901Z",
            "url": "https://files.pythonhosted.org/packages/0f/73/a3d1c4d88fc725a5609d645bc38de588e625fbe4126a756b1ee581d1c287/treemun_sim-1.1.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-09-15 10:27:15",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "fulloaf",
    "github_project": "treemun",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "numpy",
            "specs": [
                [
                    ">=",
                    "1.19.0"
                ]
            ]
        },
        {
            "name": "pandas",
            "specs": [
                [
                    ">=",
                    "1.2.0"
                ]
            ]
        }
    ],
    "lcname": "treemun-sim"
}
        
Elapsed time: 1.32684s