linopy icon indicating copy to clipboard operation
linopy copied to clipboard

CPLEX Error 1615: Expected number, found 'i'.

Open euronion opened this issue 2 years ago • 0 comments

When using cplex with PyPSA-EUR and linopy I'm getting the following error.

It is linked to an inf constraint which I'm lazily imposing on the network, when filtering for the values which are inf and not imposing the constraint everything works fine.

gurobi does not have that issue and also runs fine with the inf constraint.

Probably related: https://github.com/Pyomo/pyomo/issues/364)

Error message

[snakemake / PyPSA-EUR stuff omitted]

INFO:linopy.model:Solver options:
 - threads: 4
 - lpmethod: 4
 - solutiontype: 2
 - barrier.convergetol: 0.0001
 - feasopt.tolerance: 1e-06
INFO:linopy.io:Writing objective.
Writing constraints.: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 32/32 [00:20<00:00,  1.59it/s]
Writing continuous variables.: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 14/14 [00:03<00:00,  3.81it/s]
INFO:linopy.io: Writing time: 26.38s
Traceback (most recent call last):
  File "/p/tmp/<user>/pypsa-eur/.snakemake/shadow/tmpywrwfrn1/.snakemake/scripts/tmpp__dz4cb.solve_network.py", line 840, in <module>
    n = solve_network(
  File "/p/tmp/<user>/pypsa-eur/.snakemake/shadow/tmpywrwfrn1/.snakemake/scripts/tmpp__dz4cb.solve_network.py", line 781, in solve_network
    status, condition = n.optimize(**kwargs)
  File "/home/<user>/software/micromamba_1.4.2/envs/pypsa-eur/lib/python3.10/site-packages/pypsa/optimization/optimize.py", line 587, in __call__
    return optimize(self._parent, *args, **kwargs)
  File "/home/<user>/software/micromamba_1.4.2/envs/pypsa-eur/lib/python3.10/site-packages/pypsa/optimization/optimize.py", line 567, in optimize
    status, condition = m.solve(solver_name=solver_name, **solver_options, **kwargs)
  File "/home/<user>/software/micromamba_1.4.2/envs/pypsa-eur/lib/python3.10/site-packages/linopy/model.py", line 1042, in solve
    result = func(
  File "/home/<user>/software/micromamba_1.4.2/envs/pypsa-eur/lib/python3.10/site-packages/linopy/solvers.py", line 453, in run_cplex
    m.read(problem_fn)
  File "/home/<user>/software/micromamba_1.4.2/envs/pypsa-eur/lib/python3.10/site-packages/cplex/__init__.py", line 973, in read
    _proc.readcopyprob(self._env._e, self._lp, filename, filetype)
  File "/home/<user>/software/micromamba_1.4.2/envs/pypsa-eur/lib/python3.10/site-packages/cplex/_internal/_procedural.py", line 688, in readcopyprob
    check_status(env, status)
  File "/home/<user>/software/micromamba_1.4.2/envs/pypsa-eur/lib/python3.10/site-packages/cplex/_internal/_procedural.py", line 249, in __call__
    raise CplexSolverError(error_string, env, status)
cplex.exceptions.errors.CplexSolverError: CPLEX Error  1615: Line 14114921: Expected number, found 'i'.

euronion avatar Aug 17 '23 11:08 euronion