-
Notifications
You must be signed in to change notification settings - Fork 0
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
Adding adaptive mutation and crossover to Genetic Algorithms #11
base: JunyungKim-Junyung-Jimmy-NSGAII_RegressionTest_UnitTest_Fix
Are you sure you want to change the base?
Conversation
…unction method), and Adaptive crossover(ILM/DHC, DHM/ILC, Quadratic function, Step function method
….py to create adaptive quadratic methodology
a5bfe23
to
98160fe
Compare
for ind,parent in enumerate(parentsPairs): | ||
parent = np.array(parent).reshape(2,-1) # two parents at a time | ||
|
||
if randomUtils.random(dim=1,samples=1) <= crossoverProb: | ||
if randomUtils.random(dim=1,samples=1) <= kwargs['crossoverProb']: | ||
if (kwargs['points'] == None) or ('points' not in kwargs.keys()): |
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.
Why is this changed? Could you please remind me?
@@ -215,3 +212,49 @@ def uniformCrossoverMethod(parent1,parent2,crossoverProb): | |||
children2[pos] = parent2[pos] | |||
|
|||
return children1,children2 | |||
|
|||
def twoPointsCrossoverMethod2(parent1,parent2,locL,locU): | |||
""" |
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.
Is this a new function? Why is that? When will it be called?
In some cases, it was finding mamba, when the new environment was created mamba was not available in the environment, causing install failures.
This fixes install where only python3 is available.
@@ -91,7 +91,7 @@ | |||
<Samplers> | |||
<MonteCarlo name="MC_samp"> | |||
<samplerInit> | |||
<limit>10</limit> | |||
<limit>20</limit> | |||
<initialSeed>050877</initialSeed> | |||
</samplerInit> | |||
<variable name="x1"> |
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.
Is this the test? This doesn't test the adaptive crossover/mutation!!
Please modify this and compare the results, if this reaches convergence faster, please regold.
printPriority=108, | ||
descr=r""" The probability governing the crossover step, i.e., the probability that if exceeded crossover will occur.""") | ||
crossoverProbability.addParam("type", InputTypes.makeEnumType('crossoverProbability','crossoverProbabilityType',['static','adaptive']), True, | ||
descr="type of crossover operation to be used (e.g., static,adaptive)") |
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 description for more details. For instance, give more information about what static means and what adaptive means, and state that adaptive only accepts linear (explain and give the equation) and quadratic (explain and give the equation)
printPriority=108, | ||
descr=r""" The probability governing the mutation step, i.e., the probability that if exceeded mutation will occur.""") | ||
mutationProbability.addParam("type", InputTypes.makeEnumType('mutationProbability','mutationProbabilityType',['static','adaptive']), True, | ||
descr="type of mutation probability operation to be used (e.g., static, adaptive)") | ||
mutation.addSub(mutationProbability) |
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 as above.
if(self._crossoverProbType == "static"): | ||
crossOverProb = self._crossoverProb | ||
if(self._crossoverProb == "linear"): | ||
crossOverProb = getLinearCrossoverProbability(self.getIteration(traj),self.limit) |
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.
What happens if the user enter's Linear
instead of linear
. when we spoke before I showed you that in the if statement you can add .lower()
to convert the whole word to lower case. (e.g., if(self._crossoverProb.lower() == "linear"):
).
In addition, what if the user entered something else other than linear or quadratic, their should be a final else
that raises an error. self.raiseAnError(IOError, "{} is not implemeted!. Currently only 'linear' and 'quadratic' are implemented".format(self._crossoverProb))
…obablity defaults to static the hard way
…hinks it converged after 1 iteration
7bb293f
to
65ca176
Compare
ceb167b
to
9bb29bc
Compare
This is a new methodology about adaptive mutation and crossover.
Adaptive mutation : DHM/ILC, ILM/DHC(Linearly increasing or decreasing) , quadratic function method, step function method.
Adaptive crossover : DHM/ILC, ILM/DHC(Linearly increasing or decreasing) , quadratic function method
Pull Request Description
What issue does this change request address? (Use "#" before the issue to link it, i.e., idaholab#42.
Closes idaholab#2286
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.
<internalParallel>
to True.raven/tests/framework/user_guide
andraven/docs/workshop
) have been changed, the associated documentation must be reviewed and assured the text matches the example.