-
Notifications
You must be signed in to change notification settings - Fork 137
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/pareto front PP prestruct #1479
Changes from all commits
90d8f67
5c064ea
c434f2b
e5f090f
7037d51
40d5279
b0cffc5
12d0878
5245d57
1cedcba
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ | |
|
||
|
||
|
||
def nonDominatedFrontier(data, returnMask): | ||
def nonDominatedFrontier(data, returnMask, minMask=None): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @wangcj05 I honestly feel like the required structure of returnMask and minMask might not be optimal, if you have comments/suggestions let me know There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I did not get your point here. Could you clarify it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was not sure if passing the data as numpy array and min mask as a separate numpy array was the best way to pass this info to this method |
||
""" | ||
This method is designed to identify the set of non-dominated points (nEfficientPoints) | ||
|
||
|
@@ -38,11 +38,21 @@ def nonDominatedFrontier(data, returnMask): | |
|
||
@ In, data, np.array, data matrix (nPoints, nCosts) containing the data points | ||
@ In, returnMask, bool, type of data to be returned: indices (False) or True/False mask (True) | ||
@ Out, minMask, np.array, array (nCosts,1) of boolean values: True (dimension need to be minimized), False (dimension need to be maximized) | ||
@ Out, isEfficientMask , np.array, data matrix (nPoints,1), array of boolean values if returnMask=True | ||
@ Out, isEfficient, np.array, data matrix (nEfficientPoints,1), integer array of indexes if returnMask=False | ||
|
||
Reference: the following code has been adapted from https://stackoverflow.com/questions/32791911/fast-calculation-of-pareto-front-in-python | ||
""" | ||
if minMask is None: | ||
pass | ||
elif minMask is not None and minMask.shape[0] != data.shape[1]: | ||
raise IOError("nonDominatedFrontier method: Data features do not match minMask dimensions: data has shape " + str(data.shape) + " while minMask has shape " + str(minMask.shape)) | ||
else: | ||
for index,elem in np.ndenumerate(minMask): | ||
if not elem: | ||
data[:,index] = -1. * data[:,index] | ||
|
||
isEfficient = np.arange(data.shape[0]) | ||
nPoints = data.shape[0] | ||
nextPointIndex = 0 | ||
|
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.
same 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.
edited as well