Added per optimization parameter reduced pattern update functions for variable comparison
This commit is contained in:
parent
5d8d76e0c1
commit
6c92b291da
|
@ -29,7 +29,6 @@ if(${CMAKE_BUILD_TYPE} STREQUAL "Release")
|
|||
set(USE_POLYSCOPE FALSE)
|
||||
set(MYSOURCES_STATIC_LINK TRUE)
|
||||
else()
|
||||
add_compile_definitions(POLYSCOPE_DEFINED)
|
||||
set(USE_POLYSCOPE TRUE)
|
||||
add_compile_definitions(POLYSCOPE_DEFINED)
|
||||
set(MYSOURCES_STATIC_LINK FALSE)
|
||||
|
|
|
@ -47,8 +47,8 @@ int main(int argc, char *argv[]) {
|
|||
ReducedPatternOptimization::xRange innerHexagonSize{"R", 0.05, 0.95};
|
||||
ReducedPatternOptimization::xRange innerHexagonAngle{"Theta", -30.0, 30.0};
|
||||
ReducedPatternOptimization::Settings settings_optimization;
|
||||
settings_optimization.xRanges
|
||||
= {/*beamE,*/ beamA, beamI2, beamI3, beamJ, innerHexagonSize, innerHexagonAngle};
|
||||
settings_optimization.parameterRanges
|
||||
= {beamE, beamA, beamI2, beamI3, beamJ, innerHexagonSize, innerHexagonAngle};
|
||||
const bool input_numberOfFunctionCallsDefined = argc >= 4;
|
||||
settings_optimization.numberOfFunctionCalls = input_numberOfFunctionCallsDefined
|
||||
? std::atoi(argv[3])
|
||||
|
@ -66,7 +66,7 @@ int main(int argc, char *argv[]) {
|
|||
settings_optimization.objectiveWeights.rotational = 2 - std::atof(argv[4]);
|
||||
|
||||
std::string xConcatNames;
|
||||
for (const auto &x : settings_optimization.xRanges) {
|
||||
for (const auto &x : settings_optimization.parameterRanges) {
|
||||
xConcatNames.append(x.label + "_");
|
||||
}
|
||||
xConcatNames.pop_back();
|
||||
|
@ -117,7 +117,7 @@ int main(int argc, char *argv[]) {
|
|||
const std::vector<size_t> numberOfNodesPerSlot{1, 0, 0, 2, 1, 2, 1};
|
||||
assert(interfaceNodeIndex == numberOfNodesPerSlot[0] + numberOfNodesPerSlot[3]);
|
||||
ReducedModelOptimizer optimizer(numberOfNodesPerSlot);
|
||||
optimizer.initializePatterns(fullPattern, reducedPattern, settings_optimization.xRanges);
|
||||
optimizer.initializePatterns(fullPattern, reducedPattern, settings_optimization.parameterRanges);
|
||||
optimizer.optimize(settings_optimization, optimizationResults);
|
||||
optimizationResults.label = optimizationName;
|
||||
optimizationResults.baseTriangleFullPattern.copy(fullPattern);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -36,8 +36,22 @@ class ReducedModelOptimizer
|
|||
constructBaseScenarioFunctions;
|
||||
std::vector<bool> scenarioIsSymmetrical;
|
||||
int fullPatternNumberOfEdges;
|
||||
constexpr static double youngsModulus{1 * 1e9};
|
||||
|
||||
public:
|
||||
constexpr static struct ParameterLabels
|
||||
{
|
||||
inline const static std::string E = {"E"};
|
||||
inline const static std::string A = {"A"};
|
||||
inline const static std::string I2 = {"I2"};
|
||||
inline const static std::string I3 = {"I3"};
|
||||
inline const static std::string J = {"J"};
|
||||
inline const static std::string theta = {"Theta"};
|
||||
inline const static std::string R = {"R"};
|
||||
} parameterLabels;
|
||||
|
||||
enum OptimizationParameterIndex { E, A, I2, I3, J, R, Theta, NumberOfOptimizationParameters };
|
||||
|
||||
constexpr static std::array<int, 5> simulationScenariosResolution = {11, 11, 20, 20, 20};
|
||||
// constexpr static std::array<int, 5> simulationScenariosResolution = {3, 3, 3, 3, 3};
|
||||
inline static int totalNumberOfSimulationScenarios
|
||||
|
@ -74,15 +88,6 @@ public:
|
|||
|
||||
static void runSimulation(const std::string &filename, std::vector<double> &x);
|
||||
|
||||
static double objective(double x2,
|
||||
double A,
|
||||
double J,
|
||||
double I2,
|
||||
double I3,
|
||||
double x3,
|
||||
double innerHexagonRotationAngle);
|
||||
static double objective(double b, double r, double E);
|
||||
|
||||
static std::vector<std::shared_ptr<SimulationJob>> createFullPatternSimulationJobs(
|
||||
const std::shared_ptr<SimulationMesh> &pMesh,
|
||||
const std::unordered_map<size_t, size_t> &fullPatternOppositeInterfaceViMap);
|
||||
|
@ -179,31 +184,31 @@ public:
|
|||
&oppositeInterfaceViPairs,
|
||||
SimulationJob &job);
|
||||
static std::function<void(const dlib::matrix<double, 0, 1> &x,
|
||||
std::shared_ptr<SimulationMesh> &m)>
|
||||
std::shared_ptr<SimulationMesh> &pReducedPatternSimulationMesh)>
|
||||
function_updateReducedPattern;
|
||||
static std::function<void(const dlib::matrix<double, 0, 1> &x,
|
||||
std::shared_ptr<SimulationMesh> &m)>
|
||||
std::shared_ptr<SimulationMesh> &pReducedPatternSimulationMesh)>
|
||||
function_updateReducedPattern_material;
|
||||
static std::function<void(std::shared_ptr<SimulationMesh> &pReducedPatternSimulationMesh,
|
||||
const double &newE)>
|
||||
static std::function<void(const double &newE,
|
||||
std::shared_ptr<SimulationMesh> &pReducedPatternSimulationMesh)>
|
||||
function_updateReducedPattern_material_E;
|
||||
static std::function<void(std::shared_ptr<SimulationMesh> &pReducedPatternSimulationMesh,
|
||||
const double &newA)>
|
||||
static std::function<void(const double &newA,
|
||||
std::shared_ptr<SimulationMesh> &pReducedPatternSimulationMesh)>
|
||||
function_updateReducedPattern_material_A;
|
||||
static std::function<void(std::shared_ptr<SimulationMesh> &pReducedPatternSimulationMesh,
|
||||
const double &newI)>
|
||||
static std::function<void(const double &newI,
|
||||
std::shared_ptr<SimulationMesh> &pReducedPatternSimulationMesh)>
|
||||
function_updateReducedPattern_material_I;
|
||||
static std::function<void(std::shared_ptr<SimulationMesh> &pReducedPatternSimulationMesh,
|
||||
const double &newI2)>
|
||||
static std::function<void(const double &newI2,
|
||||
std::shared_ptr<SimulationMesh> &pReducedPatternSimulationMesh)>
|
||||
function_updateReducedPattern_material_I2;
|
||||
static std::function<void(std::shared_ptr<SimulationMesh> &pReducedPatternSimulationMesh,
|
||||
const double &newI3)>
|
||||
static std::function<void(const double &newI3,
|
||||
std::shared_ptr<SimulationMesh> &pReducedPatternSimulationMesh)>
|
||||
function_updateReducedPattern_material_I3;
|
||||
static std::function<void(std::shared_ptr<SimulationMesh> &pReducedPatternSimulationMesh,
|
||||
const double &newJ)>
|
||||
static std::function<void(const double &newJ,
|
||||
std::shared_ptr<SimulationMesh> &pReducedPatternSimulationMesh)>
|
||||
function_updateReducedPattern_material_J;
|
||||
static std::function<void(const dlib::matrix<double, 0, 1> &x,
|
||||
std::shared_ptr<SimulationMesh> &m)>
|
||||
std::shared_ptr<SimulationMesh> &pReducedPatternSimulationMesh)>
|
||||
function_updateReducedPattern_geometry;
|
||||
|
||||
private:
|
||||
|
@ -223,7 +228,6 @@ private:
|
|||
const std::shared_ptr<SimulationMesh> &mesh,
|
||||
const std::vector<ReducedPatternOptimization::xRange> &optimizationParamters);
|
||||
|
||||
static double objective(long n, const double *x);
|
||||
DRMSimulationModel simulator;
|
||||
void computeObjectiveValueNormalizationFactors();
|
||||
static void getResults(const dlib::function_evaluation &optimizationResult_dlib,
|
||||
|
@ -242,30 +246,32 @@ private:
|
|||
&desiredBaseSimulationScenarioIndices);
|
||||
static double objective(const dlib::matrix<double, 0, 1> &x);
|
||||
static void initializeUpdateReducedPatternFunctions();
|
||||
static double objective(const double &xValue);
|
||||
};
|
||||
inline std::function<void(const dlib::matrix<double, 0, 1> &x, std::shared_ptr<SimulationMesh> &m)>
|
||||
ReducedModelOptimizer::function_updateReducedPattern;
|
||||
inline std::function<void(const dlib::matrix<double, 0, 1> &x, std::shared_ptr<SimulationMesh> &m)>
|
||||
ReducedModelOptimizer::function_updateReducedPattern_material;
|
||||
inline std::function<void(std::shared_ptr<SimulationMesh> &pReducedPatternSimulationMesh,
|
||||
const double &newE)>
|
||||
inline std::function<void(const double &newE,
|
||||
std::shared_ptr<SimulationMesh> &pReducedPatternSimulationMesh)>
|
||||
ReducedModelOptimizer::function_updateReducedPattern_material_E;
|
||||
inline std::function<void(std::shared_ptr<SimulationMesh> &pReducedPatternSimulationMesh,
|
||||
const double &newA)>
|
||||
inline std::function<void(const double &newA,
|
||||
std::shared_ptr<SimulationMesh> &pReducedPatternSimulationMesh)>
|
||||
ReducedModelOptimizer::function_updateReducedPattern_material_A;
|
||||
inline std::function<void(std::shared_ptr<SimulationMesh> &pReducedPatternSimulationMesh,
|
||||
const double &newI)>
|
||||
inline std::function<void(const double &newI,
|
||||
std::shared_ptr<SimulationMesh> &pReducedPatternSimulationMesh)>
|
||||
ReducedModelOptimizer::function_updateReducedPattern_material_I;
|
||||
inline std::function<void(std::shared_ptr<SimulationMesh> &pReducedPatternSimulationMesh,
|
||||
const double &newI2)>
|
||||
inline std::function<void(const double &newI2,
|
||||
std::shared_ptr<SimulationMesh> &pReducedPatternSimulationMesh)>
|
||||
ReducedModelOptimizer::function_updateReducedPattern_material_I2;
|
||||
inline std::function<void(std::shared_ptr<SimulationMesh> &pReducedPatternSimulationMesh,
|
||||
const double &newI3)>
|
||||
inline std::function<void(const double &newI3,
|
||||
std::shared_ptr<SimulationMesh> &pReducedPatternSimulationMesh)>
|
||||
ReducedModelOptimizer::function_updateReducedPattern_material_I3;
|
||||
inline std::function<void(std::shared_ptr<SimulationMesh> &pReducedPatternSimulationMesh,
|
||||
const double &newJ)>
|
||||
inline std::function<void(const double &newJ,
|
||||
std::shared_ptr<SimulationMesh> &pReducedPatternSimulationMesh)>
|
||||
ReducedModelOptimizer::function_updateReducedPattern_material_J;
|
||||
inline std::function<void(const dlib::matrix<double, 0, 1> &x, std::shared_ptr<SimulationMesh> &m)>
|
||||
ReducedModelOptimizer::function_updateReducedPattern_geometry;
|
||||
inline std::function<void(const dlib::matrix<double, 0, 1> &x,
|
||||
std::shared_ptr<SimulationMesh> &m)>
|
||||
ReducedModelOptimizer::function_updateReducedPattern;
|
||||
|
||||
#endif // REDUCEDMODELOPTIMIZER_HPP
|
||||
|
|
Loading…
Reference in New Issue