FMT 0.9.8
Forest management tools for forest planning
|
#include <FMTspatialschedule.hpp>
Public Types | |
typedef std::vector< std::vector< Spatial::FMTbindingspatialaction > > | actionbindings |
Public Types inherited from Spatial::FMTlayer< Graph::FMTlinegraph > | |
typedef std::map< FMTcoordinate, Graph::FMTlinegraph >::value_type | value_type |
Value typedef of the FMTlayer. | |
typedef std::map< FMTcoordinate, Graph::FMTlinegraph >::iterator | iterator |
Iterator typedef of the FMTlayer. | |
typedef std::map< FMTcoordinate, Graph::FMTlinegraph >::const_iterator | const_iterator |
Const_Iterator typedef of the FMTlist. | |
Public Member Functions | |
FMTspatialschedule (FMTspatialschedule &&rhs) noexcept | |
FMTspatialschedule () | |
FMTspatialschedule (const FMTforest &initialmap) | |
virtual | ~FMTspatialschedule ()=default |
FMTspatialschedule (const FMTspatialschedule &other) | |
FMTspatialschedule (const FMTspatialschedule &other, const std::vector< FMTcoordinate >::const_iterator &firstcoord, const std::vector< FMTcoordinate >::const_iterator &endcoord) | |
FMTspatialschedule & | operator= (const FMTspatialschedule &rhs) |
bool | operator== (const FMTspatialschedule &rhs) const |
bool | operator!= (const FMTspatialschedule &rhs) const |
bool | empty () const |
int | actperiod () const |
bool | copyfromselected (const FMTspatialschedule &rhs, const std::vector< size_t > &selected) |
bool | swapfromselected (FMTspatialschedule &rhs, const std::vector< size_t > &selected) |
FMTforest | getforestperiod (const int &period, bool periodstart=false) const |
bool | allow_action (const int &targetaction, const std::vector< Spatial::FMTbindingspatialaction > &bindingactions, const FMTcoordinate &location, const int &period) const |
std::vector< std::set< Spatial::FMTcoordinate > > | getupdatedscheduling (const Models::FMTmodel &model, const std::vector< int > &actiontargets, boost::unordered_map< Core::FMTdevelopment, std::vector< bool > > &cachedaction, const std::vector< boost::unordered_set< Core::FMTdevelopment > > &scheduleoperabilities, bool schedule_only=true, std::vector< std::set< Spatial::FMTcoordinate > > original=std::vector< std::set< Spatial::FMTcoordinate > >(), std::vector< FMTcoordinate > updatedcoordinate=std::vector< FMTcoordinate >()) const |
double | evaluatespatialconstraint (const Core::FMTconstraint &spatialconstraint, const Models::FMTmodel &model) const |
std::set< FMTcoordinate > | verifyspatialfeasability (const int &targetaction, const std::vector< Spatial::FMTbindingspatialaction > &bindingactions, const int &period, const std::set< FMTcoordinate > &operables) const |
FMTeventcontainer | buildharvest (const double &target, const Spatial::FMTbindingspatialaction &targetaction, std::default_random_engine &generator, std::set< FMTcoordinate > mapping_pass, const int &previousperiod, const int &actionid, std::vector< FMTcoordinate > &operated) const |
double | operateevents (const FMTeventcontainer &cuts, const Core::FMTaction &action, const int &action_id, const Core::FMTtransition &Transition, const Core::FMTyields &ylds, const std::vector< Core::FMTtheme > &themes) |
void | operatecoord (const FMTcoordinate &coord, const Core::FMTaction &action, const int &action_id, const FMTbindingspatialaction &bindingspaction, const Core::FMTtransition &Transition, const Core::FMTyields &ylds, const std::vector< Core::FMTtheme > &themes) |
void | grow () |
std::vector< Core::FMTschedule > | getschedules (const std::vector< Core::FMTaction > &modelactions, bool withlock=false) const |
std::vector< double > | getgraphsoutputs (const Models::FMTmodel &model, const Core::FMTconstraint &constraint, const FMTspatialschedule *friendlysolution=nullptr) const |
std::vector< int > | isbetterthan (const FMTspatialschedule &newsolution, const Models::FMTmodel &model) const |
double | getconstraintevaluation (const Core::FMTconstraint &constraint, const Models::FMTmodel &model, const FMTspatialschedule *friendlysolution=nullptr) const |
std::vector< double > | getconstraintsvalues (const Models::FMTmodel &model, const FMTspatialschedule *friendlysolution=nullptr) const |
std::vector< double > | getweightedfactors (const Models::FMTmodel &model, const FMTspatialschedule *friendlysolution=nullptr) const |
double | getprimalinfeasibility (const std::vector< const Core::FMTconstraint * > &constraints, const Models::FMTmodel &model, const FMTspatialschedule *friendlysolution=nullptr, bool withfactorization=false) const |
void | logsolutionstatus (const size_t &iteration, const double &objective, const double &primalinfeasibility) const |
void | getsolutionstatus (double &objective, double &primalinfeasibility, const Models::FMTmodel &model, const FMTspatialschedule *friendlysolution=nullptr, bool withsense=true, bool withfactorization=false, bool withspatial=true) const |
double | getglobalobjective (const Models::FMTmodel &model, const FMTspatialschedule *friendlysolution=nullptr) const |
double | getobjectivevalue (const Core::FMTconstraint &constraint, const Models::FMTmodel &model, const FMTspatialschedule *friendlysolution=nullptr, bool withsense=true) const |
void | setgraphfromcache (const Graph::FMTlinegraph &graph, const Models::FMTmodel &model, const int &startingperiod, bool remove=true) |
std::string | getpatchstats (const std::vector< Core::FMTaction > &actions) const |
FMTlayer< std::string > | lastdistlayer (const std::vector< Core::FMTaction > &modelactions, const int &period) const |
std::vector< Core::FMTGCBMtransition > | getGCBMtransitions (FMTlayer< std::string > &stackedactions, const std::vector< Core::FMTaction > &modelactions, const std::vector< Core::FMTtheme > &classifiers, const int &period) const |
std::vector< std::vector< Graph::FMTpredictor > > | getpredictors (FMTlayer< int > &predictorids, const Models::FMTmodel &model, const std::vector< std::string > &yieldnames, const int &period, bool periodonevalues=false, bool withGCBMid=true) const |
void | eraselastperiod () |
std::vector< Spatial::FMTbindingspatialaction > | getbindingactions (const Models::FMTmodel &model, const int &period) const |
actionbindings | getbindingactionsbyperiod (const Models::FMTmodel &model) const |
std::map< std::string, double > | referencebuild (const Core::FMTschedule &schedule, const Models::FMTmodel &model, const std::vector< boost::unordered_set< Core::FMTdevelopment > > &scheduleoperabilities, bool schedule_only=true, bool scheduleatfirstpass=true, unsigned int seed=0) |
std::map< std::string, double > | greedyreferencebuild (const Core::FMTschedule &schedule, const Models::FMTmodel &model, const size_t &randomiterations, unsigned int seed=0, double tolerance=FMT_DBL_TOLERANCE, bool log=true) |
Graph::FMTgraphstats | randombuild (const Models::FMTmodel &model, std::default_random_engine &generator) |
void | perturbgraph (const FMTcoordinate &coordinate, const int &period, const Models::FMTmodel &model, std::default_random_engine &generator, const actionbindings &bindings) |
bool | isbetterbygroup (const FMTspatialschedule &rhs, const Models::FMTmodel &model) const |
void | swap (FMTspatialschedule &rhs) |
std::vector< Spatial::FMTcoordinate > | getmovablecoordinates (const Models::FMTmodel &model, const int &period, const std::vector< Spatial::FMTcoordinate > *statics, boost::unordered_map< Core::FMTdevelopment, bool > *operability=nullptr) const |
int | getperiodwithmaximalevents (const std::vector< bool > &actions) const |
std::vector< std::vector< Spatial::FMTcoordinate > > | getareaconflictcoordinates (const actionbindings &bindingactions, const int &period, bool conflictonly=true) const |
std::vector< std::vector< Spatial::FMTcoordinate > > | getadjacencyconflictcoordinates (const actionbindings &bindingactions, const int &period, bool conflictonly=true) const |
std::vector< Spatial::FMTcoordinate > | getstaticsmovablecoordinates (const Models::FMTmodel &model) const |
bool | ispartial () const |
bool | emptyevents () const |
void | copyfrompartial (const FMTspatialschedule &rhs) |
void | copyfrompartial (FMTspatialschedule &rhs) |
void | setconstraintsfactor (const Models::FMTmodel &model, const std::vector< double > &factors) |
bool | needsrefactortorization (const Models::FMTmodel &model) const |
void | dorefactortorization (const Models::FMTmodel &model) |
std::vector< double > | getconstraintsfactor () const |
std::map< std::string, std::vector< double > > | getoutput (const Models::FMTmodel &model, const Core::FMToutput &output, const int &periodstart, const int &periodstop, Core::FMToutputlevel level=Core::FMToutputlevel::totalonly) const |
FMTlayer< double > | getoutput (const Models::FMTmodel &model, const Core::FMToutput &output, const int &period) const |
std::vector< std::pair< FMTcoordinate, double > > | getoutputbycoordinate (const Models::FMTmodel &model, const Core::FMToutput &output, const int &period) const |
void | postsolve (const Core::FMTmaskfilter &filter, const std::vector< Core::FMTaction > &presolveactions, const Models::FMTmodel &originalbasemodel) |
Public Member Functions inherited from Spatial::FMTlayer< Graph::FMTlinegraph > | |
Graph::FMTlinegraph & | operator[] (const FMTcoordinate &coordinate) |
const Graph::FMTlinegraph & | at (const FMTcoordinate &coordinate) const |
bool | empty () const |
iterator | begin () |
const_iterator | begin () const |
iterator | end () |
const_iterator | end () const |
const_iterator | find (const FMTcoordinate &coordinate) const |
iterator | find (const FMTcoordinate &coordinate) |
FMTlayer () | |
FMTlayer (FMTlayer &&rhs) noexcept | |
FMTlayer (const std::vector< double > &lgeotransform, const unsigned int &lmaxx, const unsigned int &lmaxy, const std::string &lSRS_WKT, const double &lcellsize) | |
FMTlayer (const std::map< FMTcoordinate, Graph::FMTlinegraph > &lmapping, const std::vector< double > &lgeotransform, const unsigned int &lmaxx, const unsigned int &lmaxy, const std::string &lSRS_WKT, const double &lcellsize) | |
FMTlayer (const FMTlayer &rhs) | |
virtual | ~FMTlayer ()=default |
FMTlayer< Graph::FMTlinegraph > & | operator= (const FMTlayer< Graph::FMTlinegraph > &rhs) |
void | swap (FMTlayer< Graph::FMTlinegraph > &rhs) |
void | setextentfrom (const FMTlayer< Graph::FMTlinegraph > &rhs) |
FMTlayer< newtype > | copyextent () const |
FMTlayer< Graph::FMTlinegraph > & | operator+= (const FMTlayer< Graph::FMTlinegraph > &rhs) |
FMTlayer< std::string > & | operator+= (const FMTlayer< std::string > &rhs) |
unsigned int | GetXSize () const |
unsigned int | GetYSize () const |
std::vector< double > | getgeotransform () const |
std::string | getprojection () const |
std::map< FMTcoordinate, Graph::FMTlinegraph > | getmapping () const |
double | area () const |
double | getcellsize () const |
std::vector< Graph::FMTlinegraph > | getattributes () const |
size_t | size () const |
void | replace (typename std::map< FMTcoordinate, Graph::FMTlinegraph >::const_iterator first, typename std::map< FMTcoordinate, Graph::FMTlinegraph >::const_iterator last) |
Public Member Functions inherited from Core::FMTobject | |
FMTobject () | |
virtual | ~FMTobject () |
FMTobject (const std::shared_ptr< Exception::FMTexceptionhandler > exhandler) | |
FMTobject (const FMTobject &rhs) | |
FMTobject & | operator= (const FMTobject &rhs) |
virtual void | passinlogger (const std::shared_ptr< Logging::FMTlogger > &logger) |
void | passinexceptionhandler (const std::shared_ptr< Exception::FMTexceptionhandler > &exhandler) |
void | redirectlogtofile (const std::string &location) |
virtual void | setdefaultlogger () |
virtual void | setquietlogger () |
virtual void | settasklogger () |
virtual void | setdebuglogger () |
void | setdefaultexceptionhandler () |
void | setquietexceptionhandler () |
void | setdebugexceptionhandler () |
void | setfreeexceptionhandler () |
void | disablenestedexceptions () |
void | enablenestedexceptions () |
void | seterrorstowarnings (const std::vector< Exception::FMTexc > &errors) |
void | setmaxwarningsbeforesilenced (const size_t &maxwarningcount) |
Protected Member Functions | |
std::vector< const Graph::FMTlinegraph * > | getfromevents (const Core::FMTconstraint &constraint, const std::vector< Core::FMTaction > &actions, const int &start, const int &stop) const |
std::vector< FMTcoordinate > | getfromevents (const Core::FMToutputnode &node, const std::vector< Core::FMTaction > &actions, const int &period) const |
std::map< std::string, double > | getoutputfromgraph (const Graph::FMTlinegraph &linegraph, const Models::FMTmodel &model, const Core::FMToutputnode &node, const double *solution, const int &period, const Core::FMTmask &nodemask, boost::unordered_map< Core::FMTmask, double > &nodecache, Core::FMToutputlevel level=Core::FMToutputlevel::totalonly) const |
void | setgraphcachebystatic (const std::vector< FMTcoordinate > &coordinates, const Core::FMToutputnode &node) const |
bool | inscheduleoperabilities (const std::vector< boost::unordered_set< Core::FMTdevelopment > > &scheduleoperabilities, Core::FMTdevelopment const *dev, const int &actionid, const Core::FMTaction &action) const |
std::vector< FMTlayer< Graph::FMTlinegraph >::const_iterator > | getoutputfromnode (const Models::FMTmodel &model, const Core::FMToutputnode &node, const int &period) const |
Protected Member Functions inherited from Core::FMTobject | |
template<class Archive > | |
void | forcesave (Archive &ar, const unsigned int version) const |
template<class Archive > | |
void | forceload (Archive &ar, const unsigned int version) |
void | checksignals () const |
void | setCPLhandler () |
Protected Attributes | |
FMTeventcontainer | events |
Protected Attributes inherited from Spatial::FMTlayer< Graph::FMTlinegraph > | |
std::vector< double > | geotransform |
Geotransform of the map (see GDAL for more information about Geotransform) | |
unsigned int | maxx |
Maximal x value in the map. | |
unsigned int | maxy |
Maximal y value in the map. | |
std::string | SRS_WKT |
Projection string of the raster (see GDAL for more information about Geotransform) | |
double | cellsize |
Size of the pixel in the unit used by the map (SRS_WKT) | |
std::map< FMTcoordinate, Graph::FMTlinegraph > | mapping |
std::map keeping the information of each pixel. | |
Additional Inherited Members | |
Static Public Member Functions inherited from Core::FMTobject | |
static std::string | getruntimelocation () |
static unsigned long long | getavailablememory () |
Static Protected Member Functions inherited from Core::FMTobject | |
static std::chrono::time_point< std::chrono::high_resolution_clock > | getclock () |
template<class chrono > | |
static double | getduration (const std::chrono::time_point< std::chrono::high_resolution_clock > &startclock) |
static std::string | getdurationinseconds (const std::chrono::time_point< std::chrono::high_resolution_clock > &startclock) |
Static Protected Attributes inherited from Core::FMTobject | |
static std::shared_ptr< Exception::FMTexceptionhandler > | _exhandler |
A shared pointer to the exception handler. | |
static std::shared_ptr< Logging::FMTlogger > | _logger |
A shared pointer to the logger. | |
This class is a map containing a linear graph for each cell. The graph represent the stand, the action and the transition at each each period for the cell. Can be build randomly or with a schedule.
typedef std::vector<std::vector<Spatial::FMTbindingspatialaction> > Spatial::FMTspatialschedule::actionbindings |
|
noexcept |
Default move constructor for FMTspatialschedule.
Spatial::FMTspatialschedule::FMTspatialschedule | ( | ) |
Default constructor of FMTspatialschedule
Spatial::FMTspatialschedule::FMTspatialschedule | ( | const FMTforest & | initialmap | ) |
Constructor of FMTspatialschedule based on FMTforest. It's initializing every graph in the map base on developments types in each cell.
|
virtualdefault |
Default destructor of FMTspatialschedule
Spatial::FMTspatialschedule::FMTspatialschedule | ( | const FMTspatialschedule & | other | ) |
Copy constructor of FMTspatialschedule
Spatial::FMTspatialschedule::FMTspatialschedule | ( | const FMTspatialschedule & | other, |
const std::vector< FMTcoordinate >::const_iterator & | firstcoord, | ||
const std::vector< FMTcoordinate >::const_iterator & | endcoord | ||
) |
Create a partial copy of the complete solution base on coordinates.
int Spatial::FMTspatialschedule::actperiod | ( | ) | const |
Return the last period in the graph which is the active one.
bool Spatial::FMTspatialschedule::allow_action | ( | const int & | targetaction, |
const std::vector< Spatial::FMTbindingspatialaction > & | bindingactions, | ||
const FMTcoordinate & | location, | ||
const int & | period | ||
) | const |
Check in all events around the location during periods corresponding to green up delay if an action present in neighbors is in the adjacency limit.
FMTeventcontainer Spatial::FMTspatialschedule::buildharvest | ( | const double & | target, |
const Spatial::FMTbindingspatialaction & | targetaction, | ||
std::default_random_engine & | generator, | ||
std::set< FMTcoordinate > | mapping_pass, | ||
const int & | previousperiod, | ||
const int & | actionid, | ||
std::vector< FMTcoordinate > & | operated | ||
) | const |
void Spatial::FMTspatialschedule::copyfrompartial | ( | const FMTspatialschedule & | rhs | ) |
Copy elements from a partial solution.
void Spatial::FMTspatialschedule::copyfrompartial | ( | FMTspatialschedule & | rhs | ) |
Copy elements from a partial solution but also allow swap.
bool Spatial::FMTspatialschedule::copyfromselected | ( | const FMTspatialschedule & | rhs, |
const std::vector< size_t > & | selected | ||
) |
void Spatial::FMTspatialschedule::dorefactortorization | ( | const Models::FMTmodel & | model | ) |
Return true if the solution looks unscaled and need new factors
|
inline |
Test whether the map is empty.
bool Spatial::FMTspatialschedule::emptyevents | ( | ) | const |
Return true if there's no events
void Spatial::FMTspatialschedule::eraselastperiod | ( | ) |
This function erase the last period of the FMTspatialschedule.
double Spatial::FMTspatialschedule::evaluatespatialconstraint | ( | const Core::FMTconstraint & | spatialconstraint, |
const Models::FMTmodel & | model | ||
) | const |
Return the constraint evaluation value of a spatial constraint. If the subset is not a nullptr the
std::vector< std::vector< Spatial::FMTcoordinate > > Spatial::FMTspatialschedule::getadjacencyconflictcoordinates | ( | const actionbindings & | bindingactions, |
const int & | period, | ||
bool | conflictonly = true |
||
) | const |
Returns adjacency conflicts coordinate that need to be destroyed
std::vector< std::vector< Spatial::FMTcoordinate > > Spatial::FMTspatialschedule::getareaconflictcoordinates | ( | const actionbindings & | bindingactions, |
const int & | period, | ||
bool | conflictonly = true |
||
) | const |
Returns the coordinates of events that does not have the right area in the worst period... and set the worst period
std::vector< Spatial::FMTbindingspatialaction > Spatial::FMTspatialschedule::getbindingactions | ( | const Models::FMTmodel & | model, |
const int & | period | ||
) | const |
Get the binding actions based on model constraints.
actionbindings Spatial::FMTspatialschedule::getbindingactionsbyperiod | ( | const Models::FMTmodel & | model | ) | const |
Get the binding actions based on model constraints in a vector by period.
double Spatial::FMTspatialschedule::getconstraintevaluation | ( | const Core::FMTconstraint & | constraint, |
const Models::FMTmodel & | model, | ||
const FMTspatialschedule * | friendlysolution = nullptr |
||
) | const |
Returns the double value of the evaluated solution constraint.
std::vector< double > Spatial::FMTspatialschedule::getconstraintsfactor | ( | ) | const |
Get the constraints factors for nomalization
std::vector< double > Spatial::FMTspatialschedule::getconstraintsvalues | ( | const Models::FMTmodel & | model, |
const FMTspatialschedule * | friendlysolution = nullptr |
||
) | const |
Fill up a vector of values for for each contraints (used for normalization)
FMTforest Spatial::FMTspatialschedule::getforestperiod | ( | const int & | period, |
bool | periodstart = false |
||
) | const |
Return the FMTforest corresponding to the period asked. If periodstart, the forest pass wil be the one before the actions as been set otherwise, it will be the forest after the actions as been set.
|
protected |
Get theline graph using the eventcontainer
|
protected |
Get the coordinate presents in the events for the outputnode, the action and the period asked.
std::vector< Core::FMTGCBMtransition > Spatial::FMTspatialschedule::getGCBMtransitions | ( | FMTlayer< std::string > & | stackedactions, |
const std::vector< Core::FMTaction > & | modelactions, | ||
const std::vector< Core::FMTtheme > & | classifiers, | ||
const int & | period | ||
) | const |
double Spatial::FMTspatialschedule::getglobalobjective | ( | const Models::FMTmodel & | model, |
const FMTspatialschedule * | friendlysolution = nullptr |
||
) | const |
Usefull to evaluate the quality of the solution it mixes objective to infeasibility and return it has double the lower the returned value is better is the solution. You can get a negative global objective.
std::vector< double > Spatial::FMTspatialschedule::getgraphsoutputs | ( | const Models::FMTmodel & | model, |
const Core::FMTconstraint & | constraint, | ||
const FMTspatialschedule * | friendlysolution = nullptr |
||
) | const |
Return sum of all graphs outputs related to constraint.
std::vector< Spatial::FMTcoordinate > Spatial::FMTspatialschedule::getmovablecoordinates | ( | const Models::FMTmodel & | model, |
const int & | period, | ||
const std::vector< Spatial::FMTcoordinate > * | statics, | ||
boost::unordered_map< Core::FMTdevelopment, bool > * | operability = nullptr |
||
) | const |
double Spatial::FMTspatialschedule::getobjectivevalue | ( | const Core::FMTconstraint & | constraint, |
const Models::FMTmodel & | model, | ||
const FMTspatialschedule * | friendlysolution = nullptr , |
||
bool | withsense = true |
||
) | const |
Returns the objective value of the spatialschedule
FMTlayer< double > Spatial::FMTspatialschedule::getoutput | ( | const Models::FMTmodel & | model, |
const Core::FMToutput & | output, | ||
const int & | period | ||
) | const |
Get the output value for the whole layer for a given period and output.
std::map< std::string, std::vector< double > > Spatial::FMTspatialschedule::getoutput | ( | const Models::FMTmodel & | model, |
const Core::FMToutput & | output, | ||
const int & | periodstart, | ||
const int & | periodstop, | ||
Core::FMToutputlevel | level = Core::FMToutputlevel::totalonly |
||
) | const |
Get the output value of a output for a given period using the solution.. the map key returned consist of output name if level == FMToutputlevel::standard || level == FMToutputlevel::totalonly, or developement name if level == FMToutputlevel::developpement
std::vector< std::pair< FMTcoordinate, double > > Spatial::FMTspatialschedule::getoutputbycoordinate | ( | const Models::FMTmodel & | model, |
const Core::FMToutput & | output, | ||
const int & | period | ||
) | const |
Return the output value by coordinate for a given output/model/period.
|
protected |
Get the output requested from a given linegraph into periods_values
|
protected |
Return the value of a given node at different linegraph const iterator
std::string Spatial::FMTspatialschedule::getpatchstats | ( | const std::vector< Core::FMTaction > & | actions | ) | const |
int Spatial::FMTspatialschedule::getperiodwithmaximalevents | ( | const std::vector< bool > & | actions | ) | const |
Get the period at with you got the maximal number of periods.
std::vector< std::vector< Graph::FMTpredictor > > Spatial::FMTspatialschedule::getpredictors | ( | FMTlayer< int > & | predictorids, |
const Models::FMTmodel & | model, | ||
const std::vector< std::string > & | yieldnames, | ||
const int & | period, | ||
bool | periodonevalues = false , |
||
bool | withGCBMid = true |
||
) | const |
Get the predictors for the whole solution and write down the predictorsids into a layer.
double Spatial::FMTspatialschedule::getprimalinfeasibility | ( | const std::vector< const Core::FMTconstraint * > & | constraints, |
const Models::FMTmodel & | model, | ||
const FMTspatialschedule * | friendlysolution = nullptr , |
||
bool | withfactorization = false |
||
) | const |
Returns dual infeasibility of a set of constraints.
std::vector< Core::FMTschedule > Spatial::FMTspatialschedule::getschedules | ( | const std::vector< Core::FMTaction > & | modelactions, |
bool | withlock = false |
||
) | const |
Return operated schedules from linegraph.
void Spatial::FMTspatialschedule::getsolutionstatus | ( | double & | objective, |
double & | primalinfeasibility, | ||
const Models::FMTmodel & | model, | ||
const FMTspatialschedule * | friendlysolution = nullptr , |
||
bool | withsense = true , |
||
bool | withfactorization = false , |
||
bool | withspatial = true |
||
) | const |
Get the primal infeasibility and objective value
std::vector< Spatial::FMTcoordinate > Spatial::FMTspatialschedule::getstaticsmovablecoordinates | ( | const Models::FMTmodel & | model | ) | const |
Returns a vector of coordinate that are considered movable
std::vector< std::set< Spatial::FMTcoordinate > > Spatial::FMTspatialschedule::getupdatedscheduling | ( | const Models::FMTmodel & | model, |
const std::vector< int > & | actiontargets, | ||
boost::unordered_map< Core::FMTdevelopment, std::vector< bool > > & | cachedaction, | ||
const std::vector< boost::unordered_set< Core::FMTdevelopment > > & | scheduleoperabilities, | ||
bool | schedule_only = true , |
||
std::vector< std::set< Spatial::FMTcoordinate > > | original = std::vector< std::set< Spatial::FMTcoordinate > >() , |
||
std::vector< FMTcoordinate > | updatedcoordinate = std::vector< FMTcoordinate >() |
||
) | const |
Return for all actions the FMTcoordinate with operable developments at the end of the graph.
std::vector< double > Spatial::FMTspatialschedule::getweightedfactors | ( | const Models::FMTmodel & | model, |
const FMTspatialschedule * | friendlysolution = nullptr |
||
) | const |
Generates factors based on the actual solution.
std::map< std::string, double > Spatial::FMTspatialschedule::greedyreferencebuild | ( | const Core::FMTschedule & | schedule, |
const Models::FMTmodel & | model, | ||
const size_t & | randomiterations, | ||
unsigned int | seed = 0 , |
||
double | tolerance = FMT_DBL_TOLERANCE , |
||
bool | log = true |
||
) |
This function call multiple time the simulate function to find the best possible spatialisation for a given schedule using random draw. It uses a schedule of actions (schedule) on the actual spatialy explicit forest. If the (schedule_only) switch is turned on the simulator wont try to find some operable developements (not present in the potential schedule) even if the area harvested target for that action is not reach. The user can also set the seed to get different solutions from the simulator.
void Spatial::FMTspatialschedule::grow | ( | ) |
|
protected |
Return the maximal patch size of a vector of spatialactions.
bool Spatial::FMTspatialschedule::isbetterbygroup | ( | const FMTspatialschedule & | rhs, |
const Models::FMTmodel & | model | ||
) | const |
Compare solution by constraint group.
std::vector< int > Spatial::FMTspatialschedule::isbetterthan | ( | const FMTspatialschedule & | newsolution, |
const Models::FMTmodel & | model | ||
) | const |
Compare two spatialschedule and return a vector of bool with true if the constraint group has a better value then the compared solution else false.
bool Spatial::FMTspatialschedule::ispartial | ( | ) | const |
return true if solution is partial.
FMTlayer< std::string > Spatial::FMTspatialschedule::lastdistlayer | ( | const std::vector< Core::FMTaction > & | modelactions, |
const int & | period | ||
) | const |
Return sum of all graphs outputs related to constraint.
void Spatial::FMTspatialschedule::logsolutionstatus | ( | const size_t & | iteration, |
const double & | objective, | ||
const double & | primalinfeasibility | ||
) | const |
Log the status of the solution
bool Spatial::FMTspatialschedule::needsrefactortorization | ( | const Models::FMTmodel & | model | ) | const |
Return true if the solution looks unscaled and need new factors
void Spatial::FMTspatialschedule::operatecoord | ( | const FMTcoordinate & | coord, |
const Core::FMTaction & | action, | ||
const int & | action_id, | ||
const FMTbindingspatialaction & | bindingspaction, | ||
const Core::FMTtransition & | Transition, | ||
const Core::FMTyields & | ylds, | ||
const std::vector< Core::FMTtheme > & | themes | ||
) |
Operate a coordinate and add it to the events ... That's why the FMTbindingspatialaction is needed
double Spatial::FMTspatialschedule::operateevents | ( | const FMTeventcontainer & | cuts, |
const Core::FMTaction & | action, | ||
const int & | action_id, | ||
const Core::FMTtransition & | Transition, | ||
const Core::FMTyields & | ylds, | ||
const std::vector< Core::FMTtheme > & | themes | ||
) |
bool Spatial::FMTspatialschedule::operator!= | ( | const FMTspatialschedule & | rhs | ) | const |
Comparison operator different than
FMTspatialschedule & Spatial::FMTspatialschedule::operator= | ( | const FMTspatialschedule & | rhs | ) |
Copy assignment of FMTspatialschedule
bool Spatial::FMTspatialschedule::operator== | ( | const FMTspatialschedule & | rhs | ) | const |
Comparison operator equal to
void Spatial::FMTspatialschedule::perturbgraph | ( | const FMTcoordinate & | coordinate, |
const int & | period, | ||
const Models::FMTmodel & | model, | ||
std::default_random_engine & | generator, | ||
const actionbindings & | bindings | ||
) |
Change one graph in the solution remove it's contribution to objective and add contribution to the newly generated to the objective.
void Spatial::FMTspatialschedule::postsolve | ( | const Core::FMTmaskfilter & | filter, |
const std::vector< Core::FMTaction > & | presolveactions, | ||
const Models::FMTmodel & | originalbasemodel | ||
) |
postsolve the spatial solution.
Graph::FMTgraphstats Spatial::FMTspatialschedule::randombuild | ( | const Models::FMTmodel & | model, |
std::default_random_engine & | generator | ||
) |
With a generator randomly create a solution for one period.
std::map< std::string, double > Spatial::FMTspatialschedule::referencebuild | ( | const Core::FMTschedule & | schedule, |
const Models::FMTmodel & | model, | ||
const std::vector< boost::unordered_set< Core::FMTdevelopment > > & | scheduleoperabilities, | ||
bool | schedule_only = true , |
||
bool | scheduleatfirstpass = true , |
||
unsigned int | seed = 0 |
||
) |
This is the main function to simulate a schedule of actions (schedule) on the actual spatialy explicit forest. If the (schedule_only) switch is turned on the simulator wont try to find some operable developements (not present in the potential schedule) even if the area harvested target for that action is not reach. The user can also set the seed to get different solutions from the simulator.
void Spatial::FMTspatialschedule::setconstraintsfactor | ( | const Models::FMTmodel & | model, |
const std::vector< double > & | factors | ||
) |
Set the constraints factors for nomalization
|
protected |
void Spatial::FMTspatialschedule::setgraphfromcache | ( | const Graph::FMTlinegraph & | graph, |
const Models::FMTmodel & | model, | ||
const int & | startingperiod, | ||
bool | remove = true |
||
) |
Removes the cached values for every nodes of the model of a given graph.If remove = false it add values to cache
void Spatial::FMTspatialschedule::swap | ( | FMTspatialschedule & | rhs | ) |
Swap operator for FMTspatialschedule.
bool Spatial::FMTspatialschedule::swapfromselected | ( | FMTspatialschedule & | rhs, |
const std::vector< size_t > & | selected | ||
) |
std::set< FMTcoordinate > Spatial::FMTspatialschedule::verifyspatialfeasability | ( | const int & | targetaction, |
const std::vector< Spatial::FMTbindingspatialaction > & | bindingactions, | ||
const int & | period, | ||
const std::set< FMTcoordinate > & | operables | ||
) | const |
Return the constraint evaluation value of a spatial constraint. For the target action, return a set of FMTcoordinate corresponding to the cells that are spatially allowable from coordinates that are operables. Mainly only check for coord respecting the greenup constraint.
|
protected |