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

GA features update - Having multi-objective optimization (NSGA-II ) #2326

Open
wants to merge 128 commits into
base: devel
Choose a base branch
from

Conversation

JunyungKim
Copy link
Collaborator


Pull Request Description

What issue does this change request address? (Use "#" before the issue to link it, i.e., #42.)

#2069

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.

  • 1. Review all computer code.
  • 2. If any changes occur to the input syntax, there must be an accompanying change to the user manual and xsd schema. If the input syntax change deprecates existing input files, a conversion script needs to be added (see Conversion Scripts).
  • 3. Make sure the Python code and commenting standards are respected (camelBack, etc.) - See on the wiki for details.
  • 4. Automated Tests should pass, including run_tests, pylint, manual building and xsd tests. If there are changes to Simulation.py or JobHandler.py the qsub tests must pass.
  • 5. If significant functionality is added, there must be tests added to check this. Tests should cover all possible options. Multiple short tests are preferred over one large test. If new development on the internal JobHandler parallel system is performed, a cluster test must be added setting, in XML block, the node <internalParallel> to True.
  • 6. If the change modifies or adds a requirement or a requirement based test case, the Change Control Board's Chair or designee also needs to approve the change. The requirements and the requirements test shall be in sync.
  • 7. The merge request must reference an issue. If the issue is closed, the issue close checklist shall be done.
  • 8. If an analytic test is changed/added is the the analytic documentation updated/added?
  • 9. If any test used as a basis for documentation examples (currently found in raven/tests/framework/user_guide and raven/docs/workshop) have been changed, the associated documentation must be reviewed and assured the text matches the example.

JunyungKim and others added 30 commits February 19, 2023 12:48
@moosebuild
Copy link

Job Precheck on 014dae4 : invalidated by @joshua-cogliati-inl

failed in fetch and branch

@moosebuild
Copy link

Job Precheck on 014dae4 : invalidated by @joshua-cogliati-inl

civet problems

Copy link
Collaborator

@wangcj05 wangcj05 left a comment

Choose a reason for hiding this comment

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

These are my second part comments. Please let me know if you have any issues. In addition, Please try to make sure you can generate the manual for multi-objective optimization, and check the manual is complete. @Jimmy-INL @JunyungKim

# Fitness
if self._survivorSelectionType not in ['ageBased','fitnessBased','rankNcrowdingBased']:
self.raiseAnError(IOError, f'Currently constrained Genetic Algorithms only support ageBased, fitnessBased, and rankNcrowdingBased as a survivorSelector, whereas provided survivorSelector is {self._survivorSelectionType}')
if len(self._objectiveVar) == 1 and self._survivorSelectionType == 'rankNcrowdingBased':
Copy link
Collaborator

Choose a reason for hiding this comment

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

Based on the error message, should you use if len(self._objectiveVar) <= 2 instead

Copy link
Collaborator

@Jimmy-INL Jimmy-INL Oct 2, 2024

Choose a reason for hiding this comment

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

I do not understand, I thought it works with multiobjective cases, even with two objrctives. At least that's what it should do. I will test it further.

ravenframework/Optimizers/GeneticAlgorithm.py Show resolved Hide resolved
# TODO: @mandd, please explore the possibility to convert the logistic fitness into a constrained optimization fitness.
if 'Constraint' in self.assemblerObjects and self._fitnessType not in ['invLinear','feasibleFirst']:
self.raiseAnError(IOError, f'Currently constrained Genetic Algorithms only support invLinear and feasibleFirst fitnesses, whereas provided fitness is {self._fitnessType}')
if 'Constraint' in self.assemblerObjects and self._fitnessType not in ['invLinear','logistic', 'feasibleFirst']:
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would suggest to use inputSpecs to check the fitnessType instead.

ravenframework/Optimizers/GeneticAlgorithm.py Outdated Show resolved Hide resolved
Comment on lines +1246 to +1265
if len(self._objectiveVar) == 1:
convs = {}
for conv in self._convergenceCriteria:
fName = conv[:1].upper() + conv[1:]
# get function from lookup
f = getattr(self, f'_checkConv{fName}')
# check convergence function
okay = f(traj, new=new, old=old)
# store and update
convs[conv] = okay
else:
convs = {}
for conv in self._convergenceCriteria:
fName = conv[:1].upper() + conv[1:]
# get function from lookup
f = getattr(self, f'_checkConv{fName}')
# check convergence function
okay = f(traj, new=new, old=old)
# store and update
convs[conv] = okay
Copy link
Collaborator

Choose a reason for hiding this comment

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

I do not see the different between if and else statements here. If so, I think you need to revert the changes.

Comment on lines +1286 to +1287
if len(self._optPointHistory[traj]) < 2:
return False
Copy link
Collaborator

Choose a reason for hiding this comment

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

Combine these lines within the if statement and move them outside.

Comment on lines +1289 to +1291
obj1 = o1[self._objectiveVar[0]]
obj2 = o1[self._objectiveVar[1]]
converged = (obj1 == self._convergenceCriteria['objective'] and obj2 == self._convergenceCriteria['objective'])
Copy link
Collaborator

Choose a reason for hiding this comment

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

These lines indicate the convergence only work for 2 objectives, I think you need to extend this part to handle multi-objectives optimizations with more than 2 objectives.

ravenframework/Optimizers/GeneticAlgorithm.py Show resolved Hide resolved
Comment on lines +1597 to +1598
'rank': 0 if ((type(self._objectiveVar) == list and len(self._objectiveVar) == 1) or type(self._objectiveVar) == str) else rlz['rank'],
'CD': 0 if ((type(self._objectiveVar) == list and len(self._objectiveVar) == 1) or type(self._objectiveVar) == str) else rlz['CD'],
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please try to simply these two lines, since the self._objectiveVar is a list.

@moosebuild
Copy link

Job Test Ubuntu 18 PIP on 730d7a4 : invalidated by @joshua-cogliati-inl

cleared cache

1 similar comment
@moosebuild
Copy link

Job Test Ubuntu 18 PIP on 730d7a4 : invalidated by @joshua-cogliati-inl

cleared cache

@moosebuild
Copy link

Job Test Ubuntu 18 PIP on 730d7a4 : invalidated by @joshua-cogliati-inl

monitoring disk usage

@moosebuild
Copy link

Job Mingw Test on 9154004 : invalidated by @Jimmy-INL

@moosebuild
Copy link

Job Test qsubs sawtooth on 9154004 : invalidated by @Jimmy-INL

@moosebuild
Copy link

Job Test Fedora 32 on 9154004 : invalidated by @Jimmy-INL

@moosebuild
Copy link

Job Test qsubs sawtooth on 9154004 : invalidated by @Jimmy-INL

1 similar comment
@moosebuild
Copy link

Job Test qsubs sawtooth on 9154004 : invalidated by @Jimmy-INL

evolution of individuals that satisfy the problem's constraints. It suppoort single-and
multi-objective optimization problem.\\\\ $fitness =
\left\{\begin{matrix} -obj & g_{j}(x)\geq 0 \; \forall j \\ -obj_{worst}-
\Sigma_{j=1}^{J}<g\_j(x)> & otherwise \\ \end{matrix}\right$\\
Copy link
Contributor

Choose a reason for hiding this comment

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

The \right probably should be \right\} (As in the delimiter needs to be added)

Copy link
Contributor

Choose a reason for hiding this comment

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

(Since this is a generated file, this should probably be fixed in the python code.)

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.

7 participants