Skip to content

Fixes potentially outdated value of getVal #993

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mmghannam
Copy link
Member

@mmghannam mmghannam commented May 14, 2025

Without this, the value could be outdated as it depends on calling getBestSol before.

@mmghannam mmghannam requested a review from Joao-Dionisio May 14, 2025 10:42
@Joao-Dionisio
Copy link
Member

Joao-Dionisio commented May 14, 2025

Can you add a test that fails without this, please?

I'm a bit worried about scripts that call getVal very often, though. Sure, it's a tiny tiny additional effort, but people using things like getVarDict on big models might feel the difference. We would be creating a Solution object for every variable.

Can we somehow circumvent this? A terrible idea I just had was to attach an even handler to every model, that catches BESTSOLFOUND and the execmethod calls getBestSol.

@Joao-Dionisio
Copy link
Member

Joao-Dionisio commented May 14, 2025

image

This is cracking me up. If not raise error, then raise value error.
We were the ones who added this, Mo ahah

@mmghannam
Copy link
Member Author

Can you add a test that fails without this, please?

I'm a bit worried about scripts that call getVal very often, though. Sure, it's a tiny tiny additional effort, but people using things like getVarDict on big models might feel the difference. We would be creating a Solution object for every variable.

Can we somehow circumvent this? A terrible idea I just had was to attach an even handler to every model, that catches BESTSOLFOUND and the execmethod calls getBestSol.

We could maybe prevent it in the solving stage, and raise and error guiding the user to the other methods.

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