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

Solution hinting fix, when giving N-D variables and values #408

Merged
merged 8 commits into from
Oct 2, 2023
Merged

Conversation

Dimosts
Copy link
Collaborator

@Dimosts Dimosts commented Sep 7, 2023

Connected to issue #407

Flattening the variables and values first, before moving to the for loop of adding the hints.

Covering cases that vars and values are NDVarArrays, ndarrays or anything that has a .flat attribute + cases that the user may give lists for hinting.

@Dimosts Dimosts marked this pull request as draft September 7, 2023 14:47
@Dimosts Dimosts changed the title Solution hinting in OR-Tools giving N-D variables and values Solution hinting fix, when giving N-D variables and values Sep 7, 2023
@Dimosts Dimosts marked this pull request as ready for review September 7, 2023 15:11
@Wout4
Copy link
Collaborator

Wout4 commented Sep 8, 2023

looks good to me, but I can't get ortools to actually give me a solution that is using the hints. Is that because the problem is just too easy?
(put this in the issue by accident at first)

@IgnaceBleukx
Copy link
Collaborator

We actually have a very efficient flatlist utility function in expressions.utils, it seems to me we can just call flatlist(vars) and flatlist(vals) before posting the solution hints? Shouldn't that fix it?

@Dimosts
Copy link
Collaborator Author

Dimosts commented Sep 19, 2023

Indeed, it is cleaner that way, I didn't notice we had a function for that. Changed it to use flatlist.

@IgnaceBleukx
Copy link
Collaborator

Did some cleanup and added a tests,good to merge now for me.

@Wout4 Wout4 merged commit bef513f into master Oct 2, 2023
1 check passed
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