Skip to content

BUG: MatrixVariable.sum(axis=...) return type is MatrixVariable not MatrixExpr #1117

@Zeroto521

Description

@Zeroto521

Describe the bug
A clear and concise description of what the bug is.

MatrixVariable.sum(axis=...) should return MatrixExpr, but return MatrixVariable

To Reproduce
Steps to reproduce the behavior

from pyscipopt import Model

model = Model()
x = model.addMatrixVar((3, 2))
# MatrixVariable([Expr({Term(x1): 1.0, Term(x2): 1.0}),
#                 Expr({Term(x3): 1.0, Term(x4): 1.0}),
#                 Expr({Term(x5): 1.0, Term(x6): 1.0})], dtype=object)

type(x.sum(axis=1))
# pyscipopt.scip.MatrixVariable

x.sum(axis=1).vtype()  # MatrixVariable has vtype method
# File src/pyscipopt/scip.pxi:1887, in pyscipopt.scip.MatrixVariable.vtype()
# AttributeError: 'pyscipopt.scip.Expr' object has no attribute 'vtype'

Expected behavior
A clear and concise description of what you expected to happen.

MatrixVariable.sum(axis=...) should return MatrixExpr

Screenshots
If applicable, add screenshots to help explain your problem.

System

  • OS: Windows 11
  • Version: 24H2 (26100.4061)
  • SCIP version: 9.2.4
  • pyscipopt version: 5.7.1
  • How did you install pyscipopt? pip via pypi

Additional context
Add any other context about the problem here.

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