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

Add method to check component name duplication #76

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mmurooka
Copy link

@mmurooka mmurooka commented Dec 10, 2021

If composite (e.g., variables, constraints, costs) contain components with the same name, it seems that an unexpected problem will arise (is this understanding correct?)
This Pull Request adds a method to check the name duplication to the Problem class. Doing the same thing in user code is difficult because variables_ is private and there is no access method.

(This is a utility that I use locally. It may be worth sharing in the origin repository, so I'll make a pull request.)

@Levi-Armstrong
Copy link
Collaborator

@awinkler What do you think about updating the Composite to store a std::set<std::string> of the names and when adding a component it inserts the name into the set and check the results to see if it was successfully inserted and if not throw an exception?

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.

None yet

2 participants