ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 21 May 2019 13:36:42 +0200using cplex as a solver in sage - import error undefined symbol: CPXsetlogfilehttps://ask.sagemath.org/question/46606/using-cplex-as-a-solver-in-sage-import-error-undefined-symbol-cpxsetlogfile/Hi,
Ubuntu 18.04; Installed cplex_studio129.linux-x86-64.bin and then Sage 8.7 from source.
I chose source to allow me to "make" Sage again after linking the necessary CPLEX files as described at the very bottom of the page here:
doc.sagemath.org/html/en/thematic_tutorials/linear_programming
i.e. from
/home/klara/sage-8.7/local/lib
`ln -s /opt/ibm/ILOG/CPLEX_Studio129/cplex/lib/x86-64_linux/static_pic/libcplex.a .`
and from:
/home/klara/sage-8.7/local/include
`ln -s /opt/ibm/ILOG/CPLEX_Studio129/cplex/include/ilcplex/cplex.h .`
and finally, also from:
/home/klara/sage-8.7/local/include
`ln -s /opt/ibm/ILOG/CPLEX_Studio129/cplex/include/ilcplex/cpxconst.h .`
But now I get the following import error when running:
sage: p = MixedIntegerLinearProgram(solver='CPLEX')
ImportError: /home/klara/sage-8.7/local/lib/python2.7/site-packages/sage/numerical/backends/cplex_backend.so: undefined symbol: CPXsetlogfile
(By the way, after installing Sage but before linking and remaking I got the more basic import error:
`ImportError: No module named cplex_backend`)
Any hints as what to look into would be appreciated.
Thanks.
----------
Here is the Full Output of the error:
sage: p = MixedIntegerLinearProgram(solver='CPLEX')
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-d320ed52392f> in <module>()
----> 1 p = MixedIntegerLinearProgram(solver='CPLEX')
/home/klara/sage-8.7/local/lib/python2.7/site-packages/sage/misc/lazy_import.pyx in sage.misc.lazy_import.LazyImport.__call__ (build/cythonized/sage/misc/lazy_import.c:3690)()
352 True
353 """
--> 354 return self.get_object()(*args, **kwds)
355
356 def __repr__(self):
/home/klara/sage-8.7/local/lib/python2.7/site-packages/sage/numerical/mip.pyx in sage.numerical.mip.MixedIntegerLinearProgram.__init__ (build/cythonized/sage/numerical/mip.c:3931)()
449 self._first_variable_names = list(names)
450 from sage.numerical.backends.generic_backend import get_solver
--> 451 self._backend = get_solver(solver=solver,
452 constraint_generation=constraint_generation,
453 base_ring=base_ring)
/home/klara/sage-8.7/local/lib/python2.7/site-packages/sage/numerical/backends/generic_backend.pyx in sage.numerical.backends.generic_backend.get_solver (build/cythonized/sage/numerical/backends/generic_backend.c:20060)()
1647 raise ValueError("'solver' should be set to 'GLPK', 'Coin', 'CPLEX', 'CVXOPT', 'Gurobi', 'PPL', 'InteractiveLP', or None.")
1648
-> 1649 cpdef GenericBackend get_solver(constraint_generation = False, solver = None, base_ring = None):
1650 """
1651 Return a solver according to the given preferences
/home/klara/sage-8.7/local/lib/python2.7/site-packages/sage/numerical/backends/generic_backend.pyx in sage.numerical.backends.generic_backend.get_solver (build/cythonized/sage/numerical/backends/generic_backend.c:19611)()
1794
1795 elif solver == "Cplex":
-> 1796 from sage.numerical.backends.cplex_backend import CPLEXBackend
1797 return CPLEXBackend()
1798
ImportError: /home/klara/sage-8.7/local/lib/python2.7/site-packages/sage/numerical/backends/cplex_backend.so: undefined symbol: CPXsetlogfilebucks65Tue, 21 May 2019 13:36:42 +0200https://ask.sagemath.org/question/46606/Using CPLEX via SAGE when it's package installedhttps://ask.sagemath.org/question/45757/using-cplex-via-sage-when-its-package-installed/I would like to use CPLEX via SAGE. I checked the tutorial.
However, my Sage is installed via a package (debian) on a common server. Therefore, in my SAGE_ROOT (/usr/share/sagemath), I don't have local directory. Is there another directory then?
olfMon, 11 Mar 2019 15:03:57 +0100https://ask.sagemath.org/question/45757/Cplex to solve discouted cash flowhttps://ask.sagemath.org/question/24907/cplex-to-solve-discouted-cash-flow/ Hi,
We are working on a project to consider discounted cashflow in MRCPSP problems. We are having trouble implementing discounted cash flow concept in our cost objective function.
The actual code, not considering discouted cash flow is:
minimize(sum(m in Modes)m.cost*presenceOf(mode[m]))*100
which minimizes the cost of the project .this function adds up all the cost related to each mode of activity.what we need is for each mode the function consider the cost and the finish schedule of each activity.
rate = annual interest rate
discounted cash flow= cost x (1-scheduled finish time of activity x rate)
What we have tried is:
minimize(sum(m in mode))m.cost*(1-rate*(m.Duration))*presenceOf(mode[m]))*100
which is not correct , and it considers the duration of activity what we need is finish time of activity to be calculated.
Thank you very much for your help,
Pernelle and MehdiPernindyTue, 18 Nov 2014 18:17:52 +0100https://ask.sagemath.org/question/24907/Sage 4.6.2: how to use CPLEXhttps://ask.sagemath.org/question/7986/sage-462-how-to-use-cplex/I've just upgraded from 4.6 to 4.6.2. The COIN and CPLEX backends were included (in .../devel/sage-main/sage/numerical/backends), but I can't find a way to import them. The line
lp = MixedIntegerLinearProgram(solver="GLPK");
works, but solver="Coin" and solver="CPLEX" lead to messages that the corresponding _backend module is not found. I tried a few blind guesses to import them but had not luck. The docs seem to be a lap behind (the help for MixedIntegerLinearProgram says the CPLEX interface is not implemented yet, but that COIN's is; on the other hand, asking for help for sage.numerical.backends.xxxx_backend works for xxxx=glpk but not for xxxx=coin or cplex).
Does anybody know the correct incantation?
TIA, PaulprubinSat, 05 Mar 2011 18:37:01 +0100https://ask.sagemath.org/question/7986/