diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 00000000..05fe37dc --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,44 @@ +# CMakeLists.txt +# +# Created on: 30.01.2019 +# Author: Franziska Wegner +# +# Install binaries into the bin folder. The project can be build with any of +# the available cmake generators. +# + +include_directories(Boost_INCLUDE_DIRS) + +# Define the main binary egoa with the linked source file main.cpp +add_executable(egoa Runnables/main.cpp) +# Link libraries to the binary +target_link_libraries(egoa EGOA) +add_ogdf_coin_if_available(egoa) +add_gurobi_if_available(egoa) + +# Other executables +# add_executable(testTemplate Runnables/testTemplate.cpp) +# target_link_libraries(testTemplate EGOA) + +# Other executables +if(CPLEX_FOUND) + add_executable(testCplex Runnables/cplexExample.cpp) + target_link_libraries(testCplex EGOA ${CPLEX_LIBRARIES}) +endif(CPLEX_FOUND) + +if(IPOPT_FOUND) + add_executable(testIpopt1 Runnables/cpp_example.cpp) + target_link_libraries(testIpopt1 EGOA ${IPOPT_LIBRARIES}) +endif(IPOPT_FOUND) + +# Install binary into the bin directory of the installation directory +# install(TARGETS egoa testTemplate DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) +install(TARGETS egoa DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) + +# Other executables +# add_executable(convertFiles Runnables/convertFiles.cpp) +# target_link_libraries(convertFiles EGOA) + +# add_executable(phase_oscillator_ensemble Runnables/phase_oscillator_ensemble.cpp) +# add_dependencies(phase_oscillator_ensemble Boost) +# target_link_libraries(phase_oscillator_ensemble ${Boost_LIBRARY_DIRS}) diff --git a/src/Runnables/main.cpp b/src/Runnables/main.cpp new file mode 100644 index 00000000..1531c442 --- /dev/null +++ b/src/Runnables/main.cpp @@ -0,0 +1,376 @@ +/* + * main.cpp + * + * Created on: Sep 13, 2018 + * Author: Franziska Wegner + */ + +#ifdef OPENMP_AVAILABLE + #include +#endif // OPENMP_AVAILABLE + +#include +#include +#include +#include +#include + +#include +#include + +#include "DataStructures/Labels/Label.hpp" +#include "DataStructures/Labels/SusceptanceNormLabel.hpp" +#include "DataStructures/Labels/VoltageAngleDifferenceLabel.hpp" + +#include "Algorithms/SpanningTree/MST.hpp" +#include "Algorithms/SpanningTree/Prim.hpp" +#include "Algorithms/SpanningTree/Kruskal.hpp" + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "DataStructures/Networks/PowerGrid.hpp" + +#include "DataStructures/Graphs/StaticGraph.hpp" +#include "DataStructures/Graphs/DynamicGraph.hpp" +#include "DataStructures/Graphs/Vertices/Vertex.hpp" +#include "DataStructures/Graphs/Vertices/ElectricalProperties.hpp" +#include "DataStructures/Graphs/Edges/Edge.hpp" +#include "DataStructures/Graphs/Edges/ElectricalProperties.hpp" + +#include "MathematicalModel/DirectCurrent/DCPF.hpp" +#include "MathematicalModel/DirectCurrent/DCMPF.hpp" +#include "MathematicalModel/DirectCurrent/DCMTSF.hpp" + +#include "Auxiliary/Auxiliary.hpp" +#include "Auxiliary/Comparators.hpp" + +#include "IO/PowerGridIO.hpp" +#include "IO/Appearance/Color.hpp" + +QString inputFile(""), outputDir(""); +void addCommandLineOptions ( const QCoreApplication &application, + QCommandLineParser &parser ) +{ + parser.setApplicationDescription("Power Grid Tool"); + parser.addHelpOption(); + parser.addVersionOption(); + +#pragma mark COMMANDLINE_OPTIONS + QCommandLineOption algorithmOption( + "algo", + QCoreApplication::translate("main", "Algorithm for the problem (default: MILP)."), + QCoreApplication::translate("main", "algo"), "MILP" + ); + parser.addOption(algorithmOption); + + QCommandLineOption variantOption( + "variant", + QCoreApplication::translate("main", "Variant for the algorithm (default: ?."), + QCoreApplication::translate("main", "variant"), "?" + ); + parser.addOption(variantOption); + + QCommandLineOption networkSettingOption( + "networkSetting", + QCoreApplication::translate("main", "Network setting (default: exact for PF (not changeable), bounded for DCMPF and DCMTSF)."), + QCoreApplication::translate("main", "networkSetting"), "bounded" + ); + parser.addOption(networkSettingOption); + + QCommandLineOption solverOption( + "solver", + QCoreApplication::translate("main", "Solver if necessary (default: gurobi)."), + QCoreApplication::translate("main", "solver"), "gurobi" + ); + parser.addOption(solverOption); + + QCommandLineOption inputFileWarmStartOption( + QStringList() << "inputFileWarmStart", + QCoreApplication::translate("main", "Input file for the warm start (default: ../Data/windfarm-benchmarksets/testset-0-instance-1.gml)."), + QCoreApplication::translate("main", "inputFileWarmStart"), "WS-testset-0-instance-1.gml" + ); + parser.addOption(inputFileWarmStartOption); + + QCommandLineOption timeOption( + "time", + QCoreApplication::translate("main", "--time