Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extra error checking and type hinting for FixedElasticSubProblem #800

Merged
merged 1 commit into from
Feb 21, 2025

Conversation

MBradbury
Copy link
Contributor

No description provided.

@MBradbury MBradbury mentioned this pull request Feb 21, 2025
Copy link
Collaborator

@pchtsp pchtsp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for also taking the time to add types everywhere. I have a minor question on a deprecation warning/ error on the use of "/". Thanks again.

@@ -421,7 +422,7 @@ def test_divide(self):
z = LpVariable("z", 0)
w = LpVariable("w", 0)
prob += x + 4 * y + 9 * z, "obj"
prob += (2 * x + 2 * y).__div__(2.0) <= 5, "c1"
prob += ((2 * x + 2 * y) / 2.0) <= 5, "c1"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add some kind of warning to users that the "/" cannot be used and for them to use div from now on? (if that's the case, that is)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

__div__ is an old Python 2 operator and doesn't exist in Python 3 any more. The ones that do exist are __truediv__, __floordiv__, __ifloordiv__, __itruediv__.

Again, this is probably another thing to look at implementing the three operators __floordiv__, __ifloordiv__ and __itruediv__.

There are some bits of the code that still provide __div__ and __rdiv__, which should be removed, as Python 3 won't use them.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops I read it backwards I thought you were including the div instead of the /. Understood on the needed changes for the div, we can add an issue on that. I'll merge this one.

@pchtsp pchtsp merged commit 8e3a954 into coin-or:master Feb 21, 2025
16 checks passed
@MBradbury MBradbury deleted the tests2 branch February 21, 2025 13:57
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.

2 participants