|
Monte Carlo Integration Library 1.0
High-performance Monte Carlo methods for numerical integration and optimization
|
Wind Farm Layout Optimization using Hybrid MH-Monte Carlo + PSO/GA. More...
#include <iostream>#include <vector>#include <cmath>#include <random>#include <fstream>#include <iomanip>#include <limits>#include <functional>#include <chrono>#include <cstdint>#include <array>#include <mutex>#include <sstream>#include <omp.h>#include "../montecarlo/rng/rng_global.hpp"#include "../montecarlo/rng/rng_factory.hpp"#include "../montecarlo/optimizers/PSO.hpp"#include "../montecarlo/optimizers/GA.hpp"#include "../montecarlo/optimizers/types.hpp"#include "../montecarlo/proposals/proposal.hpp"#include "../montecarlo/proposals/gaussianProposal.hpp"#include "../montecarlo/integrators/MHintegrator.hpp"#include "../montecarlo/domains/integration_domain.hpp"#include "../montecarlo/domains/hyperrectangle.hpp"#include "../montecarlo/geometry.hpp"Go to the source code of this file.
Classes | |
| class | NullBuffer |
| class | CoutRedirector |
| struct | RunResult |
Functions | |
| double | turbineDistance (double x1, double y1, double x2, double y2) |
| void | extractTurbinePositions (const mc::optim::Coordinates &coords, std::vector< double > &x, std::vector< double > &y) |
| double | computeProximityPenalty (const std::vector< double > &x, const std::vector< double > &y) |
| double | windPower (double wind_speed) |
| double | applyWakeEffect (double base_speed, double distance) |
| double | weibull_pdf (double v) |
| void | mapToPhysicalWind (const mc::geom::Point< 2 > &w, double &v, double &theta) |
| static mc::domains::IntegrationDomain< 2 > * | buildWindDomainOwned () |
| static double | farmPowerGivenWind (const std::vector< double > &x, const std::vector< double > &y, double wind_speed, double wind_direction) |
| static double | estimateAveragePowerMH (const std::vector< double > &x, const std::vector< double > &y, std::uint32_t seed32) |
| std::uint64_t | hashCoordsForSeed (const mc::optim::Coordinates &coords) |
| double | windFarmObjective (const mc::optim::Coordinates &coords, std::uint64_t thread_seed) |
| void | writeResultsFile (const std::string &filename, const std::vector< double > &x, const std::vector< double > &y) |
| void | writePlotScript (const std::string &filename, const std::string &data_file, const std::string &output_png) |
| static double | computeMinDistance (const std::vector< double > &x, const std::vector< double > &y) |
| template<typename OptimizerT > | |
| RunResult | runOptimizer (const std::string &name, OptimizerT &optimizer, const mc::optim::Coordinates &lower_bounds, const mc::optim::Coordinates &upper_bounds, const std::string &results_file, const std::string &plot_script, const std::string &output_png) |
| static void | printFinalComparisonTable (const RunResult &pso_res, const RunResult &ga_res) |
| int | main () |
Variables | |
| constexpr size_t | NUM_TURBINES = 15 |
| constexpr double | FARM_WIDTH = 1000.0 |
| constexpr double | FARM_HEIGHT = 1000.0 |
| constexpr double | MIN_TURBINE_DISTANCE = 50.0 |
| constexpr double | PROXIMITY_PENALTY = 1e8 |
| constexpr double | WEIBULL_SHAPE = 2.0 |
| constexpr double | WEIBULL_SCALE = 8.0 |
| constexpr double | POWER_COEFFICIENT = 0.4 |
| constexpr double | AIR_DENSITY = 1.225 |
| constexpr double | ROTOR_AREA = M_PI * 25.0 * 25.0 |
| constexpr int | MH_SAMPLES = 1500 |
| constexpr size_t | MH_BURN_IN = 400 |
| constexpr size_t | MH_THINNING = 2 |
| constexpr size_t | MH_SAMPLES_FOR_VOL = 2000 |
| constexpr double | PROPOSAL_SIGMA_V = 2.5 |
| constexpr double | PROPOSAL_SIGMA_THETA = 0.6 |
| constexpr double | WIND_SPEED_MIN = 0.0 |
| constexpr double | WIND_SPEED_MAX = 40.0 |
| constexpr double | WIND_THETA_MIN = 0.0 |
| constexpr double | WIND_THETA_MAX = 2.0 * M_PI |
| constexpr double | WIND_SPEED_CENTER = 0.5 * (WIND_SPEED_MIN + WIND_SPEED_MAX) |
| constexpr double | WIND_THETA_CENTER = 0.5 * (WIND_THETA_MIN + WIND_THETA_MAX) |
| constexpr size_t | PROGRESS_EVERY = 10 |
| static std::mutex | g_print_mutex |
| static std::mutex | g_cout_redirect_mutex |
Wind Farm Layout Optimization using Hybrid MH-Monte Carlo + PSO/GA.
Advanced application demonstrating two parallel optimization approaches:
Approach 1: Metropolis-Hastings MCMC Integration
Approach 2: Heuristic Optimization (PSO/GA)
Key Features:
Outputs:
Definition in file wind_farm_simulator.cpp.
|
inline |
Definition at line 198 of file wind_farm_simulator.cpp.
|
static |
Definition at line 227 of file wind_farm_simulator.cpp.
|
static |
| double computeProximityPenalty | ( | const std::vector< double > & | x, |
| const std::vector< double > & | y | ||
| ) |
|
static |
|
inline |
Definition at line 164 of file wind_farm_simulator.cpp.
|
inlinestatic |
|
inline |
Definition at line 350 of file wind_farm_simulator.cpp.
| int main | ( | ) |
|
inline |
Definition at line 218 of file wind_farm_simulator.cpp.
|
static |
Definition at line 521 of file wind_farm_simulator.cpp.
| RunResult runOptimizer | ( | const std::string & | name, |
| OptimizerT & | optimizer, | ||
| const mc::optim::Coordinates & | lower_bounds, | ||
| const mc::optim::Coordinates & | upper_bounds, | ||
| const std::string & | results_file, | ||
| const std::string & | plot_script, | ||
| const std::string & | output_png | ||
| ) |
|
inline |
Definition at line 158 of file wind_farm_simulator.cpp.
|
inline |
Definition at line 208 of file wind_farm_simulator.cpp.
| double windFarmObjective | ( | const mc::optim::Coordinates & | coords, |
| std::uint64_t | thread_seed | ||
| ) |
|
inline |
Definition at line 193 of file wind_farm_simulator.cpp.
| void writePlotScript | ( | const std::string & | filename, |
| const std::string & | data_file, | ||
| const std::string & | output_png | ||
| ) |
Definition at line 411 of file wind_farm_simulator.cpp.
| void writeResultsFile | ( | const std::string & | filename, |
| const std::vector< double > & | x, | ||
| const std::vector< double > & | y | ||
| ) |
Definition at line 390 of file wind_farm_simulator.cpp.
|
constexpr |
Definition at line 84 of file wind_farm_simulator.cpp.
|
constexpr |
Definition at line 73 of file wind_farm_simulator.cpp.
|
constexpr |
Definition at line 72 of file wind_farm_simulator.cpp.
|
static |
Definition at line 118 of file wind_farm_simulator.cpp.
|
static |
Definition at line 115 of file wind_farm_simulator.cpp.
|
constexpr |
Definition at line 89 of file wind_farm_simulator.cpp.
|
constexpr |
Definition at line 88 of file wind_farm_simulator.cpp.
|
constexpr |
Definition at line 91 of file wind_farm_simulator.cpp.
|
constexpr |
Definition at line 90 of file wind_farm_simulator.cpp.
|
constexpr |
Definition at line 75 of file wind_farm_simulator.cpp.
|
constexpr |
Definition at line 70 of file wind_farm_simulator.cpp.
|
constexpr |
Definition at line 83 of file wind_farm_simulator.cpp.
|
constexpr |
Definition at line 108 of file wind_farm_simulator.cpp.
|
constexpr |
Definition at line 95 of file wind_farm_simulator.cpp.
|
constexpr |
Definition at line 94 of file wind_farm_simulator.cpp.
|
constexpr |
Definition at line 76 of file wind_farm_simulator.cpp.
|
constexpr |
Definition at line 85 of file wind_farm_simulator.cpp.
|
constexpr |
Definition at line 80 of file wind_farm_simulator.cpp.
|
constexpr |
Definition at line 79 of file wind_farm_simulator.cpp.
|
constexpr |
Definition at line 104 of file wind_farm_simulator.cpp.
|
constexpr |
Definition at line 99 of file wind_farm_simulator.cpp.
|
constexpr |
Definition at line 98 of file wind_farm_simulator.cpp.
|
constexpr |
Definition at line 105 of file wind_farm_simulator.cpp.
|
constexpr |
Definition at line 101 of file wind_farm_simulator.cpp.
|
constexpr |
Definition at line 100 of file wind_farm_simulator.cpp.