simpler solver_vars improvement#992
Conversation
Not as effective as 'solver_vars_1d', but simpler and compatible with
IgnaceBleukx
left a comment
There was a problem hiding this comment.
Do we also want to change the actual solver_var implementation of each solver?
There we could also first do the quick check if var.name is in the varmap or not.
I think the first step should at least be to check if it is a _NumVarImpl or not, currently the frist step is to check if it is num, but that is unlikely and slow to check.
We can do it in a different PR tho, this one is good to go in.
| res.append(self.solver_var(cpm_var)) | ||
| elif isinstance(cpm_var, int): | ||
| res.append(cpm_var) | ||
| elif is_any_list(cpm_var): |
There was a problem hiding this comment.
We could also add a fast path for numpy arrays here? Not sure if it is worth it. It would flatten the np array and operate on that
There was a problem hiding this comment.
we rarely store non-1D numpy(ndvar) arrays in constraints, so, don't think its worth special casing and the return type has to be plain list
that was the original #938 remark indeed : ) Better in a separate PR so this can already go in...? |
Not as effective as 'solver_vars_1d' from #939 , but simpler and compatible with #990
(also includes the dev/time_ortools script)