After defining my variables names and data in arrays, I wish to use them to set the objective function, constraints, and coefficients for the CPLEX problem object.
This can obviously be accomplished in a procedural or sequential fashion.
Has anyone attempted to simultaneuously perform these tasks in a prallel or multi-thread fashion?
This topic has been locked.
2 replies Latest Post - 2013-02-12T17:16:29Z by SystemAdmin
Pinned topic Multi-Threading in .NET
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2013-02-12T17:16:29Z at 2013-02-12T17:16:29Z by SystemAdmin
Re: Multi-Threading in .NET2013-02-09T08:49:26Z in response to SystemAdminWhen doing this, you need to be careful for two reasons:
1. The Cplex class itself is not designed for concurrently adding constraints. You need to apply some locking mechanism yourself so that no two threads add constraints or objective functions at the same time. Same for creating of variables.
2. Creating the model in parallel will result in "random" order of variables and constraints (the order depends on how the OS scheduler schedules the threads). Since the order of variables/constraints may heavily influence the performance of the solver (this is known as "performance variability") it may get hard to reproduce results or debug problems. To avoid this you could create the variables sequentially, then create the constraints in parallel but instead of adding them to CPLEX directly first store them in an array, then sort them according to some criterion (name?) and finally add the sorted array to CPLEX.