ofanan / SFC_migration

This project simulates deployment and migration of Service Function Chains (SFC) in data-centers.
29 stars 0 forks source link

solve_problem_by_Cplex.py #2

Open zhangshuaiqing opened 1 year ago

zhangshuaiqing commented 1 year ago

if name == "main": solve_problem_by_Cplex ('../res/problem.lp') I can't find problem.lp under the res folder.

ofanan commented 1 year ago

Hi,

Fixed. Please pull the updated solve_problem_by_Cplex.py, and the /res/lp directory.

However, please note that this is a rather old version - the newer versions now use Gurobi. Hence I can't guarantee it really works.

Good luck,

On Thu, Jun 29, 2023 at 6:11 PM zhangshuaiqing @.***> wrote:

if name == "main": solve_problem_by_Cplex ('../res/problem.lp') I can't find problem.lp under the res folder.

— Reply to this email directly, view it on GitHub https://github.com/ofanan/SFC_migration/issues/2, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADGUOGZHHGXYFIKKHGAABRTXNWLJBANCNFSM6AAAAAAZYU76RE . You are receiving this because you are subscribed to this thread.Message ID: @.***>

--

Itamar Cohen, www.ofanan.com

“The only thing necessary for the triumph of evil is for good men to do nothing” (Edmund Burke)

zhangshuaiqing commented 1 year ago

Thank you for your reply, and I have another problem when running toy_example.py such as ModuleNotFoundError: No module named 'Check_sol' and ModuleNotFoundError: No module named 'obj_func' and I check that there no file Check_sol and obj_func under src folder.

ofanan commented 1 year ago

Hi, You may find them here https://github.com/ofanan/SFC_migration/tree/d20c481ff2d08287708afa6b16e4abd1c86072b1/src . Please inform me whether they run properly. If so, I'll push them again into the main update repo. Best wishes,

On Thu, Jun 29, 2023 at 7:52 PM zhangshuaiqing @.***> wrote:

Thank you for your reply, and I have another problem when running toy_example.py such as ModuleNotFoundError: No module named 'Check_sol' and ModuleNotFoundError: No module named 'obj_func' and I check that there no file Check_sol and obj_func under src folder.

— Reply to this email directly, view it on GitHub https://github.com/ofanan/SFC_migration/issues/2#issuecomment-1613527061, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADGUOG7S2RSULUT6ZC24FADXNWXGVANCNFSM6AAAAAAZYU76RE . You are receiving this because you commented.Message ID: @.***>

--

Itamar Cohen, www.ofanan.com

“The only thing necessary for the triumph of evil is for good men to do nothing” (Edmund Burke)

zhangshuaiqing commented 1 year ago

Hi, The program is not running properly. and I find that there no Check_sol under src folder.

zhangshuaiqing commented 1 year ago

Hi, Fixed. Please pull the updated solve_problem_by_Cplex.py, and the /res/lp directory. However, please note that this is a rather old version - the newer versions now use Gurobi. Hence I can't guarantee it really works. Good luck, On Thu, Jun 29, 2023 at 6:11 PM zhangshuaiqing @.> wrote: if name == "main": solve_problem_by_Cplex ('../res/problem.lp') I can't find problem.lp under the res folder. — Reply to this email directly, view it on GitHub <#2>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADGUOGZHHGXYFIKKHGAABRTXNWLJBANCNFSM6AAAAAAZYU76RE . You are receiving this because you are subscribed to this thread.Message ID: @.> -- Itamar Cohen, www.ofanan.com “The only thing necessary for the triumph of evil is for good men to do nothing” (Edmund Burke)

When I tried again, I meet this problem. CPLEX Error 1016: Community Edition. Problem size limits exceeded. Purchase at http://ibm.biz/error1016. Traceback (most recent call last): File ".\solve_problem_by_Cplex.py", line 44, in solve_problem_by_Cplex ('../res/lp/problem.lp') problem.solve () #TimeLimit=1000? File "D:\python\anaconda3\envs\sumo\lib\site-packages\cplex__init.py", line 1312, in solve _proc.lpopt(self._env._e, self._lp) File "D:\python\anaconda3\envs\sumo\lib\site-packages\cplex_internal_procedural.py", line 738, in lpopt check_status(env, status) File "D:\python\anaconda3\envs\sumo\lib\site-packages\cplex_internal_procedural.py", line 249, in call__ raise CplexSolverError(error_string, env, status) cplex.exceptions.errors.CplexSolverError: CPLEX Error 1016: Community Edition. Problem size limits exceeded. Purchase at http://ibm.biz/error1016.

