8000 Vague warning for cbc highs dependency. Cannot have Variable objective · Issue #452 · PyPSA/linopy · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Vague warning for cbc highs dependency. Cannot have Variable objective #452

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 of 2 tasks
RobbieKiwi opened this issue May 1, 2025 · 0 comments · May be fixed by #453
Open
1 of 2 tasks

Vague warning for cbc highs dependency. Cannot have Variable objective #452

RobbieKiwi opened this issue May 1, 2025 · 0 comments · May be fixed by #453
Labels
bug Something isn't working

Comments

@RobbieKiwi
Copy link

Version Checks (indicate both or one)

  • I have confirmed this bug exists on the lastest release of Linopy.

  • I have confirmed this bug exists on the current master branch of Linopy.

Issue Description

If you try to use CBC solver without highspy installed you get a vague "NameError"

If you try to pass a variable to add_objective, it gets caught by the type checker

Reproducible Example

# Example 1
import linopy
model = linopy.Model()
x = model.add_variables(name="x", lower=0.0)
model.add_constraints(x >= 0.0)
model.add_objective(x*1.0, sense="min")
model.solve(solver_name="cbc")  # NameError: name 'highspy' is not defined

# Example 2
import linopy
model = linopy.Model()
x = model.add_variables(name="x", lower=0.0)
model.add_constraints(x >= 0.0)
model.add_objective(x, sense="min")  # ValueError: Invalid type of `expr`

Expected Behavior

I expect to get a useful message to say that highspy should be installed to use cbc
I expect to be able to pass a Variable to the add_objective message

Installed Versions

Bottleneck==1.4.2 click==8.1.8 cloudpickle==3.1.1 colorama==0.4.6 dask==2025.4.1 deprecation==2.1.0 fsspec==2025.3.2 linopy==0.5.3 locket==1.0.0 numexpr==2.10.2 numpy==2.2.5 packaging==25.0 pandas==2.2.3 partd==1.4.2 polars==1.29.0 PuLP==3.1.1 python-dateutil==2.9.0.post0 pytz==2025.2 PyYAML==6.0.2 scipy==1.15.2 six==1.17.0 toolz==1.0.0 tqdm==4.67.1 tzdata==2025.2 xarray==2025.4.0
@RobbieKiwi RobbieKiwi added the bug Something isn't working label May 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
No milestone
Development

Successfully merging a pull request may close this issue.

1 participant
0