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

Run lcopt from any brightway project #38

Open
haasad opened this issue Jul 21, 2018 · 3 comments
Open

Run lcopt from any brightway project #38

haasad opened this issue Jul 21, 2018 · 3 comments

Comments

@haasad
Copy link
Contributor

haasad commented Jul 21, 2018

Maybe I'm missing something, but now that you made lcopt work nicely with all ecoinvent versions it should be possible to run lcopt from any project. Something along those lines (simplified):

if not search_index:
    write_search_index()
model = LcoptModel('test')
model.launch_interact()

You would probably need a check in the write_search_index-function that there is actually a valid ecoinvent/forwast db in the project. (Several ecoinvent dbs in the same project could also make this a bit more complicated)

If this is possible, it would also help with #37, because you wouldn't need to copy the background db for every model. Instead all models would be stored alongside each other in the same project where they were created. The lcopt_bw2_setup-function and its corresponding LCOPT_Setup-project would then only be required for people without a previous brightway installation.

@pjamesjoyce
Copy link
Owner

Hi @haasad, lcopt writes foreground models in a particular way (it was originally designed to create a specific type of foreground model, brightway integration came later).

There is a way to convert existing brightway projects (saved as bw2package files) into lcopt format - here's the notebook that explains it. The key function is create_LcoptModel_from_BW2Package() - Note: it needs updating to work with ecoinvent versions other than 3.3 cutoff.

In theory you could generate an lcopt model from any brightway project, but it would become a separate thing. I'm guessing you want to use lcopt to view and update existing brightway projects in situ as an extension to the activity browser. This might be possible by adding tags to the existing activities (e.g. the lcopt_type tag).

I'll look into it...

@haasad
Copy link
Contributor Author

haasad commented Aug 3, 2018

As you correctly guessed, this idea comes from trying to improve the compatibility of lcopt and the AB. I think it would be very neat to have the option to launch lcopt in any given project and add a foreground model via the lcopt interface. Importing an existing foreground model to lcopt would be nice to have, but only secondary priority here.

But probably I'm thinking too strongly from the direction of brightway and the AB, I can see that this is not a high priority for lcopt itself.

@cardosan
Copy link

+1 for this
IMO this would start to make the AB/lcopt suite very interesting having both very nice and complementary features.
Typical case: one might need to search and modify a process (for which AB is the way to go) and use this to build his parametrized model (obviously in lcopt).

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

3 participants