pulp icon indicating copy to clipboard operation
pulp copied to clipboard

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

Open TimJentzsch opened this issue 2 years ago • 1 comments

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?

  • [ ] Windows: ( version: ___ )
  • [x] Linux: (Pop!_OS)
  • [ ] Mac OS: ( version: ___ )
  • [ ] Other: ___

I'm using python version:

  • [ ] 2.7
  • [ ] 3.4
  • [ ] 3.5
  • [ ] 3.6
  • [x] Other: 3.11

I installed PuLP via:

  • [ ] pypi (python -m pip install pulp)
  • [ ] github (python -m pip install -U git+https://github.com/coin-or/pulp)
  • [x] Other: Poetry, using GitHub with rev="006753076be18ee857339d333a5db11e599f21a2"

Did you also

  • [x] Tried out the latest github version: https://github.com/coin-or/pulp
  • [x] Searched for an existing similar issue: https://github.com/coin-or/pulp/issues?utf8=%E2%9C%93&q=is%3Aissue%20

TimJentzsch avatar Jan 25 '23 10:01 TimJentzsch

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

TimJentzsch avatar Jan 25 '23 10:01 TimJentzsch