Skip to content

BUG: the result of @ can't access .vtype method #1058

@Zeroto521

Description

@Zeroto521

Describe the bug

The result of @ operation is MatrixVariable. And it can't access the .vtype method.

To Reproduce

In [1]: from pyscipopt import Model

In [2]: model = Model()

In [3]: x = model.addMatrixVar(3)

In [4]: x
Out[4]: MatrixVariable([x1, x2, x3], dtype=object)

In [5]: res = x @ x

In [6]: res
Out[6]:
MatrixVariable(Expr({Term(x1, x1): 1.0, Term(x2, x2): 1.0, Term(x3, x3): 1.0}),
               dtype=object)

In [7]: type(res)
Out[7]: pyscipopt.scip.MatrixVariable

In [8]: res.vtype()
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[8], line 1
----> 1 res.vtype()

File src/pyscipopt/scip.pxi:1821, in pyscipopt.scip.MatrixVariable.vtype()

AttributeError: 'pyscipopt.scip.Expr' object has no attribute 'vtype'

Expected behavior

  1. Return MatrixExpr, not MatrixVariable
  2. Or return MatrixVariable and could access vtype

Screenshots

Image

System

  • OS: Windows 11
  • Version: 24H2 (26100.4061)
  • SCIP version: 9.2.3
  • How did you install pyscipopt?: build from 8267aa4, base on 5.5.0

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