Issue
I have a list that looks like:
[[8.91636727 0.50420552]
[1.50918535 8.43128826]
[4.18447757 0.21850886]
[8.82701669 8.39773898]]
Essentially they are x,y coordinates and I wanted to know how to get the highest x with the lowest y. (i.e. 8.91.. and 0.50..). I started with the X's and thought of doing:
for x,y in means:
if x >= start:
start = x; h = x; l = y
else:
start = start
But was wondering how to implement this for the min of y's. Also my other issue is that there may be a case such as:
[[8.91636727 0.50420552]
[1.50918535 8.43128826]
[4.18447757 0.21850886]
[**8.92701669** 8.39773898]]
Where the I dont neccessarily always want the highest x by itself, I want the highest x coupled with the lowest y.
Solution
You could calculate the difference between x
and y
vectors. Then choose the one with with highest difference. If this isn't what you're looking for, I must worry you. What you're talking about is multi-objective optimization. You must clearly define, what you mean by an element with highest x
and lowest y
. If you cannot put it into single function, it's fundamentally impossible to take that one element. You'd have to calculate your pareto front and take one element by hand from there.
Answered By - Piotr Rarus
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.