Skip to content
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

Having class Status in top-level API would be useful #8

Open
yaccos opened this issue Mar 31, 2022 · 3 comments
Open

Having class Status in top-level API would be useful #8

yaccos opened this issue Mar 31, 2022 · 3 comments

Comments

@yaccos
Copy link

yaccos commented Mar 31, 2022

When I work with solutions generated by reframed, I often have to look into the optimization status. This becomes a little tricky when the status enumeration is hidden deep into the API. Here is an example:

solution = reframed.FBA(model)
if solution.status == reframed.solvers.solution.Status.OPTIMAL:
    print("Problem solved sucessfully"
else:
    print("Something went wrong solving the model")

Instead of writing reframed.solvers.solution.Status.OPTIMAL I would think it would be sufficient to access it with reframed.Status.OPTIMAL.

@ccshao
Copy link

ccshao commented Mar 31, 2022

@yaccos May I ask a rather silly question about solver. How could I make the reframed to the gurobi solver which I have installed and tested?

I have tried the set_default_solver, but it didn't work. However, I have the /gurobi951/linux64/bin in the path. I am using v1.2.1.

from reframed import *
set_default_solver("gurobi")

RuntimeError: Solver gurobi not available.

Thanks!

@yaccos
Copy link
Author

yaccos commented Mar 31, 2022

Have you tried interfacing directly with gurobipy? Try running

from gurobipy import Model
Model()

and see whether you get any error messages. If you get an ImportError, please follow these instructions: https://support.gurobi.com/hc/en-us/articles/360044290292-How-do-I-install-Gurobi-for-Python-

@ccshao
Copy link

ccshao commented Apr 1, 2022

Thanks for the quick updates! I guess you mean from gurobipy import Model ? Yes, grobipy worked.

I just relealized I installed reframed via pip install gurobipy, which gives the latest version of 1.2.1. However, the master branch is ahead of the released version.

After uninsalling old released version and installing the current master, test examples worked smoothly without need of any further configurations. I hope not to run into othe configuration issures in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants