forked from AntaresSimulatorTeam/Antares_Simulator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
application.h
105 lines (82 loc) · 2.64 KB
/
application.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#pragma once
#include "misc/options.h"
#include <antares/study/study.h>
#include <antares/study/load-options.h>
#include <antares/benchmarking/DurationCollector.h>
#include <antares/benchmarking/timer.h>
#include "simulation/simulation.h"
#include "antares/infoCollection/StudyInfoCollector.h"
#include <antares/writer/i_writer.h>
#include <yuni/core/string.h>
namespace Antares::Solver
{
class Application final : public Yuni::IEventObserver<Application, Yuni::Policy::SingleThreaded>
{
public:
//! \name Constructor & Destructor
//@{
/*!
** \brief Default Constructor
*/
Application();
/*!
** \brief Destructor
*/
~Application() final;
//@}
Application(const Application&) = delete;
Application& operator=(const Application&) = delete;
/*!
** \brief Initialize data before launching the simulation
**
** \return False if the operation failed.
*/
void prepare(int argc, char* argv[]);
/*!
** \brief Execute the simulation
**
** \return Exit status
*/
void execute();
/*!
** \brief Reset the process priority (Windows only)
*/
void resetProcessPriority() const;
void writeExectutionInfo();
void installSignalHandlers() const;
private:
/*!
** \brief Reset the log filename and open it
*/
void resetLogFilename() const;
/*!
* \brief Load data of the study from a local or remote folder
*/
void readDataForTheStudy(Antares::Data::StudyLoadOptions& options);
void runSimulationInAdequacyMode();
void runSimulationInEconomicMode();
void initializeRandomNumberGenerators();
void onLogMessage(int level, const YString& message);
void processCaption(const Yuni::String& caption);
//! The settings given from the command line
Settings pSettings;
//! The current Antares study
Antares::Data::Study::Ptr pStudy = nullptr;
//! General data related to the current study
Antares::Data::Parameters* pParameters = nullptr;
//! The total number of errors which have been generated
uint pErrorCount = 0;
//! The total muber of warnings which have been generated
uint pWarningCount = 0;
int pArgc;
char** pArgv;
// Benchmarking
Benchmarking::Timer pTotalTimer;
Benchmarking::DurationCollector pDurationCollector;
Benchmarking::OptimizationInfo pOptimizationInfo;
std::shared_ptr<Yuni::Job::QueueService> ioQueueService;
IResultWriter::Ptr resultWriter = nullptr;
void prepareWriter(Antares::Data::Study& study,
Benchmarking::IDurationCollector& duration_collector);
}; // class Application
} // namespace Antares::Solver