项目作者: gcyr

项目描述 :
Forest Management Tool a C++ library for forest planning.
高级语言: C++
项目地址: git://github.com/gcyr/FMT.git
创建时间: 2020-08-31T19:46:23Z
项目社区:https://github.com/gcyr/FMT

开源协议:

下载




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.

  • It is a C++ library made to interpret forest planning models based on the Woodstock files formulation.
  • It can be used through Python, Cran-R or directly from C++.
  • It’s generic approach to forest planning gives the opportunity to the user to manipulate forest planning models and generate forest planning solutions.
  • It’s objective is to bring all forest planning models types onto the same generic library to help the community to develop new approaches to forest planning problems or improve the one that have been there for years.

✨ 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:

  1. cd Documentation
  2. doxygen FMTdoxygenconfig

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

  1. cd Documentation
  2. python commentsPythonandR.py

👉 Examples

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

  • Using Python
    ```python
    from FMT import Models
    from FMT import Parser

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()

  1. + Using R
  2. ```R
  3. library(FMT)
  4. modelparser<-new(FMTmodelparser)
  5. models<-modelparser$readproject("pathtoprimaryfile",c("scenariox"),TRUE,TRUE,TRUE)#read scenario x from the primay file (.pri)
  6. optimizationmodel<-new(FMTlpmodel,models[[1]],FMTsolverinterface$CLP)#Construct a type III linear programming model from the FMTmodel
  7. emptyschedule<-new(FMTschedule)
  8. #Build the graph for 10 periods
  9. for (period in 1:10)
  10. {
  11. print(optimizationmodel$buildperiod(emptyschedule,FALSE)$str())
  12. }
  13. #Now add objective function to the FMTlpmodel and all the constraints
  14. allmodelconstraints<-optimizationmodel$getconstraints()
  15. modelobjective<-allmodelconstraints[[1]]
  16. modelconstraints<-allmodelconstraints[2:length(allmodelconstraints)]
  17. for (constraint in modelconstraints)
  18. {
  19. print(optimizationmodel$setconstraint(constraint)$str())
  20. }
  21. print(optimizationmodel$setobjective(modelobjective)$str())
  22. #Do a initial solve of the forest planning model
  23. optimizationmodel$initialsolve()
  • Using C++
    ``` C++

    include

    include “FMTlpmodel.h”

    include “FMTmodelparser.h”

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 licensed library.

License

📈 Coverage

GNU
MSVC

💻 Build

GNU
MSVC