but when the input file is shoter.lp, the program runs correctly and returns, Version identifier: 22.1.0.0 | 2022-03-25 | 54982fbec CPXPARAM_Read_DataCheck 1 Tried aggregator 1 time. LP Presolve eliminated 2 rows and 3 columns. All rows and columns eliminated. Presolve time = 0.00 sec. (0.00 ticks)


Sol status: optimal


lp sol cost = 4.00

I learn from the Internet that the academic version of cplex only supports solving problems with 1000 variables, and the number of variables required to be solved in problem.lp is 6410. Is this the cause of the program error?

ofanan commented 1 year ago

Hi, That makes sense. I don't remember that we faced such a problem, but maybe this only because we gave up using Cplex at a rather early stage of our work - we focused on developing our own approximation algorithms. When we tried LP solvers again, we used Gurobi. There are functions that solve the updated formulation of the problem in SFC_mig_simulator.py. Although it was a rather large problem, Gurobi's free academic license got along with that, without such errors. SFC_mig_simulator also contains functions that solve the problem using Python's default LP solver, which works without downloading any external tool - only regular "pip install".. However, it is much slower than Gurobi. Best,

On Thu, Jun 29, 2023 at 9:16 PM zhangshuaiqing @.***> wrote:

Hi, Fixed. Please pull the updated solve_problem_by_Cplex.py, and the /res/lp directory. However, please note that this is a rather old version - the newer versions now use Gurobi. Hence I can't guarantee it really works. Good luck, … <#m-3348353039656746539> On Thu, Jun 29, 2023 at 6:11 PM zhangshuaiqing @.> wrote: if name == "main": solve_problem_by_Cplex ('../res/problem.lp') I can't find problem.lp under the res folder. — Reply to this email directly, view it on GitHub <#2 https://github.com/ofanan/SFC_migration/issues/2>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADGUOGZHHGXYFIKKHGAABRTXNWLJBANCNFSM6AAAAAAZYU76RE https://github.com/notifications/unsubscribe-auth/ADGUOGZHHGXYFIKKHGAABRTXNWLJBANCNFSM6AAAAAAZYU76RE . You are receiving this because you are subscribed to this thread.Message ID: @.> -- Itamar Cohen, www.ofanan.com “The only thing necessary for the triumph of evil is for good men to do nothing” (Edmund Burke)

When I tried again, I meet this problem. CPLEX Error 1016: Community Edition. Problem size limits exceeded. Purchase at http://ibm.biz/error1016. Traceback (most recent call last): File ".\solve_problem_by_Cplex.py", line 44, in solve_problem_byCplex ('../res/lp/problem.lp') problem.solve () #TimeLimit=1000? File "D:\python\anaconda3\envs\sumo\lib\site-packages\cplexinit_.py", line 1312, in solve _proc.lpopt(self._env._e, self._lp) File "D:\python\anaconda3\envs\sumo\lib\site-packages\cplex_internal_procedural.py", line 738, in lpopt check_status(env, status) File "D:\python\anaconda3\envs\sumo\lib\site-packages\cplex_internal_procedural.py", line 249, in call raise CplexSolverError(error_string, env, status) cplex.exceptions.errors.CplexSolverError: CPLEX Error 1016: Community Edition. Problem size limits exceeded. Purchase at http://ibm.biz/error1016.

but when the input file is shoter.lp, the program runs correctly and returns, Version identifier: 22.1.0.0 | 2022-03-25 | 54982fbec CPXPARAM_Read_DataCheck 1 Tried aggregator 1 time. LP Presolve eliminated 2 rows and 3 columns. All rows and columns eliminated. Presolve time = 0.00 sec. (0.00 ticks)

Sol status: optimal

lp sol cost = 4.00

