-
Notifications
You must be signed in to change notification settings - Fork 252
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
solve problem with multi-threads #918
base: master
Are you sure you want to change the base?
Conversation
2. solveFirstInterruptOthers 3. add copy model method 4. add copy model solution 5. add some Solution methods
tests/test_multi_threads.py
Outdated
for i in range(N_Threads): | ||
models[i].setParam("randomization/permutationseed", i) | ||
|
||
ori_model.optimize() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this optimize
call need to come before the others are called?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ori_model.optimize()
can be called anywhere.
It's ok before or after ori_model.copyModel()
, models[i].setParam("randomization/permutationseed", i)
, Model.solveFirstInterruptOthers(executor=executor, models=models)
Thanks for the PR @liangbug !
|
Appendix 1. from pyscipopt import Model
def main():
orig_scip = Model()
copy_scip = Model.copyModel(orig_scip)
new_scip = Model(sourceModel=orig_scip)
orig_scip_param_names = orig_scip.getParams().keys()
copy_scip_param_names = copy_scip.getParams().keys()
new_scip_param_names = new_scip.getParams().keys()
lost_params = sorted(list(set(orig_scip_param_names) - set(new_scip_param_names)))
print('The count of orig scip params:', len(orig_scip_param_names))
print('The count of copy scip params:', len(copy_scip_param_names))
print('The count of new scip params:', len(new_scip_param_names))
print('The lost of new scip params:', lost_params)
if __name__ == "__main__":
main()
|
Hey @liangbug! Last week, @Opt-Mucca, @mmghannam, and I discussed this PR and came to the following conclusions.
However, we understand the frustration with using What do you think of this, @liangbug? Does it sound reasonable? |
I understand yours concerns. |
2. model addOrigVarsConssObjectiveFrom 3. add some Solution methods
Hi @Opt-Mucca @Joao-Dionisio
|
I want to solve problem with multi-threads and different random seeds
So I added some methods including
The copyed model from init method argument sourceModel loses some scip components.
The new copy model method use full scip components.