Added simulation model used in the optimization results struct
This commit is contained in:
parent
7a0124155c
commit
d8a6fadab7
|
|
@ -420,20 +420,11 @@ ReducedModelEvaluator::Results ReducedModelEvaluator::evaluateReducedModel(
|
|||
drmSimulationSettings.shouldCreatePlots = true;
|
||||
#endif
|
||||
constexpr bool shouldRerunFullPatternSimulation = false;
|
||||
enum PatternSimulationModelTag { DRM, Chronos };
|
||||
const PatternSimulationModelTag simulationModelTag{Chronos};
|
||||
const std::string simulationModelLabel = [&]() {
|
||||
switch (simulationModelTag) {
|
||||
case DRM:
|
||||
return DRMSimulationModel::label;
|
||||
case Chronos:
|
||||
return ChronosEulerSimulationModel::label;
|
||||
}
|
||||
}();
|
||||
const std::string &simulationModelLabel = optimizationResult.settings.simulationModelLabel;
|
||||
// for (int jobIndex = 0; jobIndex < scenariosTestSetLabels.size(); jobIndex++) {
|
||||
std::for_each(
|
||||
//#ifndef POLYSCOPE_DEFINED
|
||||
// std::execution::par_unseq,
|
||||
std::execution::par_unseq,
|
||||
//#endif
|
||||
scenariosTestSetLabels.begin(),
|
||||
scenariosTestSetLabels.end(),
|
||||
|
|
@ -540,20 +531,20 @@ ReducedModelEvaluator::Results ReducedModelEvaluator::evaluateReducedModel(
|
|||
<< tilledPatternResultsFolderPath << std::endl;
|
||||
//Full
|
||||
std::cout << "Executing:" << jobLabel << std::endl;
|
||||
switch (simulationModelTag) {
|
||||
case DRM: {
|
||||
if (simulationModelLabel == DRMSimulationModel::label) {
|
||||
DRMSimulationModel drmSimulationModel;
|
||||
simulationResults_tilledPattern = drmSimulationModel
|
||||
.executeSimulation(pJob_tiledFullPattern,
|
||||
drmSimulationSettings);
|
||||
break;
|
||||
}
|
||||
case Chronos: {
|
||||
} else if (simulationModelLabel == ChronosEulerSimulationModel::label) {
|
||||
ChronosEulerSimulationModel chronosSimulationModel;
|
||||
simulationResults_tilledPattern = chronosSimulationModel.executeSimulation(
|
||||
pJob_tiledFullPattern);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
std::cerr << "Simulation model used for computing the optimization results was "
|
||||
"not recognized"
|
||||
<< std::endl;
|
||||
std::terminate();
|
||||
}
|
||||
}
|
||||
if (!simulationResults_tilledPattern.converged) {
|
||||
|
|
|
|||
|
|
@ -208,6 +208,7 @@ struct Settings
|
|||
xRange{"J", 1e-3, 1e3},
|
||||
xRange{"R", 0.05, 0.95},
|
||||
xRange{"Theta", -30, 30}};
|
||||
std::string simulationModelLabel{DRMSimulationModel::label};
|
||||
struct SettingsPSO
|
||||
{
|
||||
int numberOfParticles{200};
|
||||
|
|
@ -307,6 +308,7 @@ struct Settings
|
|||
json[GET_VARIABLE_NAME(angularDistanceEpsilon)] = vcg::math::ToDeg(angularDistanceEpsilon);
|
||||
json[GET_VARIABLE_NAME(targetBaseTriangleSize)] = targetBaseTriangleSize;
|
||||
json[GET_VARIABLE_NAME(baseScenarioMaxMagnitudes)] = baseScenarioMaxMagnitudes;
|
||||
json[GET_VARIABLE_NAME(simulationModelLabel)] = simulationModelLabel;
|
||||
nlohmann::json json_dimensions;
|
||||
patternBeamDimensions.to_json(json_dimensions, patternBeamDimensions);
|
||||
json.update(json_dimensions);
|
||||
|
|
@ -412,6 +414,11 @@ struct Settings
|
|||
pso.numberOfParticles = static_cast<int>(json[GET_VARIABLE_NAME(pso.numberOfParticles)]);
|
||||
}
|
||||
|
||||
if (json.contains(GET_VARIABLE_NAME(simulationModelLabel))) {
|
||||
simulationModelLabel = static_cast<std::string>(
|
||||
json[GET_VARIABLE_NAME(simulationModelLabel)]);
|
||||
}
|
||||
|
||||
patternBeamDimensions.from_json(json, patternBeamDimensions);
|
||||
|
||||
// perBaseScenarioObjectiveWeights = json.at(JsonKeys::ObjectiveWeights);
|
||||
|
|
|
|||
Loading…
Reference in New Issue