Antares Xpansion
Investment simulations for Antares studies
Loading...
Searching...
No Matches
BendersByBatch.h
1#ifndef SRC_CPP_BENDERS_BENDERS_BY_BATCH_INCLUDE_BENDERSBYBATCH_H_
2#define SRC_CPP_BENDERS_BENDERS_BY_BATCH_INCLUDE_BENDERSBYBATCH_H_
3#include "BatchCollection.h"
4#include "antares-xpansion/benders/benders_mpi/BendersMPI.h"
5#include "antares-xpansion/benders/benders_mpi/common_mpi.h"
6
8{
9 std::vector<unsigned> random_batch_permutation_;
10
11public:
12 using BendersMpi::BendersMpi;
13 ~BendersByBatch() override = default;
14 void Run() override;
15 void BuildCut(const std::vector<std::string>& batch_sub_problems,
16 double* sum,
17 std::vector<double>& external_loop_criterion_current_batch);
18
19 std::string BendersName() const override
20 {
21 return "Benders By Batch mpi";
22 }
23
24protected:
25 void InitializeProblems() override;
26 void BroadcastSingleSubpbCostsUnderApprox();
27 void ComputeXCut() override;
28 void UpdateStoppingCriterion() override;
29 bool ShouldRelaxationStop() const override;
30
31private:
32 void GetSubproblemCut(SubProblemDataMap& subproblem_cut_package,
33 const std::vector<std::string>& batch_sub_problems,
34 double* batch_subproblems_costs_contribution_in_gap_per_proc);
35 BatchCollection batch_collection_;
36 void MasterLoop();
37 void SolveBatches();
38 void SeparationLoop();
39 void UpdateRemainingEpsilon();
40 void BroadcastXOut();
41 double Gap() const;
42 size_t number_of_batch_;
43 unsigned current_batch_id_;
44 int number_of_sub_problem_resolved_;
45 double remaining_epsilon_;
46 double cumulative_subproblems_timer_per_iter_;
47 bool misprice_;
48 int first_unsolved_batch_;
49 int batch_counter_;
50};
51
52#endif // SRC_CPP_BENDERS_BENDERS_BY_BATCH_INCLUDE_BENDERSBYBATCH_H_
Definition BatchCollection.h:25
Definition BendersByBatch.h:8
void BuildCut(const std::vector< std::string > &batch_sub_problems, double *sum, std::vector< double > &external_loop_criterion_current_batch)
Build subproblem cut Method to build subproblem cuts and add them to the Master problem.
Definition BendersByBatch.cpp:266
bool ShouldRelaxationStop() const override
Check if initial relaxation should stop.
Definition BendersByBatch.cpp:414
void UpdateStoppingCriterion() override
Update stopping criterion.
Definition BendersByBatch.cpp:388
Class use run the benders algorithm in parallel.
Definition BendersMPI.h:20