46 void setup(QJSValue jsvalue);
58 Scheduler(
FMUnit* unit) { mUnit = unit; mExtraHarvest=0.; mFinalCutTarget=0.; mEnabled=
false; }
97 void setHarvestTarget(
double target_m3_ha,
double thinning_target_m3_ha) { mFinalCutTarget = std::max(target_m3_ha,0.01);
98 mThinningTarget = std::max(thinning_target_m3_ha,0.01); }
103 double scoreOf(
const int stand_id)
const;
104 QStringList
info(
const int stand_id)
const;
109 void updateCurrentPlan();
110 class SchedulerItem {
112 SchedulerItem(): stand(nullptr), score(0.), scheduledYear(-1) {}
113 bool operator<(
const SchedulerItem &item);
118 double scheduleScore;
126 ActivityFlags *flags;
128 struct ItemComparator
130 bool operator()(
const SchedulerItem *lx,
const SchedulerItem *rx )
const;
132 QList<SchedulerItem*> mItems;
133 QMultiHash<int, SchedulerItem*> mSchedule;
135 SchedulerItem* item(
const int stand_id)
const;
137 double mExtraHarvest;
138 double mFinalCutTarget;
139 double mThinningTarget;
142 static const int MAX_YEARS = 20;
Activity meta data (enabled, active, ...) that need to be stored per stand.
Definition: activity.h:110
FMStand encapsulates a forest stand for the forest management engine.
Definition: fmstand.h:49
The FMUnit represents a management unit, i.e.
Definition: fmunit.h:32
The Scheduler class schedules the forest management activities on a planning unit.
Definition: scheduler.h:56
Scheduler(FMUnit *unit)
Definition: scheduler.h:58
void resetHarvestCounter()
at the end of the year, reset the salvage harvests
Definition: scheduler.h:81
double harvestTarget() const
Definition: scheduler.h:99
double plannedHarvests(double &rFinal, double &rThinning)
return the total amount of planned harvests in the next planning period (10yrs) (total=false) if 'tot...
Definition: scheduler.cpp:293
int clearItemsOfStand(const FMStand *stand)
clear all items from the scheduler from a given stand returns the number of cleared items.
Definition: scheduler.cpp:70
QStringList info(const int stand_id) const
Definition: scheduler.cpp:325
void dump() const
write state of the scheduler to the console
Definition: scheduler.cpp:475
void run()
executes the scheduler for the planning unit.
Definition: scheduler.cpp:86
bool enabled() const
Definition: scheduler.h:62
void addExtraHarvest(const FMStand *stand, const double volume, HarvestType type)
tell the scheduler about extra harvests (that should be considered in the scheduling) volume: total v...
Definition: scheduler.cpp:287
bool forceHarvest(const FMStand *stand, const int max_years)
prepone a stand if in queue for the given stand.
Definition: scheduler.cpp:273
HarvestType
Definition: scheduler.h:59
@ EndHarvest
Definition: scheduler.h:59
@ Thinning
Definition: scheduler.h:59
@ Salvage
Definition: scheduler.h:59
void addTicket(FMStand *stand, ActivityFlags *flags, double prob_schedule, double prob_execute)
add an planned activity for a given stand.
Definition: scheduler.cpp:43
void setEnabled(bool enabled)
Definition: scheduler.h:61
double scoreOf(const int stand_id) const
get current score for stand 'id' return -1 if stand is invalid, 0..1 for probabilities,...
Definition: scheduler.cpp:310
void setHarvestTarget(double target_m3_ha, double thinning_target_m3_ha)
set the harvest target for the unit (m3/ha) for the current year.
Definition: scheduler.h:97
An expression engine for mathematical expressions provided as strings.
Definition: expression.h:29
SchedulerOptions store agent-specific options.
Definition: scheduler.h:34
void setup(QJSValue jsvalue)
Definition: scheduler.cpp:536
double useSustainableHarvest
scaling factor (0..1), 1 if scheduler used by agent (exclusively), 0: bottom up, linearly scaled in b...
Definition: scheduler.h:37
static QStringList mAllowedProperties
Definition: scheduler.h:47
double harvestIntensity
multiplier for the "sustainable" harvest level
Definition: scheduler.h:41
double scheduleRebounceDuration
number of years for which deviations from the planned volume are split into
Definition: scheduler.h:42
double deviationDecayRate
factor to reduce accumulated harvest deviation
Definition: scheduler.h:43
double maxHarvestLevel
multiplier to define the maximum overshoot over the planned volume (e.g. 1.2 -> 20% max....
Definition: scheduler.h:40
double maxAbsoluteHarvest
maximum harvest (only used if scheduler is disabled). Scheduler execution stops when level is surpass...
Definition: scheduler.h:44
SchedulerOptions()
Definition: scheduler.h:35
bool useScheduler
true, if the agent is using the scheduler at all
Definition: scheduler.h:36
double minScheduleHarvest
minimum amount of m3/ha*yr that should be scheduled
Definition: scheduler.h:38
double maxScheduleHarvest
the maximum number of m3/ha*yr that should be scheduled
Definition: scheduler.h:39