Skip to content

Conversation

@fserra
Copy link
Collaborator

@fserra fserra commented Nov 1, 2018

Closes #213

@ramabile
Copy link
Collaborator

ramabile commented Nov 2, 2018

Misc:

  • Exception TypeError: "'NoneType' object is not callable" in 'pyscipopt.scip.Model.__dealloc__' ignored each time I run tests. Do you know what raises it?
  • I should make test_logical.py more compact...

@ramabile
Copy link
Collaborator

ramabile commented Nov 2, 2018

Disclaimer: I am a chemist by background and I could be biased. I work with classical a-toms, that means integers cannot be divided. 😆

About the request, I think the expected behaviour as a Python user follows (#213):

float / float = float
float / int = float
int / float = float
>>> int / int = int

Since there is no support for int/int I would expect ProdExpr is kept unchanged and not casted as Expr. Doing the opposite opens the pitfall so that an int/int is assumed to be float.
My newcomer's opinion is I would like to face the error as soon as possible instead of discovering by myself integer division is not supported.

What is SCIP behaviour in this case?

@fserra
Copy link
Collaborator Author

fserra commented Nov 2, 2018

I am not sure why the error at __dealloc__ appears. I guess we still have some issue with when the freeing of what happens.

I would say int/int is float. For instance, x/2 and x/2.0 should both be expressions, right?

@ramabile
Copy link
Collaborator

ramabile commented Nov 2, 2018

Ok I see now, it makes sense.

Python3 makes 3/2==1.5, Python2 3/2==1. There is no support for 3//2.
If one wants the floor division, they realises soon x//2 is unsuported and finds a workaround like this.

@ramabile ramabile merged commit 76268de into master Nov 2, 2018
@ramabile ramabile deleted the 213-make-expr-when-dividing-by-number branch November 2, 2018 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants