Skip to content

Commit

Permalink
Let's check for a running workflow by force And Cleanup later
Browse files Browse the repository at this point in the history
Changes not staged for commit:
	modified:   egoa.sublime-project
  • Loading branch information
franziska-wegner committed Dec 5, 2023
1 parent e6ead76 commit d0359e9
Show file tree
Hide file tree
Showing 10 changed files with 59 additions and 220 deletions.
10 changes: 5 additions & 5 deletions include/Auxiliary/Types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ namespace egoa::Types {

// QString t_string(str.c_str());
bool ok; double number(0);
QLocale::setDefault(QLocale(QLocale::English, QLocale::UnitedStates));
// QLocale::setDefault(QLocale(QLocale::English, QLocale::UnitedStates));
number = QString(t_string).toDouble(&ok); // ok == true, d == 1234.56
if (!ok) {
QLocale locale(QLocale::German); //QLocale::Catalan
number = locale.toDouble(t_string);
}
// if (!ok) {
// QLocale locale(QLocale::German); //QLocale::Catalan
// number = locale.toDouble(t_string);
// }
return number;
}

Expand Down
168 changes: 0 additions & 168 deletions include/DataStructures/Graphs/Bound.hpp

This file was deleted.

4 changes: 2 additions & 2 deletions include/DataStructures/Graphs/DynamicGraph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "Auxiliary/Constants.hpp"
#include "Auxiliary/Types.hpp"

#include "DataStructures/Graphs/Iterators/DynamicGraphIterators.hpp"
#include "DataStructures/Iterators/DynamicGraphIterators.hpp"

#include "Exceptions/Assertions.hpp"

Expand Down Expand Up @@ -1827,4 +1827,4 @@ class DynamicGraph {
} // namespace egoa

#endif // EGOA__DATA_STRUCTURES__GRAPHS__DYNAMIC_GRAPH_HPP


4 changes: 2 additions & 2 deletions include/DataStructures/Graphs/StaticGraph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#include "Auxiliary/ExecutionPolicy.hpp"

#include "DataStructures/Graphs/Iterators/StaticGraphIterators.hpp"
#include "DataStructures/Iterators/StaticGraphIterators.hpp"
#include "DataStructures/Views/VectorView.hpp"

#include "Exceptions/Assertions.hpp"
Expand Down Expand Up @@ -1561,4 +1561,4 @@ class StaticGraph {
} // namespace egoa

#endif // EGOA__DATA_STRUCTURES__GRAPHS__STATIC_GRAPH_HPP


5 changes: 5 additions & 0 deletions include/DataStructures/Graphs/Vertices/Type.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ enum class GeneratorType {
unknown = 99 /**< unknown */
};

enum class GenerationStrategyDifferentiationType {
totalVertexPowerGenerationPerSnapshot = 0, /**< Sums up GeneratorRealPowerSnapshotAt for all generators at a vertex. */
unknown = 99 /**< Not defined. */
};

#pragma mark VERTEX_STATUS

