FMT 1.2.0
Forest management tools for forest planning
Loading...
Searching...
No Matches
FMTOperatingArea.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#ifdef FMTWITHOSI
9
10#ifndef FMToperatingarea_Hm_included
11#define FMToperatingarea_Hm_included
12
13#include "FMTMask.h"
14#include <vector>
15#include <map>
16#include <memory>
17#include <boost/serialization/serialization.hpp>
18#include <boost/serialization/nvp.hpp>
19#include <boost/serialization/export.hpp>
20
21namespace Heuristics
22 {
23 // DocString: FMTOperatingArea
29 {
30 public:
31 // DocString: FMTOperatingArea::operator+=
37 FMTOperatingArea& operator += (const double& value);
38 // DocString: FMTOperatingArea::getNeighbors
43 std::vector<Core::FMTMask> getNeighbors() const;
44 // DocString: FMTOperatingArea::getArea
49 double getArea() const;
50 // DocString: FMTOperatingArea::getNeighborsPerimeter
55 double getNeighborsPerimeter() const;
56 // DocString: FMTOperatingArea::getMask
62 // DocString: FMTOperatingArea::setNeighbors
67 void setNeighbors(const std::vector<Core::FMTMask>& lneighbors);
68 // DocString: FMTOperatingArea(const Core::FMTMask,const double)
75 FMTOperatingArea(const Core::FMTMask& lmask,const double& lneighborsperimeter);
76 // DocString: FMTOperatingArea::setArea
81 void setArea(const double& newarea);
82
83 // DocString: FMTOperatingArea()
88 // DocString: FMTOperatingArea(const FMTOperatingArea)
93 FMTOperatingArea(const FMTOperatingArea& rhs) = default;
94 // DocString: FMTOperatingArea::operator=
100 FMTOperatingArea& operator = (const FMTOperatingArea& rhs)=default;
101 // DocString: FMTOperatingArea::operator==
107 bool operator == (const FMTOperatingArea& rhs) const;
108 // DocString: FMTOperatingArea::operator!=
114 bool operator != (const FMTOperatingArea& rhs) const;
115 // DocString: ~FMTOperatingArea()
119 virtual ~FMTOperatingArea()=default;
120 // DocString: FMTOperatingArea::preSolve
127 FMTOperatingArea preSolveOperatingArea(const Core::FMTMaskFilter& filter, const std::vector<Core::FMTTheme>&presolvedthemes) const;
128 // DocString: FMTOperatingArea::postSolve
135 FMTOperatingArea postSolveOperatingArea(const Core::FMTMaskFilter& filter, const std::vector<Core::FMTTheme>&basethemes) const;
136
137 protected:
138 // DocString: FMTOperatingArea::m_mask
141 // DocString: FMTOperatingArea::m_neighbors
143 std::vector<Core::FMTMask>m_neighbors;
144 // DocString: FMTOperatingArea::m_neighborsperimeter
147 // DocString: FMTOperatingArea::m_area
149 double m_area;
150 private:
151 // DocString: FMTOperatingArea::serialize
158 friend class boost::serialization::access;
159 template<class Archive>
160 void serialize(Archive& ar, const unsigned int version)
161 {
162 ar & boost::serialization::make_nvp("mask", m_mask);
163 ar & boost::serialization::make_nvp("neighbors", m_neighbors);
164 ar & boost::serialization::make_nvp("neighborsperimeter", m_neighborsperimeter);
165 ar & boost::serialization::make_nvp("_area", m_area);
166 }
167 };
168
169 // DocString: FMTOperatingAreaComparator
174 {
175 public:
176 // DocString: FMTOperatingAreaComparator(const Core::FMTMask)
182 // DocString: FMTOperatingAreaComparator(const FMTOperatingArea& oparea)
188 // DocString: FMTOperatingAreaComparator::operator()
194 bool operator()(const FMTOperatingArea& oparea) const;
195
196 private:
197 // DocString: FMTOperatingAreaComparator::m_mask
199 Core::FMTMask m_mask;
200 };
201
202 }
203 BOOST_CLASS_EXPORT_KEY(Heuristics::FMTOperatingArea)
204#endif
205#endif
#define FMTEXPORT
Definition: FMTutility.h:125
Filter built from masks used to preSolve and postsolve FMTMask objects.
Definition: FMTMaskFilter.h:31
Core class holding, as a boost dynamic bitset, which theme attributes are part of a mask.
Definition: FMTMask.h:96
Comparator to find a FMTOperatingArea with std::find_if when operating areas are in an stl container.
Definition: FMTOperatingArea.h:174
FMTOperatingAreaComparator(const FMTOperatingArea &oparea)
Construct the comparator from an operating area.
bool operator()(const FMTOperatingArea &oparea) const
Comparator for FMTOperatingArea.
FMTOperatingAreaComparator(const Core::FMTMask &lmask)
Construct the comparator from a mask reference.
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 > m_neighbors
Neighbors mask of the operating area.
Definition: FMTOperatingArea.h:143
std::vector< Core::FMTMask > getNeighbors() const
Return a copy of the neighbors masks of the operating area.
double m_neighborsperimeter
neighborsperimeter is the ratio a operatingarea needs to share to a other operatingarea to be conside...
Definition: FMTOperatingArea.h:146
virtual ~FMTOperatingArea()=default
Default destructor for FMTOperatingArea.
double m_area
The initial area of the operating area used as big M for the MIP.
Definition: FMTOperatingArea.h:149
Core::FMTMask m_mask
The mask describing the operating area.
Definition: FMTOperatingArea.h:140
FMTOperatingArea(const Core::FMTMask &lmask, const double &lneighborsperimeter)
Main constructor for FMTOperatingArea from a mask and a neighbors perimeter.
FMTOperatingArea(const FMTOperatingArea &rhs)=default
Copy constructor for FMTOperatingArea.
void setNeighbors(const std::vector< Core::FMTMask > &lneighbors)
Set the neighbors masks of the operating area.
FMTOperatingArea()=default
Default constructor for FMTOperatingArea.
FMTOperatingArea postSolveOperatingArea(const Core::FMTMaskFilter &filter, const std::vector< Core::FMTTheme > &basethemes) const
Return a postsolved FMTOperatingArea using a mask filter and the original themes.
FMTOperatingArea preSolveOperatingArea(const Core::FMTMaskFilter &filter, const std::vector< Core::FMTTheme > &presolvedthemes) const
Return a presolved FMTOperatingArea using a mask filter and a subset of the original themes.
Core::FMTMask getMask() const
Return the mask of the operating area.
void setArea(const double &newarea)
Set the area of the operating area.
double getArea() const
Get the area of the operating area.
Namespace regrouping all tools for solving LP/MIP problems using an heuristic.
Definition: FMTAreaParser.h:47