--
New posters to this group are moderated which can take up to 48 hours, so please be patient if your first post takes a while to turn up.
---
You received this message because you are subscribed to the Google Groups "pulp-or-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pulp-or-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pulp-or-discuss/967af1f2-a1bd-4091-9834-302dccaece7a%40googlegroups.com.
Hi if you have access to gurobi solver I can share my experience with you
On Fri, Feb 14, 2020 at 08:22 Tilda Lundgren <tilda.v...@gmail.com> wrote:
Hi!--
I am new to PuLP and was wondering whether it's possible to save a previous solution and then reuse it as a warm start the next time I run the model.In DoCPLEX, I would use the following commands:WRITE COMMAND >> sol.export_as_mst(path="./mst/",basename="filename.mst")READ COMMAND >> mdl.get_cplex().MIP_starts.read("./mst/filename.mst")What would the equivalent be in PuLP?
New posters to this group are moderated which can take up to 48 hours, so please be patient if your first post takes a while to turn up.
---
You received this message because you are subscribed to the Google Groups "pulp-or-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pulp-or...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to pulp-or-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pulp-or-discuss/de63f905-3769-4815-b671-05f50a668430%40googlegroups.com.
Hi Tilda,After you define all the variables and constraints with PuLP package you add following code: note that prob in the () is your problem name you specifiedsolver = pulp.GUROBI()prob.setSolver(solver)prob.solver.buildSolverModel(prob)variables = prob.solverModel.getVars()for var in variables:var.start = init_dict.get(var.varname) #here the init_dict is a python dict where you store initial valuesprob.solver.callSolver(prob) #here you solve the problemresult_dict= {}for var in variables:result_dict[var.varname] = var.x #you store your new results in this new python dictobj = prob.solverModel.getObjective().getValue() # you get objectiveIt works in my case. Hope it helps for you as well.
Tilda Lundgren <tilda.v...@gmail.com> 于2020年2月14日周五 下午12:57写道:
Hi Sen! Yes, please share your experience with doing warm starts in Gurobi!--
Den fredag 14 februari 2020 kl. 09:17:57 UTC+1 skrev Sen Zhan:Hi if you have access to gurobi solver I can share my experience with youOn Fri, Feb 14, 2020 at 08:22 Tilda Lundgren <tilda.v...@gmail.com> wrote:Hi!--
I am new to PuLP and was wondering whether it's possible to save a previous solution and then reuse it as a warm start the next time I run the model.In DoCPLEX, I would use the following commands:WRITE COMMAND >> sol.export_as_mst(path="./mst/",basename="filename.mst")READ COMMAND >> mdl.get_cplex().MIP_starts.read("./mst/filename.mst")What would the equivalent be in PuLP?
New posters to this group are moderated which can take up to 48 hours, so please be patient if your first post takes a while to turn up.
---
You received this message because you are subscribed to the Google Groups "pulp-or-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pulp-or...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pulp-or-discuss/967af1f2-a1bd-4091-9834-302dccaece7a%40googlegroups.com.
New posters to this group are moderated which can take up to 48 hours, so please be patient if your first post takes a while to turn up.
---
You received this message because you are subscribed to the Google Groups "pulp-or-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pulp-or...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pulp-or-discuss/de63f905-3769-4815-b671-05f50a668430%40googlegroups.com.
--------------------------------------------------------------------------- NotImplementedError Traceback (most recent call last) <ipython-input-11-35506d6cc784> in <module> 1 for variable, value in initial_solution.items(): ----> 2 variable.setInitialValue(value) /anaconda3/lib/python3.7/site-packages/pulp/pulp.py in setInitialValue(self, val) 496 may of may not be supported by the solver 497 """ --> 498 raise NotImplementedError 499 500 NotImplementedError:
To unsubscribe from this group and stop receiving emails from it, send an email to pulp-or-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pulp-or-discuss/1432dbd9-6280-443c-b3f6-4006bbf945d3%40googlegroups.com.
Hello Sen and Tilda,
This functionality is somewhat new (that’s why there was no documentation of it).
To be able to use it, you’d need to reinstall pulp to its newer version (2.0 as of now):
pip install -U pulp
F.
El lunes, 17 de febrero de 2020, 12:08:16 (UTC+1), Sen Zhan escribió:
I tried before setInitialValue, but it didnt work as well. Alternatively you can go with Julia where you can use JuMP package to build models.
To unsubscribe from this group and stop receiving emails from it, send an email to pulp-or-discuss+unsubscribe@googlegroups.com.
--------------------------------------------------------------------------- NotImplementedError Traceback (most recent call last)
<ipython-input-21-35506d6cc784> in <module>
1 for variable, value in initial_solution.items(): ----> 2 variable.setInitialValue(value) /anaconda3/lib/python3.7/site-packages/pulp/pulp.py in setInitialValue(self, val)
496 for constraint, coeff in e.items(): 497 constraint.addVariable(self,coeff) --> 498 499 def setInitialValue(self, val, check=True): 500 """sets the initial value of the Variable to val NotImplementedError:
To view this discussion on the web visit https://groups.google.com/d/msgid/pulp-or-discuss/1432dbd9-6280-443c-b3f6-4006bbf945d3%40googlegroups.com.
Hello Tilda,
Sorry to hear that it’s not working. Are you sure that you’ve installed pulp 2.0 in your python 3.7 anacoda3 installation though?
I sometimes make the mistake of mixing all the several python environments installed in my pc…
You can check the PuLP version with the method here: https://stackoverflow.com/a/32965521
or by doing:
import pulp
print(pulp.__version__)
F.