Skip to content

Consider adding the ability to specify one axis bound to BinaryVariable #216

@arcondello

Description

@arcondello

Very often we need constraints such as

model = Model()

x = model.binary((5, 5))

model.add_constraint((x.sum(axis=0) == 1).all())

which specifies that each column can have exactly one 1 in it.

It would be nice to be able to make such constraints implicit. Maybe an API like

x = model.binary((5, 5), subject_to=(axis, operator, rhs))

so the above example would be

x = model.binary((5, 5), subject_to=(0, '==', 1))

This would also allow us to deprecate the DisjointBitSets and DisjointBitSet symbols.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions