Skip to content

LinearFunctionOrConstraint.__richcmp__ should replace before converting #24423

@jdemeyer

Description

@jdemeyer

The logic in the hack to allow linear functions like x_0 <= x_1 <= x_2 is wrong: currently, when doing x <= y, it first converts x and y to the correct parent and then it checks for a chained comparison. This is wrong: it should check for a chained comparison on the input of the __richcmp__ function before converting.

One consequence is that the following does not work as expected:

sage: p.<x> = MixedIntegerLinearProgram()
sage: from sage.numerical.linear_functions import LinearFunctionsParent
sage: LF = LinearFunctionsParent(QQ)
sage: 3 <= x[0] <= LF(4)
x_0 <= 4

CC: @vbraun

Component: linear programming

Author: Jeroen Demeyer

Branch/Commit: 4606309

Reviewer: Marc Mezzarobba

Issue created by migration from https://trac.sagemath.org/ticket/24423

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions