Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: For comments only #3

Open
wants to merge 28 commits into
base: review_base
Choose a base branch
from
Open

Draft: For comments only #3

wants to merge 28 commits into from

Conversation

takeo300
Copy link
Collaborator

@takeo300 takeo300 commented Jul 8, 2022

Dieser pull-request ist nur da, damit ich ein review starten kann.

@takeo300 takeo300 changed the title For comments only Draft: For comments only Jul 8, 2022
[[nodiscard]] bool operator<(Edge const &other) const;
};

void add_terminal(GridUnit x_coord, GridUnit y_coord, NodeId terminal_id = -1);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bei sowas wie NodeId terminal_id, sind Werte mit namen immer besser als einfach Zahlen.
Hier z.B. in der typedefs.h
NodeId constexpr invalid_node = -1


void add_edge(Terminal terminal_a, Terminal terminal_b);

void calculate();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hier gibt es calculate und die translate funktionen.
Insbesondere ist ein DelaunayGraph nicht notwendigerweise eine delaunay-triangulierung.

Man sollte immer versuchen Algorithmus und Datenstruktur zu trennen.
Dh. hier sollten Graph und delaunay-triangulierungs-algo getrennt werden.
Stattdessen eine Klasse Graph
und eine funktion Graph compute_delaunay_triangulation(std::vector<Terminal> const& terminals),
die nicht member einer Klasse sind
Eine Datenstruktur Kapselt die beinhalteten Daten und exportiert ein Wohldefiniertes interface, das dafuer sorgt, dass die internen Daten immer in einem Konsistenten Zustand sind (das ist das Ziel, geht nciht immer 100%)
Ein algorithmus macht operationen auf diesen Daten mithilfe des gegebenen interface.

Auf diese Weise koennen die einzelnen teile einfacher wieder verwendet werden und sind einfacher wartbar.

}

void DelaunayGraph::calculate() {
DelaunayPriorityQueue X(_max_x, _max_y);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gib denen lieber hilfreiche namen. x_coordinate_queue oder so. Genauso unten mit Y.

int age_counter = 0;

while (not X.empty()) {
auto P = X.extract_min();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P

age_counter++;
if (P.status == ACTIVE) {
Y.insert(P.terminal);
auto successor = Y.successor(P.terminal);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const

#ifndef HAUPTAUFGABE_2_HEAP_H
#define HAUPTAUFGABE_2_HEAP_H


Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heap concept und dann template functions, wo es verwendet wird waere deutlich schneller.

bool operator<(Node const &other) const;
};

public:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So viele wechsel

@@ -0,0 +1,115 @@
#pragma once
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

disjoint_set_2?

#include <iostream>
#include <vector>

class Disjoint_Set {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benennungsschema unterscheidet sich vom rest.

return return_graph;
}

DelaunayGraph kruskal(DelaunayGraph const &delaunay_graph) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hier sieht man, was ich meinte mit einfacherer wiederverwendung.
2 mal die gleicht Funktion, nur einmal mit Graph und einmal mit DelaunayGraph.
Code duplication sollte immer vermieden werden. Angenommen man findet einen bug, oder muss etwas aendern, weil neue anforderungen da sind. Dann muesste man immer beide stellen aendern.
Das fuehrt sehr leicht zu fehlern

armytrong added 4 commits July 9, 2022 09:23
accidentally committed wrong changes in the commit before, removed asan and ubsan
…ination

Implement delaunay mehlhorn combination
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants