FMT 1.2.0
Forest management tools for forest planning
Loading...
Searching...
No Matches
RexportHeuristics.h
Go to the documentation of this file.
1/*
2Copyright (c) 2019 Gouvernement du Qu�bec
3
4SPDX-License-Identifier: LiLiQ-R-1.1
5License-Filename: LICENSES/EN/LiLiQ-R11unicode.txt
6*/
7
8#ifndef REXPORTHEURISTICS_H_INCLUDED
9#define REXPORTHEURISTICS_H_INCLUDED
10
11
12#include "FMTOperatingArea.h"
18#include "FMTLpSolver.h"
19#include "Rdefinitions.h"
20#include <Rcpp.h>
21
22#ifdef FMTWITHOSI
41#endif
42
43namespace R
44{
46{
47
48 #ifdef FMTWITHOSI
49
50 Rcpp::class_<Heuristics::FMTOperatingArea>("FMToperatingarea", "@DocString(FMTOperatingArea)")
51 .constructor("@DocString(FMTOperatingArea())")
52 .constructor<Core::FMTMask,double>("@DocString(FMTOperatingArea(const Core::FMTMask&,const double&))")
53 .method("getneighbors", &Heuristics::FMTOperatingArea::getNeighbors,
54 "@DocString(FMTOperatingArea::getneighbors)")
55 .method("setneighbors", &Heuristics::FMTOperatingArea::setNeighbors,
56 "@DocString(FMTOperatingArea::setneighbors)")
57 .method("getmask", &Heuristics::FMTOperatingArea::getMask,
58 "@DocString(FMTOperatingArea::getmask)")
59 .method("getneihgborsperimeter", &Heuristics::FMTOperatingArea::getNeighborsPerimeter,
60 "@DocString(FMTOperatingArea::getneihgborsperimeter)");
61
62 Rcpp::class_<Heuristics::FMTOperatingAreaCluster>("FMToperatingareacluster", "@DocString(FMTOperatingAreaCluster)")
63 .constructor("@DocString(FMTOperatingAreaCluster())")
64 .constructor<Heuristics::FMTOperatingAreaCluster,double,double>("@DocString(FMTOperatingAreaCluster(const FMTOperatingAreaCluster&,const double&,const double&))")
66 "@DocString(FMTOperatingAreaCluster::getfilteredcluster)")
68 "@DocString(FMTOperatingAreaCluster::getallmasks)")
70 "@DocString(FMTOperatingAreaCluster::setminimalarea)")
72 "@DocString(FMTOperatingAreaCluster::setmaximalarea)");
73
74 Rcpp::class_<Heuristics::FMTOperatingAreaScheme>("FMToperatingareascheme", "@DocString(FMTOperatingAreaScheme)")
75 .derives<Heuristics::FMTOperatingArea>("FMToperatingarea")
76 .constructor("@DocString(FMTOperatingAreaScheme())")
77 .constructor<Heuristics::FMTOperatingArea,size_t,size_t,size_t,size_t,size_t,size_t>("@DocString(FMTOperatingAreaScheme(const Heuristics::FMTOperatingArea&,const size_t&,const size_t&,const size_t&, const size_t&, const size_t&,double,bool))");
78
79 Rcpp::class_<Heuristics::FMTLpHeuristic>("FMTlpheuristic", "@DocString(FMTLpHeuristic)")
80 .derives<Core::FMTObject>("FMTobject")
81 .constructor("@DocString(FMTLpHeuristic())");
82
83 Rcpp::class_<Heuristics::FMTOperatingAreaScheduler>("FMToperatingareascheduler","@DocString(FMTOperatingAreaScheduler)")
84 .derives<Heuristics::FMTLpHeuristic>("FMTlpheuristic")
85 //.derives<Models::FMTLpSolver>("FMTlpsolver")
86 .constructor("@DocString(FMTOperatingAreaScheduler())")
88 "@DocString(FMTOperatingAreaScheduler::initialsolve)")
90 "@DocString(FMTOperatingAreaScheduler::branchnboundsolve)")
92 "@DocString(FMTOperatingAreaScheduler::getsolution)");
93
94 Rcpp::class_<Heuristics::FMTOperatingAreaClusterer>("FMToperatingareaclusterer", "@DocString(FMTOperatingAreaClusterer)")
95 .derives<Heuristics::FMTLpHeuristic>("FMTlpheuristic")
96 .constructor("@DocString(FMTOperatingAreaClusterer())")
98 "@DocString(FMTOperatingAreaClusterer::initialsolve)")
100 "@DocString(FMTOperatingAreaClusterer::branchnboundsolve)")
102 "@DocString(FMTOperatingAreaClusterer::getsolution)");
103
104 #endif
105 }
106}
107#endif
RCPP_EXPOSED_AS(Heuristics::FMTOperatingArea)
RCPP_EXPOSED_WRAP(Heuristics::FMTOperatingArea)
RCPP_DEFINEVECTOR(Heuristics::FMTOperatingArea)
Core class holding, as a boost dynamic bitset, which theme attributes are part of a mask.
Definition: FMTMask.h:96
Base class of multiple FMT classes holding a shared exception handler pointer and logger.
Definition: FMTObject.h:49
Base class for solving LP and MIP problems using a heuristic, holding a random generator and its own ...
Definition: FMTLpHeuristic.h:34
Definition of a non clustered operating area, used by the FMTOperatingAreaCluster.
Definition: FMTOperatingAreaClusterBinary.h:32
Potential cluster of multiple operating areas.
Definition: FMTOperatingAreaCluster.h:27
void setMinimalArea(const double &newminimalarea)
Set the minimal area of the cluster.
FMTOperatingAreaCluster getFilteredCluster(const Core::FMTMask &filterMask) const
Return a cluster with the binaries not falling in a mask definition removed, which can reduce the num...
void setMaximalArea(const double &newmaximalarea)
Set the potential maximal area of the cluster.
std::vector< Core::FMTMask > getAllMasks() const
Return all the masks contained by the cluster, including the operating area centroid.
Heuristic to do spatial clustering of operating areas across a landscape from a shapefile.
Definition: FMTOperatingAreaClusterer.h:28
std::vector< FMTOperatingAreaCluster > getSolution() const
Return the clustering solution with cleaned operating clusters.
bool initialSolve() final
Solve the heuristic problem using the fire spread heuristic to get a good initial clustering solution...
bool branchNBoundSolve() final
Solve the problem using branch and bound on the primal formulation, using the heuristic solution as a...
Heuristic to solve the spatialization problem across a landscape for multiple operating areas.
Definition: FMTOperatingAreaScheduler.h:57
bool branchNBoundSolve() final
Solve the problem using branch and bound on the primal formulation, using the heuristic solution as a...
bool initialSolve() final
Solve the heuristic problem until an initial solution is found for each operating area.
std::vector< Core::FMTTimeYieldHandler > getSolution(const std::string &yldname) const
Return the actual solution as a vector of time yield handlers, one per operating area.
Operating area scheme giving information about its opening time, green up and return time.
Definition: FMTOperatingAreaScheme.h:42
Operating area giving information about its mask, neighbors and neighbors perimeter.
Definition: FMTOperatingArea.h:29
double getNeighborsPerimeter() const
Return the percentage of perimeter the operating area needs to share with another operating area to b...
std::vector< Core::FMTMask > getNeighbors() const
Return a copy of the neighbors masks of the operating area.
void setNeighbors(const std::vector< Core::FMTMask > &lneighbors)
Set the neighbors masks of the operating area.
Core::FMTMask getMask() const
Return the mask of the operating area.
Definition: RexportCore.h:153
void exportHeuristics()
Definition: RexportHeuristics.h:45