coin-or / pulp

A python Linear Programming API
http://coin-or.github.io/pulp/
Other
2.05k stars 381 forks source link

AttributeError: 'str' object has no attribute 'starts_with' in SCIP solver #626

Open TimJentzsch opened 1 year ago

TimJentzsch commented 1 year ago

Details for the issue

What did you do?

Solve a problem with the SCIP_CMD solver, with options=["set presolving emphasis aggressive", "set heuristics emphasis aggressive"].

What did you expect to see?

The options are added as CLI parameters to the SCIP call.

What did you see instead?

    status = solver.actualSolve(self, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/tim/.cache/pypoetry/virtualenvs/optimizer--RycKOkC-py3.11/lib/python3.11/site-packages/pulp/apis/scip_api.py", line 151, in actualSolve
    if option.starts_with("-"):
       ^^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'starts_with'. Did you mean: 'startswith'?

Looks like we just have to replace starts_with with startswith in this line: https://github.com/coin-or/pulp/blob/006753076be18ee857339d333a5db11e599f21a2/pulp/apis/scip_api.py#L151

Useful extra information

The info below often helps, please fill it out if you're able to. :)

What operating system are you using?

I'm using python version:

I installed PuLP via:

Did you also

TimJentzsch commented 1 year ago

Replacing starts_with with startswith indeed seems to fix the problem for me locally.