segrelab / cometspy

Python interface for running COMETS simulations and analyzing the results
GNU General Public License v3.0
11 stars 9 forks source link

Change optimizer from Gurobi to GLPK #45

Closed weeklymessage closed 7 months ago

weeklymessage commented 10 months ago

Thank you for managing wonderful tools.

I have one question about changing optimizer.

In the nature protocol paper and documentation page (https://segrelab.github.io/cometspy/cometspy.html#cometspy-model-module), changing optimizer from Gurobi to GLPK seems to be possible, but I cannot find how to do this.

Could you update regarding documentation regarding to it?

Thanks.

jeremymchacon commented 10 months ago

You are welcome!

To change the optimizer to GLPK, it can be set within each model object:

comets_model = comets.model(cobra_model)
comets_model.optimizer = "GLPK"

However, not all of COMETS functionality works with GLPK. Basic dFBA should work fine however. (@dukovski , it might be useful to have a list of GLPK-usable and not-usable modules somewhere.)

As a total aside, when I got the email with your message, I wondered if "weeklymessage" meant that GitHub was starting to send me digests or something. Ha! Nice username!

dukovski commented 10 months ago

Thanks! Just a note, we'd like to retire glpk, and move on to glop from ORTools. Please be patient, I will release it in January. Unless you need it ASAP, in that case let me know and I can ship it to you. Cheers.

weeklymessage commented 10 months ago

Thank you @jeremymchacon and @dukovski for very rapid reply!!

If you planed to replace open-source optimizer from GLPK to GLOP until Jan. , I can wait. Please take your time.

When the new version is released, it would be helpful if documentation include how to change optimizer and limitation of the tool's function under different optimizer, as @jeremymchacon metioned.

Thanks to your team for managing this wonderful tools again and I'm looking forward to the new version of cometspy in Jan.!!

p.s. @jeremymchacon I'm very happy for my username to give you fun haha

weeklymessage commented 7 months ago

Dear @jeremymchacon and @dukovski, Thank you for managing valuable tool for scientific community.

I am waiting for release of COMETSpy with ORTools, instead of GLPK. In previous, I was happy to hear that COMETSpy with ORTools would be released in Jan.

Can I get to know the release date or are there any ways to use it?

Thank you for managing wonderful tool again..! :)

dukovski commented 7 months ago

Can I get to know the release date or are there any ways to use it?

We have the branch comet_glop here already available. You can actually try it and test it. We have not released it yet, because we need to test it thoroughly first.

To run it, you need to install OR-tools, and set the java classpath to the .jar files. Here's how I have it on our cluster, you should customize the path to wherever you will install OR-tools: SCRIPT=$1 VERSION=comets_glop java -classpath /projectnb/cometsfba/comets_glop/or-tools/9.4.1874/ortools-java-9.4.1874-javadoc.jar:/projectnb/cometsfba/comets_glop/or-tools/9.4.1874/ortools-java-9.4.1874-sources.jar: -Djava.library.path=/projectnb/cometsfba/or-tools/9.4.1874/:/projectnb/cometsfba/or-tools/9.4.1874: edu.bu.segrelab.comets.Comets -loader edu.bu.segrelab.comets.fba.FBACometsLoader -script $SCRIPT

Let me know if you have any questions. I will try to finish all this, update cometspy and release it properly next week or so.

weeklymessage commented 7 months ago

Thank you for your reply! I will try :)

zoey-rw commented 5 months ago

@dukovski, I'd like to test Glop as a replacement for Gurobi! (because I sometimes get errors with the availability of Gurobi floating tokens. Hoping Glop will allow me to run processes simultaneously.)

After running:

SCRIPT=$1
VERSION=comets_glop
java -classpath /projectnb/cometsfba/comets_glop/or-tools/9.4.1874/ortools-java-9.4.1874-javadoc.jar:/projectnb/cometsfba/comets_glop/or-tools/9.4.1874/ortools-java-9.4.1874-sources.jar -Djava.library.path=/projectnb/cometsfba/or-tools/9.4.1874/:/projectnb/cometsfba/or-tools/9.4.1874: edu.bu.segrelab.comets.Comets -loader edu.bu.segrelab.comets.fba.FBACometsLoader -script $SCRIPT

I'm getting the following error: Error: Could not find or load main class edu.bu.segrelab.comets.Comets

Do I need to install ortools-python? (I did, just in case). These are my environment variables:

JAVA_HOME=/share/pkg.7/java/12.0.1/install
#COMETS_HOME=/projectnb2/talbot-lab-data/zrwerbin/interactions/comets_2.10.5_linux
COMETS_HOME=/projectnb/cometsfba/comets_glop #Is this correct?

I assume the cometspy model.optimizer value will need to change as well?

zoey-rw commented 5 months ago

Hi @dukovski, do you have a timeline on pushing the Glop updates to cometspy?

dukovski commented 5 months ago

It should be working now, but I haven't tested it yet. I will take a look next week. What you tried above should work. The error is not about glop, but a wrong path to comets. let me take a look.