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

'FloatSolution' object has no attribute 'number_of_objectives' #181

Open
fiksdano opened this issue Dec 29, 2024 · 3 comments
Open

'FloatSolution' object has no attribute 'number_of_objectives' #181

fiksdano opened this issue Dec 29, 2024 · 3 comments

Comments

@fiksdano
Copy link

There was an error when I tried to visualize the sample code:line 68, in plot
dimension = front[0][0].number_of_objectives
AttributeError: 'FloatSolution' object has no attribute 'number_of_objectives'

@ajnebro
Copy link
Contributor

ajnebro commented Dec 30, 2024

Please, could you indicate the file containing the error?

@mrisong
Copy link

mrisong commented Jan 9, 2025

Hi,
Facing the same issue.

Please, could you indicate the file containing the error?


AttributeError Traceback (most recent call last)
Cell In[3], line 4
1 from jmetal.lab.visualization import Plot
3 plot_front = Plot(title='Pareto front approximation', axis_labels=['x', 'y'])
----> 4 plot_front.plot(front, label='NSGAII-ZDT1', filename='NSGAII-ZDT1', format='png')

File ~/Documents/venve/lib/python3.12/site-packages/jmetal/lab/visualization/plotting.py:68, in Plot.plot(self, front, label, normalize, filename, format)
65 if len(front) != len(label):
66 raise Exception("Number of fronts and labels must be the same")
---> 68 dimension = front[0][0].number_of_objectives
70 if dimension == 2:
71 self.two_dim(front, label, filename, format)

AttributeError: 'FloatSolution' object has no attribute 'number_of_objectives'

@ajnebro
Copy link
Contributor

ajnebro commented Jan 21, 2025

The number_of_objectives of class FloatSolution was refactored as a method called number_of_objectives(). Any reference to the former should be replaced by the latter in the current version of the project in GitHub.

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

No branches or pull requests

3 participants