Skip to content

Sourcery refactored master branch#1

Open
sourcery-ai[bot] wants to merge 1 commit into
masterfrom
sourcery/master
Open

Sourcery refactored master branch#1
sourcery-ai[bot] wants to merge 1 commit into
masterfrom
sourcery/master

Conversation

@sourcery-ai

@sourcery-ai sourcery-ai Bot commented Jun 6, 2023

Copy link
Copy Markdown

Branch master refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

To manually merge these changes, make sure you're on the master branch, then run:

git fetch origin sourcery/master
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

@sourcery-ai sourcery-ai Bot requested a review from theAfricanQuant June 6, 2023 10:26
Comment thread Final Plots
@@ -6,6 +6,7 @@ Created on Sun Jul 16 22:40:21 2017
@author: shashank
"""

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Lines 17-39 refactored with the following changes:

Comment thread Final Plots.py
@@ -6,6 +6,7 @@
@author: shashank
"""

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Lines 17-39 refactored with the following changes:

Comment thread GA.py
Comment on lines -396 to +407
no=no+1
no += 1

rand=random.sample(range(len(self.population)),no)

for i in range(no/2):
index_first_chromosome=rand[2*i]
index_second_chromosome=rand[2*i+1]

position=random.randint(0,len(self.new_population[0])-1)
x=self.new_population[index_first_chromosome][position]
y=self.new_population[index_second_chromosome][position]

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function genetic_algo.crossover refactored with the following changes:

  • Replace assignment with augmented assignment (aug-assign)

Comment thread GA.py
Comment on lines -417 to +420
assert self.new_population[index][position]==True or self.new_population[index][position]==False
if self.new_population[index][position]==True:
self.new_population[index][position]=False
else:
self.new_population[index][position]=True
assert self.new_population[index][position] in [True, False]
self.new_population[index][position] = (
self.new_population[index][position] != True
)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function genetic_algo.mutation refactored with the following changes:

Comment thread plots.py
accuracies=[]
for i in range(len(sol)):
accuracies.append(sol[i][3])
accuracies = [sol[i][3] for i in range(len(sol))]

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function plot_graph refactored with the following changes:

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.

0 participants