Skip to content

Duplicate forbiddens in ConfigurationSpace #354

Open
@aron-bram

Description

@aron-bram

I noticed it was possible to add the same forbidden clause multiple times to the same space. Not sure if this is intended or not, so I thought I would raise a quick issue for it.

Here is how to replicate it:

import ConfigSpace as CS
import ConfigSpace.hyperparameters as CSH

cs = CS.ConfigurationSpace()

lower_bound = CSH.UniformIntegerHyperparameter('lower_bound', lower=0, upper=10)
upper_bound = CSH.UniformIntegerHyperparameter('upper_bound', lower=0, upper=10)

cs.add_hyperparameter(lower_bound)
cs.add_hyperparameter(upper_bound)

# add duplicate forbiddens to the same space
fgt1 = CS.ForbiddenGreaterThanRelation(lower_bound, upper_bound)
fgt2 = CS.ForbiddenGreaterThanRelation(lower_bound, upper_bound)
fgt3 = CS.ForbiddenGreaterThanRelation(lower_bound, upper_bound)

cs.add_forbidden_clause(fgt1)
cs.add_forbidden_clause(fgt2)
cs.add_forbidden_clause(fgt2)

print(cs)

What it outputs:

Configuration space object:
  Hyperparameters:
    lower_bound, Type: UniformInteger, Range: [0, 10], Default: 5
    upper_bound, Type: UniformInteger, Range: [0, 10], Default: 5
  Forbidden Clauses:
    Forbidden: lower_bound > upper_bound
    Forbidden: lower_bound > upper_bound
    Forbidden: lower_bound > upper_bound

Notice how the same forbidden appears 3 times.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions