Skip to main content does not work as expected



1 comment

  • Eli Towle
    Gurobi Staff Gurobi Staff

    The keys of a tupledict should be a tuple of scalar values, not tuple values. From the tupledict documentation:

    Note that a \( \texttt{tupledict} \) key must be a tuple of scalar values (\(\texttt{int}\), \(\texttt{float}\), \(\texttt{string}\), ...). Thus, you can use \( \texttt{(1, 2.0, 'abc')}\) as a key, but you can't use \(\texttt{((1, 2.0), 'abc')}\).

    You get the desired result if you use four strings as the tupledict keys instead of two tuples:

    d = gp.tupledict([
        (('AT', 'CH', 'BE', 'AT'), 1),
        (('AT', 'CH', 'BE', 'DE'), 2),
        (('AT', 'DE', 'BE', 'DE'), 3),

    print('AT','CH', '*', '*'))

Please sign in to leave a comment.