|
2 | 2 | import warnings |
3 | 3 | from multiprocessing.pool import ThreadPool |
4 | 4 |
|
5 | | -import ecos |
6 | | -import clarabel |
7 | 5 | import numpy as np |
8 | 6 | import scipy.sparse as sparse |
9 | | -import scs |
10 | | -from distutils.version import StrictVersion |
11 | 7 | from threadpoolctl import threadpool_limits |
12 | 8 |
|
13 | 9 | import _diffcp |
@@ -319,25 +315,17 @@ def solve_internal(A, b, c, cone_dict, solve_method=None, |
319 | 315 | solve_method = "ECOS" |
320 | 316 |
|
321 | 317 | if solve_method == "SCS": |
| 318 | + import scs |
322 | 319 |
|
323 | | - # SCS versions SCS 2.* |
324 | | - if StrictVersion(scs.__version__) < StrictVersion('3.0.0'): |
325 | | - if "eps_abs" in kwargs or "eps_rel" in kwargs: |
326 | | - # Take the min of eps_rel and eps_abs to be eps |
327 | | - kwargs["eps"] = min(kwargs.get("eps_abs", 1), |
328 | | - kwargs.get("eps_rel", 1)) |
329 | | - |
330 | | - # SCS version 3.* |
331 | | - else: |
332 | | - if "eps" in kwargs: # eps replaced by eps_abs, eps_rel |
333 | | - kwargs["eps_abs"] = kwargs["eps"] |
334 | | - kwargs["eps_rel"] = kwargs["eps"] |
335 | | - del kwargs["eps"] |
| 320 | + if "eps" in kwargs: # eps replaced by eps_abs, eps_rel |
| 321 | + kwargs["eps_abs"] = kwargs["eps"] |
| 322 | + kwargs["eps_rel"] = kwargs["eps"] |
| 323 | + del kwargs["eps"] |
336 | 324 |
|
337 | 325 | data = { |
338 | 326 | "A": A, |
339 | 327 | "b": b, |
340 | | - "c": c |
| 328 | + "c": c, |
341 | 329 | } |
342 | 330 |
|
343 | 331 | if warm_start is not None: |
@@ -367,6 +355,8 @@ def solve_internal(A, b, c, cone_dict, solve_method=None, |
367 | 355 | return result |
368 | 356 |
|
369 | 357 | elif solve_method == "ECOS": |
| 358 | + import ecos |
| 359 | + |
370 | 360 | if warm_start is not None: |
371 | 361 | raise ValueError('ECOS does not support warmstart.') |
372 | 362 | if ('s' in cone_dict) and (cone_dict['s'] != []): |
@@ -448,6 +438,7 @@ def solve_internal(A, b, c, cone_dict, solve_method=None, |
448 | 438 | 'iter': solution['info']['iter'], |
449 | 439 | 'pobj': solution['info']['pcost']} |
450 | 440 | elif solve_method == "Clarabel": |
| 441 | + import clarabel |
451 | 442 | # for now set P to 0 |
452 | 443 | P = sparse.csc_matrix((c.size, c.size)) |
453 | 444 |
|
|
0 commit comments