/**
Expand Down
2 changes: 1 addition & 1 deletion include/DataStructures/Networks/GenerationStrategy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,4 @@ class GenerationStrategyDifferentiation<NetworkType, Vertices::GenerationStrateg

} // namespace egoa::internal

#endif // EGOA__DATASTRUCTURES__NETWORKS__GENERATION_STRATEGY_HPP
#endif // EGOA__DATASTRUCTURES__NETWORKS__GENERATION_STRATEGY_HPP
1 change: 1 addition & 0 deletions include/IO/Appearance/Color.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#ifndef EGOA__IO__COLOR_HPP
#define EGOA__IO__COLOR_HPP

#include <iostream>
#include "Auxiliary/Types.hpp"

namespace egoa {
Expand Down
4 changes: 2 additions & 2 deletions include/IO/Parser/PyPsaParser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "IO/Wrapper/Edge.hpp"
#include "IO/Helper/DataValidation.hpp"

#include "DataStructures/Graphs/PowerGrid.hpp"
#include "DataStructures/Networks/PowerGrid.hpp"
#include "DataStructures/Graphs/Edges/ElectricalProperties.hpp"
#include "DataStructures/Graphs/Vertices/ElectricalProperties.hpp"
#include "DataStructures/Graphs/Vertices/GeneratorProperties.hpp"
Expand Down Expand Up @@ -3574,4 +3574,4 @@ class NetworkDifferentiation< VertexTypeProperties
} // namespace egoa

#endif // EGOA__IO__PARSER___PY_PSA_PARSER_HPP


6 changes: 3 additions & 3 deletions include/IO/PowerGridIO.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
#endif // OGDF_AVAILABLE

#include "DataStructures/Networks/PowerGrid.hpp"
#include "Parser/IeeeCdfMatlabParser.hpp"
#include "Parser/PyPsaParser.hpp"
#include "Writer/GeojsonWriter.hpp"
#include "IO/Parser/IeeeCdfMatlabParser.hpp"
#include "IO/Parser/PyPsaParser.hpp"
#include "IO/Writer/GeojsonWriter.hpp"

namespace egoa {

Expand Down
75 changes: 38 additions & 37 deletions src/Runnables/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@
#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 "MathematicalModel/DirectCurrent/DCPF.hpp"
// #include "MathematicalModel/DirectCurrent/DCMPF.hpp"
// #include "MathematicalModel/DirectCurrent/DCMTSF.hpp"

#include "Auxiliary/Auxiliary.hpp"
#include "Auxiliary/Comparators.hpp"
Expand Down Expand Up @@ -275,24 +275,25 @@ int main(int argc, char *argv[]) {
using TNetwork = egoa::PowerGrid<TGraph>;
TNetwork resultGraph = network;
try {
std::unique_ptr<egoa::DCPF<TNetwork>> model;
if ( algorithm == "DCPF" ) {
model = std::make_unique<egoa::DCPF<TNetwork>>( network, filename, timeLimit, false, traceSolution );
model->Run();
} else if ( algorithm == "DCMPF" ) {
model = std::make_unique<egoa::DCMPF<TNetwork>>( network, filename, timeLimit, false, traceSolution );
setNetworkSetting(network, networkSetting);
model->Run();
} else if ( algorithm == "DCMTSF" ) {
model = std::make_unique<egoa::DCMTSF<TNetwork>>( network, filename, timeLimit, false, traceSolution );
setNetworkSetting(network, networkSetting);

if ( variant == "BIGM" ) { model->SetKVl2BigM(); }
else if ( variant == "INDICATOR" ) { model->SetKVl2Indicator(); }
else if ( variant == "QUADRATIC" ) { model->SetKVl2Quadratic(); }
// std::unique_ptr<egoa::DCPF<TNetwork>> model;
// if ( algorithm == "DCPF" ) {
// model = std::make_unique<egoa::DCPF<TNetwork>>( network, filename, timeLimit, false, traceSolution );
// model->Run();
// } else if ( algorithm == "DCMPF" ) {
// model = std::make_unique<egoa::DCMPF<TNetwork>>( network, filename, timeLimit, false, traceSolution );
// setNetworkSetting(network, networkSetting);
// model->Run();
// } else if ( algorithm == "DCMTSF" ) {
// model = std::make_unique<egoa::DCMTSF<TNetwork>>( network, filename, timeLimit, false, traceSolution );
// setNetworkSetting(network, networkSetting);

// if ( variant == "BIGM" ) { model->SetKVl2BigM(); }
// else if ( variant == "INDICATOR" ) { model->SetKVl2Indicator(); }
// else if ( variant == "QUADRATIC" ) { model->SetKVl2Quadratic(); }
// check variant here
model->Run();
} else if ( algorithm == "MAXST" || algorithm == "2APPROXIMATION" ) {
// model->Run();
// } else
if ( algorithm == "MAXST" || algorithm == "2APPROXIMATION" ) {
auto comparator = [&network](egoa::Types::edgeId lhs, egoa::Types::edgeId rhs) {
return network.Graph().EdgeAt(lhs).Properties().ThermalLimit()
> network.Graph().EdgeAt(rhs).Properties().ThermalLimit();
Expand Down Expand Up @@ -328,17 +329,17 @@ int main(int argc, char *argv[]) {
//code
}

if ( verbose && model != nullptr ) {
std::cout << "Finished "
<< algorithm.toStdString()
<< " with status "
<< model->Solver().Status()
<< std::endl;
std::cout << *model;
std::cout << std::endl << std::endl;
}
} catch (GRBException e) {
printGurobiException(e);
// if ( verbose && model != nullptr ) {
// std::cout << "Finished "
// << algorithm.toStdString()
// << " with status "
// << model->Solver().Status()
// << std::endl;
// std::cout << *model;
// std::cout << std::endl << std::endl;
// }
// } catch (GRBException e) {
// printGurobiException(e);
} catch(...) {
std::cerr << "Unexpected exception during optimization" << std::endl;
}
Expand All @@ -347,30 +348,30 @@ int main(int argc, char *argv[]) {
std::string algoFile = filename + "-" + variant.toLower().toStdString() + "-" + algorithm.toLower().toStdString();
std::string file = filename;
if ( outputType == "GML" ) {
qDebug() << "Output: " << outputType << "\n" << flush;
// qDebug() << "Output: " << outputType << "\n" << flush;
egoa::PowerGridIO<TGraph>::write( network , outputDir.toStdString() + file + ".gml", egoa::PowerGridIO<TGraph>::WriteGraphGml );
egoa::PowerGridIO<TGraph>::write( resultGraph, outputDir.toStdString() + algoFile + ".gml", egoa::PowerGridIO<TGraph>::WriteGraphGml );
} else if ( outputType == "PDF" ) {
qDebug() << "Output: " << outputType << "\n" << flush;
// qDebug() << "Output: " << outputType << "\n" << flush;
egoa::PowerGridIO<TGraph>::write( network, outputDir.toStdString() + file + ".dot", egoa::PowerGridIO<TGraph>::WriteGraphDot );
egoa::PowerGridIO<TGraph>::write( resultGraph, outputDir.toStdString() + algoFile + ".dot", egoa::PowerGridIO<TGraph>::WriteGraphDot );
system( ("dot -Tps " + outputDir.toStdString() + file + ".dot -o " + outputDir.toStdString() + file + ".pdf").c_str() );
system( ("dot -Tps " + outputDir.toStdString() + algoFile + ".dot -o " + outputDir.toStdString() + algoFile + ".pdf").c_str() );
} else if ( outputType == "SVG" ) {
qDebug() << "Output: " << outputType << "\n" << flush;
// qDebug() << "Output: " << outputType << "\n" << flush;
egoa::PowerGridIO<TGraph>::write( network, outputDir.toStdString() + file + ".dot", egoa::PowerGridIO<TGraph>::WriteGraphDot );
egoa::PowerGridIO<TGraph>::write( resultGraph, outputDir.toStdString() + algoFile + ".dot", egoa::PowerGridIO<TGraph>::WriteGraphDot );
system( ("dot -Tps " + outputDir.toStdString() + file + ".dot -o " + outputDir.toStdString() + file + ".svg").c_str() );
system( ("dot -Tps " + outputDir.toStdString() + algoFile + ".dot -o " + outputDir.toStdString() + algoFile + ".svg").c_str() );
} else if ( outputType == "NONE" ) {
qDebug() << "Output: " << outputType << "\n" << flush;
// qDebug() << "Output: " << outputType << "\n" << flush;
} else {
qDebug() << "Output: " << outputType << "\n" << flush;
// qDebug() << "Output: " << outputType << "\n" << flush;
egoa::PowerGridIO<TGraph>::write( network, outputDir.toStdString() + file + ".dot", egoa::PowerGridIO<TGraph>::WriteGraphDot );
egoa::PowerGridIO<TGraph>::write( resultGraph, outputDir.toStdString() + algoFile + ".dot", egoa::PowerGridIO<TGraph>::WriteGraphDot );
system( ("dot -Tps " + outputDir.toStdString() + file + ".dot -o " + outputDir.toStdString() + file + ".ps").c_str() );
system( ("dot -Tps " + outputDir.toStdString() + algoFile + ".dot -o " + outputDir.toStdString() + algoFile + ".ps").c_str() );
}

return EXIT_SUCCESS;
}
}

0 comments on commit d0359e9

Please sign in to comment.