Skip to content

Using model.add_constraint_eq_zero(----, lam=xxxx) with multiple indexed variables and sums #51

@CPalas

Description

@CPalas

When developing a QUBO model for quantum optimisation, I am not able to create several constraints such as the one below:

\begin{equation}
\sum_k\sum_{\substack{j \in L \ j \ne i}}x_{i,j,k}+\sum_k\eta_{i,k}=1, \forall i \in L
\end{equation}

node j can be reached only by another node i, or it is the last location served by k.

I managed to create two and three-indexed variables ,such as x(i,j,k), by using for ... in loops, but I am not able to create the constraints.

I imagine I could go for one constraints for each i index, by using the function
model.add_constraint_eq_zero(----, lam=xxxx)

but I do not know how to nest the sums inside the function, to properly write the constraint.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions