Accessing GCG from Pyomo package

122 views
Skip to first unread message

Abbas Omidi

unread,
Aug 21, 2023, 8:17:44 AM8/21/23
to Pyomo Forum
Dear support team,

I tried to use SCIP and also GCG on Pyomo in Colab to solve mixed integer programming problems. By SCIP it runs without any issue, but GCG seems cannot be reached by the Pyomo package. 

I sent some sort of emails to GCG developers and they provide this link to use GCG by GCG-AMPL driver that works on the local machine. 

I was wondering if you can update the Pyomo package on Colab to reach this solver directly as same as SCIP.


I am looking forward to hearing from you
Best regards
Abbas

Abbas Omidi

unread,
Oct 4, 2023, 1:25:37 AM10/4/23
to Pyomo Forum
Dear support team,

Would you please, do you add GCG solver into the Pyomo package to reach out from Colab?


Best regards
Abbas

Siirola, John

unread,
Oct 4, 2023, 3:31:21 AM10/4/23
to pyomo...@googlegroups.com

Abbas,

 

The Pyomo development team only maintains Pyomo packages on PyPI and conda-forge.  We do not maintain or distribute anything specifically for Colab. 

 

Additionally, we do not distribute *any* solvers as part of Pyomo (other than the solvers that are explicitly developed within the Pyomo project [e.g., PyROS, MindtPy]).  The solvers that Pyomo calls are all developed by other projects or companies, and they each manage their own distribution channels under their own licensing.

 

You might be able to leverage amplpy to manage the download / installation of gcg with something like (derived from AMPL’s Quick Start notebook):

 

                %pip install amplpy

 

      from amplpy import ampl_notebook

      ampl_notebook(modules=["gcg"], license_uuid="default")

 

Best regards,

John

--
You received this message because you are subscribed to the Google Groups "Pyomo Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyomo-forum/f7afd288-69ae-423d-a02e-be5d6981f8b0n%40googlegroups.com.

Abbas Omidi

unread,
Oct 4, 2023, 7:55:26 AM10/4/23
to Pyomo Forum
Dear John,

Many thanks for your reply. 
I am unsure of fully understanding what you proposed in the last paragraph. As however I am not an AMPL user. Please, let me say what I do with SCIP + Pyomo in which may be very similar to GCG. 

1) I have installed SCIP as recommended by its developers (GCG has also the same procedure). 
2) Installing the Pyomo package based on its documentation. 
3) Writing the model I have.
4) calling the SCIP by : SolverFactory('scip').solve(m, tee= True).write()

By the above procedure, the package and the solver work well without throwing an error. Now, when I install the GCG and call the above method, it seems to call the solver, the Pyomo needs something like a wrapper to do this, but as it cannot find that it gets back an error. As I said, I sent some sort of emails to GCG developers and they provide the following attached files.

In one of the emails that they answered me:

I have attached 2 files (my e-mail application doesn't allow me to send .py files, so I zipped the files):
Put GCGAMPL.py in the directory pyomo/pyomo/solvers/plugins/solvers
To  the file pyomo/pyomo/solvers/plugins/solvers/__init__.py add the statement import pyomo.solvers.plugins.solvers.GCGAMPL

gcgampl is a GCG-AMPL-driver. It is needed because GCG itself can't handle .nl and .sol files. The gcgampl file I attached is for Linux, if you are using a different system please let me know. Just put it there, where your other solvers are installed. For me mydirectory/miniconda3/bin works, but other locations should be fine too.
Please note that the name of this file might change in the future. Now you should be able to call SolverFactory('gcg') in pyomo.


As I am a Windows user and I have frequently run the model in Colab, they provide the link I have added in my first email. As I am not sure how can I add these files in Colab, I was wondering if, is it possible to use GCG + Pyomo in the Colab by these files?


Best regards
Abbas 
pyomo_gcg.zip
GCGAMPL.py
Reply all
Reply to author
Forward
0 new messages