Description
An IDAES user brought this to my attention, and I thought that it would be worth raising for discussion.
When using the sequential decomposition tool to determine tear streams in a network, if the user does not set the options.select_tear_method
argument, the tool defaults to using the MIP approach which requires CPLEX. In cases where a user does not have CPLEX, then they receive the obvious error that it could not be found (traceback at end).
It strikes me that the heuristic approach would be a safer option to use as the default, as it does not rely on an external solver dependency. For novice users, this would work out-of-the-box without them needing to know about the deeper options (and not give the impression that they need an MILP solver). At the very least, the error message the user gets back needs to let them know that there are alternatives to using CPLEX that they can use (the error message received implies you need CPLEX to use the SD tool).
WARNING: Could not locate the 'cplex' executable, which is required for solver
cplex
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-7-21906b656554> in <module>
96 #seq.options.tear_method = "Wegstein"
97 #seq.options.iterLim = 5
---> 98 seq.run(m, function)
99
100 # Solve the flowsheet using ipopt
~\AppData\Local\Continuum\anaconda3\envs\idaes\lib\site-packages\pyomo\network\decomposition.py in run(self, model, function)
294 G = self.create_graph(model)
295
--> 296 tset = self.tear_set(G)
297
298 if self.options["run_first_pass"]:
~\AppData\Local\Continuum\anaconda3\envs\idaes\lib\site-packages\pyomo\network\decomposition.py in tear_set(self, G)
949 else:
950 raise ValueError("Invalid select_tear_method '%s'" % (method,))
--> 951 return self.cacher(key, fcn, G)
952
953 def arc_to_edge(self, G):
~\AppData\Local\Continuum\anaconda3\envs\idaes\lib\site-packages\pyomo\network\decomposition.py in cacher(self, key, fcn, *args)
918 if key in self.cache:
919 return self.cache[key]
--> 920 res = fcn(*args)
921 self.cache[key] = res
922 return res
~\AppData\Local\Continuum\anaconda3\envs\idaes\lib\site-packages\pyomo\network\decomposition.py in fcn(G)
943 self.options["tear_solver"],
944 self.options["tear_solver_io"],
--> 945 self.options["tear_solver_options"])
946 elif method == "heuristic":
947 # tset is the first list in the first return value
~\AppData\Local\Continuum\anaconda3\envs\idaes\lib\site-packages\pyomo\network\decomposition.py in select_tear_mip(self, G, solver, solver_io, solver_options)
778 if not opt.available(exception_flag=False):
779 raise ValueError("Solver '%s' (solver_io=%r) is not available, please pass a "
--> 780 "different solver" % (solver, solver_io))
781 opt.solve(model, **solver_options)
782
ValueError: Solver 'cplex' (solver_io=None) is not available, please pass a different solver