7#ifndef FMTSPATIALSCHEDULE_H
8#define FMTSPATIALSCHEDULE_H
17 class FMTGCBMtransition;
47 std::vector<double>constraintsfactor;
49 typedef std::vector<std::vector<Spatial::FMTbindingspatialaction>>
actionbindings;
81 const std::vector<FMTcoordinate>::const_iterator& firstcoord,
82 const std::vector<FMTcoordinate>::const_iterator& endcoord);
102 bool empty()
const {
return mapping.empty();};
128 bool allow_action(
const int& targetaction,
const std::vector<Spatial::FMTbindingspatialaction>&bindingactions,
const FMTcoordinate& location,
const int& period)
const;
135 const std::vector<int>& actiontargets,
137 const std::vector<boost::unordered_set<Core::FMTdevelopment>>& scheduleoperabilities,
138 bool schedule_only =
true,
139 std::vector<std::set<Spatial::FMTcoordinate>> original= std::vector<std::set<Spatial::FMTcoordinate>>(),
140 std::vector<FMTcoordinate> updatedcoordinate= std::vector<FMTcoordinate>())
const;
164 const std::vector<Spatial::FMTbindingspatialaction>& bindingactions,
165 const int& period,
const std::set<FMTcoordinate>& operables)
const;
171 const int& previousperiod,
const int& actionid, std::vector<FMTcoordinate>& operated)
const;
177 const Core::FMTyields& ylds,
const std::vector<Core::FMTtheme>& themes);
183 const Core::FMTyields& ylds,
const std::vector<Core::FMTtheme>& themes);
198 std::vector<Core::FMTschedule>
getschedules(
const std::vector<Core::FMTaction>& modelactions,
bool withlock=
false)
const;
240 void logsolutionstatus(
const size_t& iteration,
const double& objective,
const double& primalinfeasibility)
const;
246 const FMTspatialschedule* friendlysolution =
nullptr,
bool withsense =
true,
bool withfactorization =
false,
bool withspatial =
true)
const;
270 std::string
getpatchstats(
const std::vector<Core::FMTaction>& actions)
const;
280 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;
285 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;
311 const std::vector<boost::unordered_set<Core::FMTdevelopment>>& scheduleoperabilities,
312 bool schedule_only =
true,
313 bool scheduleatfirstpass =
true,
314 unsigned int seed = 0);
325 const size_t& randomiterations,
326 unsigned int seed = 0,
356 const std::vector<Spatial::FMTcoordinate>* statics,
357 boost::unordered_map<Core::FMTdevelopment, bool>*operability =
nullptr)
const;
427 const int& periodstart,
const int& periodstop,
455 std::vector<const Graph::FMTlinegraph*>
getfromevents(
const Core::FMTconstraint& constraint,
const std::vector<Core::FMTaction>& actions,
const int& start,
const int& stop)
const;
495 double evaluatespatialadjacency(
497 const size_t& greenup,
498 const size_t& lowerlookup,
499 const size_t& upperlookup,
500 const bool& testlower,
501 const bool& testupper,
502 std::vector<FMTeventcontainer::const_iterator>& conflicts,
503 boost::unordered_set<FMTeventrelation>& relations,
504 const std::vector<bool>& actionused)
const;
#define FMT_DBL_TOLERANCE
Definition: FMTutility.hpp:11
#define FMTEXPORT
Definition: FMTutility.hpp:92
Definition: FMTaction.hpp:42
Definition: FMTconstraint.hpp:54
Definition: FMTdevelopment.hpp:44
Definition: FMTmask.hpp:96
Definition: FMTmaskfilter.hpp:27
Definition: FMToutput.hpp:39
Definition: FMToutputnode.hpp:20
Definition: FMTschedule.hpp:31
Definition: FMTtransition.hpp:37
Definition: FMTyields.hpp:40
Definition: FMTgraphstats.hpp:28
Definition: FMTlinegraph.hpp:30
Definition: FMTmodel.hpp:60
Definition: FMTbindingspatialaction.hpp:19
Definition: FMTcoordinate.hpp:25
Definition: FMTeventcontainer.hpp:35
Definition: FMTforest.hpp:27
Definition: FMTlayer.hpp:29
Definition: FMTspatialnodescache.hpp:33
Definition: FMTspatialschedule.hpp:44
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
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
FMTspatialschedule(const FMTspatialschedule &other, const std::vector< FMTcoordinate >::const_iterator &firstcoord, const std::vector< FMTcoordinate >::const_iterator &endcoord)
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)
double getglobalobjective(const Models::FMTmodel &model, const FMTspatialschedule *friendlysolution=nullptr) const
double evaluatespatialconstraint(const Core::FMTconstraint &spatialconstraint, const Models::FMTmodel &model) const
void copyfrompartial(FMTspatialschedule &rhs)
std::vector< Spatial::FMTcoordinate > getstaticsmovablecoordinates(const Models::FMTmodel &model) const
std::string getpatchstats(const std::vector< Core::FMTaction > &actions) const
void logsolutionstatus(const size_t &iteration, const double &objective, const double &primalinfeasibility) const
void setconstraintsfactor(const Models::FMTmodel &model, const std::vector< double > &factors)
double getobjectivevalue(const Core::FMTconstraint &constraint, const Models::FMTmodel &model, const FMTspatialschedule *friendlysolution=nullptr, bool withsense=true) const
Graph::FMTgraphstats randombuild(const Models::FMTmodel &model, std::default_random_engine &generator)
std::vector< FMTcoordinate > getfromevents(const Core::FMToutputnode &node, const std::vector< Core::FMTaction > &actions, const int &period) const
actionbindings getbindingactionsbyperiod(const Models::FMTmodel &model) const
FMTspatialschedule & operator=(const FMTspatialschedule &rhs)
std::vector< Spatial::FMTbindingspatialaction > getbindingactions(const Models::FMTmodel &model, const int &period) const
std::vector< FMTlayer< Graph::FMTlinegraph >::const_iterator > getoutputfromnode(const Models::FMTmodel &model, const Core::FMToutputnode &node, 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
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)
FMTforest getforestperiod(const int &period, bool periodstart=false) const
bool empty() const
Definition: FMTspatialschedule.hpp:102
bool swapfromselected(FMTspatialschedule &rhs, const std::vector< size_t > &selected)
std::vector< const Graph::FMTlinegraph * > getfromevents(const Core::FMTconstraint &constraint, const std::vector< Core::FMTaction > &actions, const int &start, const int &stop) const
int getperiodwithmaximalevents(const std::vector< bool > &actions) const
virtual ~FMTspatialschedule()=default
FMTspatialschedule(const FMTspatialschedule &other)
void dorefactortorization(const Models::FMTmodel &model)
bool needsrefactortorization(const Models::FMTmodel &model) const
std::vector< Core::FMTschedule > getschedules(const std::vector< Core::FMTaction > &modelactions, bool withlock=false) const
bool copyfromselected(const FMTspatialschedule &rhs, const std::vector< size_t > &selected)
std::vector< double > getweightedfactors(const Models::FMTmodel &model, const FMTspatialschedule *friendlysolution=nullptr) const
std::vector< std::pair< FMTcoordinate, double > > getoutputbycoordinate(const Models::FMTmodel &model, const Core::FMToutput &output, 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
FMTspatialschedule(const FMTforest &initialmap)
void copyfrompartial(const FMTspatialschedule &rhs)
void setgraphfromcache(const Graph::FMTlinegraph &graph, const Models::FMTmodel &model, const int &startingperiod, bool remove=true)
std::set< FMTcoordinate > verifyspatialfeasability(const int &targetaction, const std::vector< Spatial::FMTbindingspatialaction > &bindingactions, const int &period, const std::set< FMTcoordinate > &operables) const
std::vector< std::vector< Spatial::FMTcoordinate > > getareaconflictcoordinates(const actionbindings &bindingactions, const int &period, bool conflictonly=true) 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 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)
std::vector< std::vector< Spatial::FMTcoordinate > > getadjacencyconflictcoordinates(const actionbindings &bindingactions, const int &period, bool conflictonly=true) const
std::vector< double > getconstraintsfactor() const
std::vector< double > getgraphsoutputs(const Models::FMTmodel &model, const Core::FMTconstraint &constraint, const FMTspatialschedule *friendlysolution=nullptr) const
void swap(FMTspatialschedule &rhs)
bool allow_action(const int &targetaction, const std::vector< Spatial::FMTbindingspatialaction > &bindingactions, const FMTcoordinate &location, const int &period) const
void postsolve(const Core::FMTmaskfilter &filter, const std::vector< Core::FMTaction > &presolveactions, const Models::FMTmodel &originalbasemodel)
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
FMTlayer< std::string > lastdistlayer(const std::vector< Core::FMTaction > &modelactions, 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
FMTeventcontainer events
Definition: FMTspatialschedule.hpp:450
std::vector< std::vector< Spatial::FMTbindingspatialaction > > actionbindings
Definition: FMTspatialschedule.hpp:49
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 setgraphcachebystatic(const std::vector< FMTcoordinate > &coordinates, const Core::FMToutputnode &node) const
double getprimalinfeasibility(const std::vector< const Core::FMTconstraint * > &constraints, const Models::FMTmodel &model, const FMTspatialschedule *friendlysolution=nullptr, bool withfactorization=false) 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< int > isbetterthan(const FMTspatialschedule &newsolution, const Models::FMTmodel &model) const
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)
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
FMTspatialschedule(FMTspatialschedule &&rhs) noexcept
FMTlayer< double > getoutput(const Models::FMTmodel &model, const Core::FMToutput &output, 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
The Core namespace provides classes for simulating stands/strata growth/harvest through time.
Definition: FMTaction.hpp:31
FMToutputlevel
Definition: FMTutility.hpp:17
@ totalonly
Definition: FMTutility.hpp:19
The spatial namespace provides classes for spatialy explicit simulation/optimization based on raster ...
Definition: FMTareaparser.hpp:36
FMTspatialscheduletype
Definition: FMTspatialschedule.hpp:32
@ FMTcomplete
Definition: FMTspatialschedule.hpp:33
@ FMTpartial
Definition: FMTspatialschedule.hpp:34