Skip to content

Add method to check component name duplication#76

Open
mmurooka wants to merge 2 commits intoethz-adrl:masterfrom
mmurooka:check-component-names
Open

Add method to check component name duplication#76
mmurooka wants to merge 2 commits intoethz-adrl:masterfrom
mmurooka:check-component-names

Conversation

@mmurooka
Copy link
Copy Markdown

@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
Copy Markdown
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.

2 participants