-
Notifications
You must be signed in to change notification settings - Fork 8
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
Mandd/cpm red #52
Mandd/cpm red #52
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have some minor comments for you to consider. @mandd
|
||
class Activity: | ||
""" | ||
This is the base class for a single activity | ||
Extended from the original development of Nofar Alfasi | ||
Source https://github.com/nofaralfasi/PERT-CPM-graph | ||
""" | ||
def __init__(self, name, duration): | ||
def __init__(self, name, duration, res=None, childs=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add docstrings for all arguments in __init__
method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
src/CPM/PertMain2.py
Outdated
self.name = str(name) | ||
self.duration = duration | ||
self.subActivities = [] | ||
self.belongsToCP = False | ||
self.resources = res | ||
|
||
self.startTime = None | ||
self.endTime = None | ||
|
||
if childs is None: | ||
self.childs = [] | ||
else: | ||
self.childs = childs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please document all self.variable
in this method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
src/CPM/PertMain2.py
Outdated
else: | ||
self.childs = childs | ||
|
||
def printToJsn(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function name is ok, but I think printToJson
is better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
src/CPM/PertMain2.py
Outdated
def updateChilds(self, childs): | ||
""" | ||
Method designed to assign the childs of an activity | ||
@ In, None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add docstring for childs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
src/CPM/PertMain2.py
Outdated
""" | ||
Method designed to assign the childs of an activity | ||
@ In, None | ||
@ Out, file in jason format |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no return for this function. Please update the docstring here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
src/CPM/PertMain2.py
Outdated
"""Partition a directed graph into a list of subgraphs that contain | ||
only entirely supported or entirely unsupported nodes. | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please update the docstring.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
src/CPM/PertMain2.py
Outdated
supported_nodes = {n for n, d in G.nodes(data="node_type") if d == "supported"} | ||
unsupported_nodes = {n for n, d in G.nodes(data="node_type") if d == "unsupported"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
camelBack here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
src/CPM/PertMain2.py
Outdated
|
||
if plotting: | ||
# Plot the stripped graph with the edges removed. | ||
_node_colors = [c for _, c in H.nodes(data="node_color")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
camelBack?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
src/CPM/PertMain2.py
Outdated
) | ||
|
||
# Collect all removed edges for reconstruction. | ||
G_minus_H = nx.DiGraph() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
camelBack here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
tests/unit_tests/CPM/CPM.py
Outdated
""" | ||
|
||
#For future compatibility with Python 3 | ||
from __future__ import division, print_function, unicode_literals, absolute_import |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this can be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wangcj05: I think all comments have been addressed
src/CPM/PertMain2.py
Outdated
""" | ||
for act in self.forwardDict: | ||
if act.returnResources() not in self.resources.columns: | ||
print("Activity " + str(act.returnName()) + " requires a resource that is not allowed: " + str(act.returnResources())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added but needs to be discussed
src/CPM/PertMain2.py
Outdated
""" | ||
Method designed to return the immediate successors of a node | ||
@ In, node, activity, activity being queried | ||
@ Out, list, list of activities that are immediate successors of "node" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
src/CPM/PertMain2.py
Outdated
""" | ||
Method designed to return the immediate predecessors of a node | ||
@ In, node, activity, activity being queried | ||
@ Out, list, list of activities that are immediate predecessors of "node" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
src/CPM/PertMain2.py
Outdated
""" | ||
Method designed to return the number of immediate predecessors of a node | ||
@ In, node, activity, activity being queried | ||
@ Out, int, number activities that are immediate predecessors of "node" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
src/CPM/PertMain2.py
Outdated
@ In, node, activity, activity to be queried | ||
@ Out, list, list of activities |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
def deleteActivity(self,node): | ||
""" | ||
Method designed to remove an activity from a schedule | ||
@ In, node, activity, activity to be removed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
src/CPM/PertMain2.py
Outdated
@ In, path, list, list of activities | ||
@ In, CP, list, list of activities |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
edited
src/CPM/PertMain2.py
Outdated
@ In, result, list, lis of subpath | ||
@ In, temp_list, list, temporary list of | ||
@ In, particular_list, list, list of element that mark a separation between sub-lists | ||
@ Out, result, list, list of subpaths that are part "path" parallel to "CP" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
src/CPM/PertMain2.py
Outdated
"""Partition a directed graph into a list of subgraphs that contain | ||
only entirely supported or entirely unsupported nodes. | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changes are good.
changes are good, checklist is good. |
Pull Request Description
What issue does this change request address? (Use "#" before the issue to link it, i.e., #42.)
What are the significant changes in functionality due to this change request?
For Change Control Board: Change Request Review
The following review must be completed by an authorized member of the Change Control Board.