I learn from the Internet that the academic version of cplex only supports solving problems with 1000 variables, and the number of variables required to be solved in problem.lp is 6410. Is this the cause of the program error?

— Reply to this email directly, view it on GitHub https://github.com/ofanan/SFC_migration/issues/2#issuecomment-1613586466, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADGUOGYJVZCGDP4KKIAJJO3XNW6QNANCNFSM6AAAAAAZYU76RE . You are receiving this because you commented.Message ID: @.***>

--

Itamar Cohen, www.ofanan.com

“The only thing necessary for the triumph of evil is for good men to do nothing” (Edmund Burke)

zhangshuaiqing commented 1 year ago

Hi, You may find them here https://github.com/ofanan/SFC_migration/tree/d20c481ff2d08287708afa6b16e4abd1c86072b1/src . Please inform me whether they run properly. If so, I'll push them again into the main update repo. Best wishes, On Thu, Jun 29, 2023 at 7:52 PM zhangshuaiqing @.> wrote: Thank you for your reply, and I have another problem when running toy_example.py such as ModuleNotFoundError: No module named 'Check_sol' and ModuleNotFoundError: No module named 'obj_func' and I check that there no file Check_sol and obj_func under src folder. — Reply to this email directly, view it on GitHub <#2 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADGUOG7S2RSULUT6ZC24FADXNWXGVANCNFSM6AAAAAAZYU76RE . You are receiving this because you commented.Message ID: @.> -- Itamar Cohen, www.ofanan.com “The only thing necessary for the triumph of evil is for good men to do nothing” (Edmund Burke)

Hi, I find obj_func but no Check_sol under https://github.com/ofanan/SFC_migration/tree/d20c481ff2d08287708afa6b16e4abd1c86072b1/src. Please push them again into the main update repo., thanks.

ofanan commented 1 year ago

Hi, I used there a primitive version of self-modifying-code: the files obj_func.py and Check_sol.py should actually be generated by a previous run of toy_example.py itself (while commenting their imports). Please see the documentation at the first lines of the updated version of toy_example.py https://github.com/ofanan/SFC_migration/blob/main/src/toy_example.py Best wishes,

On Sat, Jul 1, 2023 at 9:24 AM zhangshuaiqing @.***> wrote:

Hi, You may find them here https://github.com/ofanan/SFC_migration/tree/d20c481ff2d08287708afa6b16e4abd1c86072b1/src . Please inform me whether they run properly. If so, I'll push them again into the main update repo. Best wishes, … <#m-4358737536543253729> On Thu, Jun 29, 2023 at 7:52 PM zhangshuaiqing @.> wrote: Thank you for your reply, and I have another problem when running toy_example.py such as ModuleNotFoundError: No module named 'Check_sol' and ModuleNotFoundError: No module named 'obj_func' and I check that there no file Check_sol and obj_func under src folder. — Reply to this email directly, view it on GitHub <#2 (comment) https://github.com/ofanan/SFC_migration/issues/2#issuecomment-1613527061>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADGUOG7S2RSULUT6ZC24FADXNWXGVANCNFSM6AAAAAAZYU76RE https://github.com/notifications/unsubscribe-auth/ADGUOG7S2RSULUT6ZC24FADXNWXGVANCNFSM6AAAAAAZYU76RE . You are receiving this because you commented.Message ID: @.> -- Itamar Cohen, www.ofanan.com “The only thing necessary for the triumph of evil is for good men to do nothing” (Edmund Burke)

Hi, I find obj_func but no Check_sol under https://github.com/ofanan/SFC_migration/tree/d20c481ff2d08287708afa6b16e4abd1c86072b1/src . Please push them again into the main update repo., thanks.

— Reply to this email directly, view it on GitHub https://github.com/ofanan/SFC_migration/issues/2#issuecomment-1615547378, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADGUOG4V7DLX7Q2Z5HQMB3DXN67A5ANCNFSM6AAAAAAZYU76RE . You are receiving this because you commented.Message ID: @.***>

--

Itamar Cohen, www.ofanan.com

“The only thing necessary for the triumph of evil is for good men to do nothing” (Edmund Burke)