Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Variable indices are compared in the Solver, which results in TypeError for indices of incomparable types. #96

Closed
@kral-alex

Description

@kral-alex

Description

In getSolutionIter, a list of 3-tuples is sorted, where the 3rd tuple item is a problem variable index. This throws a TypeError when the type(s) of variable indices are incomparable. There is no reason to assume a variable ID to be comparable, only identity (hashability) should be assumed.

Proposed solution

Only sort by the first two tuple items (which seems to be the intended logic).
In getSolutionIter change:
lst.sort() ----> lst.sort(key=lambda x: (x[0], x[1]))

Alternatively, if comparability is required by the programme logic, specify it in documentation and ideally via typing.

Library version: 2.2.1
Python: 3.12.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp