Bureau-du-Forestier-en-chef / FMT

Forest Management Tool a C++ library for forest planning.
https://bureau-du-forestier-en-chef.github.io/FMTdocs/
15 stars 1 forks source link
fmt forest-management forest-planning forestry optimization python-library r-package simulation

FMT (Forest Management Tool)





This page provides only an overview of the installation process and features of FMT. For more details, visit our documentation page here.

πŸ“‘ Description

FMT (Forest Management Tool) is an open source Forest Management library.

✨ Features

Spatially referenced forest planning

FMT allows the user to generate and solve spatially referenced type III forest planning model problems. The tool can be used to do sensitivity analyses over multiple parameters of the forest planning model. It can also be used for analysing impacts of stochastic events such as fire or spruce budworm using Replanning.

Spatially explicit forest planning

FMT gives a framework to construct heuristics to solve forest planning model. FMT is the perfect tool to solve user specific problems related to forest planning like operating area scheduling. It can also be used to implement simple simulation process. The library offers some tools to spatialize spatially referenced solutions or to generate spatially explicit solutions.

FMT is extremely usefull when it comes to implement metaheuristics such as Simulated Annealing, Genetic or Tabu Search into a forest planning context.

If your main inputs are Woodstock files, FMT is probably the way to go to develop new approaches for optimization or simulation of harvest schedules or even stochastic events.

πŸ’½ Installation

The easiest way to use FMT is to use Cmake >= 3.15 to generate a shared library for R or Python, or directly from C++. The Cmake script of this repository supports generating FMT on Windows using VS2017/2019 or MINGW-64 on MSYS2 or CYGWIN.





πŸ“¦ Dependencies

Required :

πŸ“– Documentation

FMT has a handwritten extensive documentation with exercises and examples, along with a doxygen-generated documentation that are both available on the FMT documentation webpage.





If you want to compile the doxygen documentation by yourself, with a powershell prompt, go into the FMT folder and use:

  cd Documentation
  doxygen FMTdoxygenconfig

To populate comments in R and Python source files (files starting with R and PY):

  cd Documentation
  python commentsPythonandR.py

πŸ‘‰ Examples

Here's a short example for reading a forest planning model and solve the type III Linear programming formulation.

modelparser = Parser.FMTmodelparser() models = modelparser.readproject("pathtoprimaryfile",["scenariox"])#read scenario x from the primay file (.pri) optimizationmodel=Models.FMTlpmodel(models[0],Models.FMTsolverinterface.CLP)#Construct a type III linear programming model from the FMTmodel

Build the graph for 10 periods

for period in range(0,10): print(optimizationmodel.buildperiod())

Now add objective function to the FMTlpmodel and all the constraints

constraints = optimizationmodel.getconstraints() objective = constraints.pop(0) for constraint in constraints: print(optimizationmodel.setconstraint(constraint)) print(optimizationmodel.setobjective(objective))

Do a initial solve of the forest planning model

optimizationmodel.initialsolve()

 + Using R
 ```R
library(FMT)
modelparser<-new(FMTmodelparser)
models<-modelparser$readproject("pathtoprimaryfile",c("scenariox"),TRUE,TRUE,TRUE)#read scenario x from the primay file (.pri)
optimizationmodel<-new(FMTlpmodel,models[[1]],FMTsolverinterface$CLP)#Construct a type III linear programming model from the FMTmodel
emptyschedule<-new(FMTschedule)
#Build the graph for 10 periods
for (period in 1:10)
    {
    print(optimizationmodel$buildperiod(emptyschedule,FALSE)$str())
    }
#Now add objective function to the FMTlpmodel and all the constraints
allmodelconstraints<-optimizationmodel$getconstraints()
modelobjective<-allmodelconstraints[[1]]
modelconstraints<-allmodelconstraints[2:length(allmodelconstraints)]
for (constraint in modelconstraints)
    {
    print(optimizationmodel$setconstraint(constraint)$str())
    }
print(optimizationmodel$setobjective(modelobjective)$str())
#Do a initial solve of the forest planning model
optimizationmodel$initialsolve()

Parser::FMTmodelparser modelparser; const std::vectorscenarios(1, "scenariox"); const std::vector models = modelparser.readproject("pathtoprimaryfile", scenarios); Models::FMTlpmodel optimizationmodel(models.at(0), Models::FMTsolverinterface::MOSEK); for (size_t period = 0; period < 10; ++period) { optimizationmodel.buildperiod(); } std::vectorconstraints = optimizationmodel.getconstraints(); const Core::FMTconstraint objective = constraints.at(0); constraints.erase(constraints.begin()); for (const Core::FMTconstraint& constraint : constraints) { optimizationmodel.setconstraint(constraint); } optimizationmodel.setobjective(objective); optimizationmodel.initialsolve();



## πŸ”‘ License 

FMT is a [LiLiQ-R 1.1](https://github.com/gcyr/FMT/blob/master/LICENSES/EN/LILIQ-R11EN.pdf) licensed library.

[![License](http://img.shields.io/:license-liliqR11-blue.svg?style=flat-square)](https://forge.gouv.qc.ca/licence/liliq-v1-1/#r%C3%A9ciprocit%C3%A9-liliq-r)

## πŸ“ˆ Coverage
GNU ![](https://img.shields.io/badge/coverage-70%25-orange)
MSVC ![](https://img.shields.io/badge/coverage-0%25-red)

## πŸ’» Build
GNU ![](https://img.shields.io/badge/build-pass-brightgreen)
MSVC ![](https://img.shields.io/badge/build-pass-brightgreen)