#19037: Cplex backend: allow to set logfile
-------------------------------------+-------------------------------------
Reporter: dcoudert | Owner:
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-6.9
Component: linear | Resolution:
programming | Merged in:
Keywords: | Reviewers:
Authors: David Coudert | Work issues:
Report Upstream: N/A | Commit:
Branch: public/19037 | 0e5fb5b7682d7dda735aa2771baf9f1eb1cd9ddc
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by dcoudert):
Hello,
since `LogFile` is a solver parameter for `Gurobi`, I prefer to have
similar access method for `Cplex`.
I have added the parameter to the documentation and I'm now using the
`check` method.
Also, I had to
- modify all doctests of the `cplex_backend.pyx` file for the following
reason: a call to `./sage -t -l --optional=CPLEX
src/sage/numerical/backends/cplex_backend.pyx` was reporting 149 doctests
failures!
{{{
**********************************************************************
File "src/sage/numerical/backends/cplex_backend.pyx", line 78, in
sage.numerical.backends.cplex_backend.CPLEXBackend.add_variable
Failed example:
p = get_solver(solver = "CPLEX") # optional - CPLEX
Exception raised:
Traceback (most recent call last):
File "/Users/dcoudert/sage/local/lib/python2.7/site-
packages/sage/doctest/forker.py", line 496, in _run
self.compile_and_execute(example, compiler, test.globs)
File "/Users/dcoudert/sage/local/lib/python2.7/site-
packages/sage/doctest/forker.py", line 858, in compile_and_execute
exec(compiled, globs)
File "<doctest
sage.numerical.backends.cplex_backend.CPLEXBackend.add_variable[0]>", line
1, in <module>
p = get_solver(solver = "CPLEX") # optional -
CPLEX
NameError: name 'get_solver' is not defined
**********************************************************************
File "src/sage/numerical/backends/cplex_backend.pyx", line 79, in
sage.numerical.backends.cplex_backend.CPLEXBackend.add_variable
Failed example:
p.ncols() # optional - CPLEX
Exception raised:
Traceback (most recent call last):
File "/Users/dcoudert/sage/local/lib/python2.7/site-
packages/sage/doctest/forker.py", line 496, in _run
self.compile_and_execute(example, compiler, test.globs)
File "/Users/dcoudert/sage/local/lib/python2.7/site-
packages/sage/doctest/forker.py", line 858, in compile_and_execute
exec(compiled, globs)
File "<doctest
sage.numerical.backends.cplex_backend.CPLEXBackend.add_variable[1]>", line
1, in <module>
p.ncols() # optional -
CPLEX
NameError: name 'p' is not defined
...
...
...
**********************************************************************
29 items had failures:
6 of 7 in sage.numerical.backends.cplex_backend.CPLEXBackend.add_col
7 of 8 in
sage.numerical.backends.cplex_backend.CPLEXBackend.add_linear_constraint
6 of 7 in
sage.numerical.backends.cplex_backend.CPLEXBackend.add_linear_constraints
5 of 6 in
sage.numerical.backends.cplex_backend.CPLEXBackend.add_variables
5 of 6 in
sage.numerical.backends.cplex_backend.CPLEXBackend.col_bounds
3 of 4 in sage.numerical.backends.cplex_backend.CPLEXBackend.col_name
8 of 9 in
sage.numerical.backends.cplex_backend.CPLEXBackend.get_objective_value
8 of 9 in
sage.numerical.backends.cplex_backend.CPLEXBackend.get_variable_value
4 of 5 in
sage.numerical.backends.cplex_backend.CPLEXBackend.is_maximization
5 of 6 in
sage.numerical.backends.cplex_backend.CPLEXBackend.is_variable_binary
6 of 7 in
sage.numerical.backends.cplex_backend.CPLEXBackend.is_variable_continuous
5 of 6 in
sage.numerical.backends.cplex_backend.CPLEXBackend.is_variable_integer
4 of 5 in sage.numerical.backends.cplex_backend.CPLEXBackend.ncols
4 of 5 in sage.numerical.backends.cplex_backend.CPLEXBackend.nrows
5 of 6 in
sage.numerical.backends.cplex_backend.CPLEXBackend.objective_coefficient
3 of 4 in
sage.numerical.backends.cplex_backend.CPLEXBackend.problem_name
5 of 6 in sage.numerical.backends.cplex_backend.CPLEXBackend.row
5 of 6 in
sage.numerical.backends.cplex_backend.CPLEXBackend.row_bounds
3 of 4 in sage.numerical.backends.cplex_backend.CPLEXBackend.row_name
5 of 12 in
sage.numerical.backends.cplex_backend.CPLEXBackend.set_objective
4 of 5 in
sage.numerical.backends.cplex_backend.CPLEXBackend.set_sense
5 of 6 in
sage.numerical.backends.cplex_backend.CPLEXBackend.set_variable_type
2 of 3 in
sage.numerical.backends.cplex_backend.CPLEXBackend.set_verbosity
6 of 7 in sage.numerical.backends.cplex_backend.CPLEXBackend.solve
10 of 11 in
sage.numerical.backends.cplex_backend.CPLEXBackend.solver_parameter
5 of 11 in
sage.numerical.backends.cplex_backend.CPLEXBackend.variable_lower_bound
5 of 10 in
sage.numerical.backends.cplex_backend.CPLEXBackend.variable_upper_bound
5 of 6 in sage.numerical.backends.cplex_backend.CPLEXBackend.write_lp
5 of 6 in
sage.numerical.backends.cplex_backend.CPLEXBackend.write_mps
[191 tests, 149 failures, 0.11 s]
----------------------------------------------------------------------
sage -t --long src/sage/numerical/backends/cplex_backend.pyx # 149
doctests failed
}}}
Adding `# optional - CPLEX` to all the lines `from
sage.numerical.backends.generic_backend import get_solver` solve the
problem. Don't know why.
- change some doctests to get rid of deprecation warnings. E.g.,
{{{
doctest:858: DeprecationWarning: The default value of 'nonnegative'
will change, to False instead of True. You should add the explicit
'nonnegative=True'.
See http://trac.sagemath.org/15521 for details.
}}}
I have a remaining doctest error for method `solve`
{{{
File "src/sage/numerical/backends/cplex_backend.pyx", line 852, in
sage.numerical.backends.cplex_backend.CPLEXBackend.solve
Failed example:
p.solve() # optional - CPLEX
Expected:
Traceback (most recent call last):
...
MIPSolverException: ...
Got:
0
}}}
I don't know how to fix the example. I can off course change it to
something more understandable. Let me know what you prefer.
David.
--
Ticket URL: <http://trac.sagemath.org/ticket/19037#comment:6>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.