Using CPLEX and ConOpt as default solvers in BARON

770 views
Skip to first unread message

Pradyumn Shukla

unread,
Sep 1, 2015, 2:35:14 PM9/1/15
to AMPL Modeling Language
Dear AMPL members,

does anyone know how to change the defaults solvers in the AMPL Baron solver. I want to use CPLEX as the default LP/MIP solver and CONOPT as the default NLP solver. 

In http://ampl.com/products/solvers/solvers-we-sell/baron/options/ there is an lsolver option... as far as I understand I can use the keyword CONOPT there to change the default NLP solver, is it so? How can I do the same for the LP/MIP solver (to change it to CPLEX).

Thanks and best
Pradyumn

Pradyumn Shukla

unread,
Sep 1, 2015, 3:55:46 PM9/1/15
to am...@googlegroups.com
The general questions is: BARON has so many options that one can see in Section 7 of the user manual http://www.minlp.com/downloads/docs/baron%20manual.pdf , how can I set these using AMPL?

Thanks a ton
Pradyumn

--
You received this message because you are subscribed to a topic in the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ampl/7i99ZhBk4h8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ampl+uns...@googlegroups.com.
To post to this group, send email to am...@googlegroups.com.
Visit this group at http://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.

Robert Fourer

unread,
Sep 3, 2015, 6:23:59 AM9/3/15
to am...@googlegroups.com
Use keyword lsolver in your baron_options string to specify the local nonlinear solver that BARON should use. Unfortunately, due to technical issues, there is currently no way to specify the linear solver that BARON uses.

Bob Fourer
am...@googlegroups.com

=======

Robert Fourer

unread,
Sep 3, 2015, 6:30:08 AM9/3/15
to am...@googlegroups.com
For options given listed in section 7 of the BARON user manual that are not listed at http://ampl.com/products/solvers/solvers-we-sell/baron/options/, you can specify the keyword optfile in your baron_options string to give the name of a file containing additional option specifications:

optfile Name of BARON option file (not required). If given, the file should
contain name-value pairs, one per line, with the name and value
separated by a blank, a colon, or an equal sign, possibly surrounded
by white space. The names and possible values are summarized in
section 7 of the BARON user manual (baron_manual.pdf). Empty lines
and lines that start with # are ignored.

Bob Fourer
am...@googlegroups.com

=======

From: am...@googlegroups.com [mailto:am...@googlegroups.com] On Behalf Of Pradyumn Shukla

Pradyumn Shukla

unread,
Sep 3, 2015, 10:59:06 AM9/3/15
to AMPL Modeling Language, 4...@ampl.com
Thanks Bob, 

I could change the local nonlinear solver using this method. Sad that I cannot use CPLEX though, it is much better than default solvers....

Pradyumn 

Pradyumn Shukla

unread,
Sep 3, 2015, 11:11:58 AM9/3/15
to AMPL Modeling Language, 4...@ampl.com
Thanks again BOB. I Tried using this, and I could use many options, but this way I still cannot change the local nonlinear (or linear) solver!

For example, I created baron.opt file having the content

LPSol = 3

to use CPLEX, but this, after solve statement is overridden. I get

---
ampl: solve;
BARON 15.8.26 (2015.08.26): optfile=baron.opt
LPSol=3
 Supplied value of lpsol is unacceptable
 Setting lpsol to           8  and continuing.
....
----

Again the default lpsol 8 (i.e. CLP solver) is used instead of lpsol 3 CPLEX solver!

I have all the licences and it is annoying that I cannot use CPLEX in Baron!

Best
Pradyumn

Robert Fourer

unread,
Sep 9, 2015, 8:36:40 AM9/9/15
to am...@googlegroups.com
In the AMPL version, the linear solver used by BARON cannot currently be set to a different solver such as CPLEX. As you see, trying to set LPSol = 3 has no effect.

I discovered some problems with the nonlinear solver specification, so I am checking with the technical experts on that.

Pradyumn Shukla

unread,
Sep 9, 2015, 9:42:30 AM9/9/15
to AMPL Modeling Language, 4...@ampl.com
Thanks a lot. As a kind request, could you please also ask the technical experts if CPLEX could be used in BARON as well.

Best regards
Pradyumn

flo...@gmail.com

unread,
Sep 9, 2015, 11:51:17 AM9/9/15
to AMPL Modeling Language, 4...@ampl.com
Any idea if this issue is solvable? (I mean, setting the LPSol).
Thanks

Leonardo Taccari


Il giorno mercoledì 9 settembre 2015 14:36:40 UTC+2, AMPL Optimization ha scritto:
In the AMPL version, the linear solver used by BARON cannot currently be set to a different solver such as CPLEX.  As you see, trying to set LPSol = 3 has no effect.

Robert Fourer

unread,
Sep 14, 2015, 5:57:44 PM9/14/15
to am...@googlegroups.com
There is something about the way BARON is implemented that prevents it from accessing CPLEX and other MIP solvers through AMPL. Thus setting the LPSol option has no effect. This is being discussed with BARON's developers, but I do not have any further information as to the nature of the problem or when it might be fixed.

BARON can access CONOPT, KNITRO, or other local nonlinear solvers through AMPL. This should be requested by adding an option of the form lsolver=... to your baron_options string in AMPL. For instance:

option baron_options 'outlev=1 lsolver=knitro';

There were various changes and bug fixes necessary to make this happen, however, so you should download the latest BARON and local nonlinear solver binaries before trying to use this feature.

Pradyumn Shukla

unread,
Sep 18, 2015, 1:36:48 PM9/18/15
to AMPL Modeling Language, 4...@ampl.com
Thanks! 

It must be an implementation idiosyncrasy then, as in AIMMS and GAMS implementations of BARON one could use the much better solver CPLEX. Hope this matter is addressed in upcoming AMPL release(s). I would be extremely happy.

Best regards
Pradyumn

maziar kermani

unread,
Jan 14, 2017, 3:50:22 AM1/14/17
to AMPL Modeling Language
Hello,

I am wondering if in the new version of BARON that is released recenlty (17.1.2) one can add cplex or it is still not possible.

Thank you,
Maziar

Robert Fourer

unread,
Jan 14, 2017, 12:17:11 PM1/14/17
to am...@googlegroups.com
In your baron_options string, use lsolver for your choice of local nonlinear solver, and lpsolver for your choice of local mixed-integer linear solver. Currently lpsolver=cplex and lpsolver=xpress are recognized, and any lsolver=... (for example, lsolver=conopt) is accepted. You must have the AMPL versions of the specified solvers installed in the same folder or directory as BARON.

Bob Fourer
am...@googlegrouops.com

///////

EXAMPLE using CONOPT and CPLEX with BARON:

BARON 17.1.2 (2017.01.02): lsolver=conopt
lpsolver=cplex
outlev=1
===========================================================================
BARON version 17.1.2. Built: WIN-64 Mon Jan 2 09:49:03 EST 2017

If you use this software, please cite:
Tawarmalani, M. and N. V. Sahinidis, A polyhedral
branch-and-cut approach to global optimization,
Mathematical Programming, 103(2), 225-249, 2005.

BARON is a product of The Optimization Firm, LLC. http://www.minlp.com/
Parts of the BARON software were created at the
University of Illinois at Urbana-Champaign.
===========================================================================
This BARON run may utilize the following subsolver(s)
For LP/MIP: ILOG CPLEX
For NLP: AMPL external NLP, IPOPT, FILTERSD
===========================================================================
Doing local search
Preprocessing found feasible solution with value 365166.879441
Solving bounding LP .......

///////

-----Original Message-----
From: am...@googlegroups.com [mailto:am...@googlegroups.com] On Behalf Of maziar kermani
Sent: Saturday, January 14, 2017 2:50 AM
To: AMPL Modeling Language

maziar kermani

unread,
Jan 16, 2017, 6:36:32 AM1/16/17
to AMPL Modeling Language, 4...@ampl.com
Thank you Bob. 
I was trying to download the new version from our research group's AMPL account to test the options. However there is a problem as I cannot login : "Could not connect to socket /var/licadmin/licadmin_soc." 
I have asked the support team for the solution.

Maziar
Message has been deleted

Robert Fourer

unread,
Jan 17, 2017, 9:59:52 AM1/17/17
to am...@googlegroups.com
Try placing all the relevant files -- ampl.exe and ampl.lic as well as cplex.exe, cplex1270.dll, baron.exe, etc. -- into one folder and then running AMPL from that folder, so that you are not relying on path settings. That works in our tests, and you can use it as a workaround while we investigate whether BARON is not picking up the path settings properly.

Bob Fourer
am...@googlegroups.com

=======

From: am...@googlegroups.com [mailto:am...@googlegroups.com] On Behalf Of AMPL_Midun
Sent: Monday, January 16, 2017 12:17 PM
To: AMPL Modeling Language
Cc: 4...@ampl.com
Subject: Re: [AMPL 13373] Using CPLEX and ConOpt as default solvers in BARON

thank you for your clear answers and constant help! I'm trying to follow your indications regarding lpsolver=cplex as a baron_options but I get the message:

"Library not found for "lpsolver=cplex"; assuming "lpsolver=cbc"."

cplex.exe and cplex1270.dll are in the same folder of baron.exe, as well as my mod, run and dat files. I have added the folder to my Win7 Pro 64 system path.


maziar kermani

unread,
Jan 18, 2017, 4:03:15 AM1/18/17
to AMPL Modeling Language, 4...@ampl.com
Thank you for the response. I tried it however the issue persisted. If I set "lpsolver=xpress" it works fine.
Setting "lpsolver=cplex" and using "cplex1270.dll" will result in the error "Library not found for "lpsolver=cplex"; assuming "lpsolver=cbc"". 
However if I add the previous version of dll "cplex1263.dll" then it will be fine.

Best regards,
Maziar

Robert Fourer

unread,
Jan 18, 2017, 6:48:49 PM1/18/17
to am...@googlegroups.com
Are you using the same cplex.exe with both cplex1263.dll and cplex1270.dll? There is a cplex.exe file for each version of CPLEX, but they are not the same. To see which version of cplex.exe you are running, use the command "cplex -v". If it shows "AMPL/CPLEX 12.6.3.0" then it will only work with cplex1263.dll, and that would explain why you get a "Library not found" error when you try to use cplex1270.dll with it.

Bob Fourer
am...@googlegroups.com

=======

maziar kermani

unread,
Jan 19, 2017, 3:40:13 AM1/19/17
to AMPL Modeling Language, 4...@ampl.com
Hi,

When I use the command "cplex -v" I get the following:
"AMPL/CPLEX 12.7.0.0 (MS cl 16.0 for x86_64), driver(20161221), ASL(20161208)"
In addition to cplex I have added ilogcp as well and the latest version of it uses cplex1263.dll. If I type "ilogcp -v" I get:
"AMPL/IBM ILOG CP Optimizer [IBM ILOG Concert 12.6.3] (MS cl 16.0 for x86_64), driver(20151111), ASL(20151026)"

If I remove the ilogcp completely from ampl folder I get that warning message. However adding it will not prompt the warning.

Maziar

Robert Fourer

unread,
Jan 20, 2017, 11:37:09 AM1/20/17
to am...@googlegroups.com
Next week we will have available version 12.7 of ilogcp.exe which will use the same cplex1270.exe as cplex.exe. Meanwhile if you remove ilogcp.exe and cplex1263.dll from your AMPL folder, so that it contains only cplex.exe version 12.7 and cplex1270.exe, then do you still have trouble running BARON with lpsolver=cplex?

maziar kermani

unread,
Jan 20, 2017, 12:55:22 PM1/20/17
to AMPL Modeling Language, 4...@ampl.com
Hello Bob,

Thank you for the constant help and support. I removed all the files related to ilogcp and still get the same error. However if I add back only the cplec1263.dll it will not show the error anymore.

Robert Fourer

unread,
Jan 23, 2017, 8:47:46 AM1/23/17
to am...@googlegroups.com
We have updated the 64-bit baron.exe executables so that now they will work properly with cplex1270.dll. A similar problem with Linux has also been fixed. (The underlying problem here is that CPLEX 12.7 dropped support for 32-bit versions, so to preserve support for 32-bit BARON we needed to make it work with 32-bit CPLEX 12.6.3 as well as 64-bit CPLEX 12.7.)

maziar kermani

unread,
Jan 23, 2017, 11:43:42 AM1/23/17
to AMPL Modeling Language, 4...@ampl.com
Thank you for follow up. It is now working. I have also added the new ilogcp and now everything is working with cplec1270.dll.

Thanks again,
Maziar

Irene Hsiao

unread,
Jul 23, 2020, 8:56:06 AM7/23/20
to AMPL Modeling Language
Hi,

I got the same question. When I set "lpsolver=cplex", it showed "Library not found for "lpsolver=cplex"; assuming "lpsolver=cbc". (xpress worked fine)
I have cplex.exe and cplex12100.dll in my directory with all other .exe files like baron.exe and ampl.exe.
I also have added the directory path to my environment PATH but it didn't work.

These are the results of the "xxxx -v" command. my license is obtained from the New Graduate Program and it expires next year.
baron.exe
BARON 19.7.13 (2019.07.13) (MS VC++ 10.0, 64-bit), driver(20190908), ASL(20190314)
cplex.exe
AMPL/CPLEX 12.10.0.0 (MS VC++ 10.0, 64-bit), driver(20200412), ASL2(20200404)
ilogcp.exe
AMPL/IBM ILOG CP Optimizer [IBM ILOG Concert 12.10.0] (MS cl 19.0 for x86_64), driver(20190908), ASL(20190605)

Thanks for the assistance.

AMPL Google Group

unread,
Jul 23, 2020, 1:40:58 PM7/23/20
to AMPL Modeling Language
We have not been able to reproduce this error. There is a newer version of BARON (19.12.7) but we tried running with the version you currently have (19.7.13), and these options:

option baron_options 'lsolver=conopt lpsolver=cplex outlev=1';

The output from BARON showed CPLEX being used:

BARON 19.7.13 (2019.07.13): lsolver=conopt
lpsolver=cplex
outlev=1
===========================================================================
 BARON version 19.7.13. Built: WIN-64 Sat Jul 13 12:11:46 EDT 2019
 . . . . . . .
===========================================================================
 This BARON run may utilize the following subsolver(s)
 For LP/MIP/QP: ILOG CPLEX                                      
 For NLP: AMPL external NLP, IPOPT, FILTERSD, FILTERSQP
===========================================================================

The versions of the subsolvers were as follows:


AMPL/CPLEX 12.10.0.0 (MS VC++ 10.0, 64-bit), driver(20200412), ASL2(20200404)
AMPL/CONOPT 3.17A (MS cl 16.0, Intel Fortran 12.1 for x86_64), driver(20180314), ASL2(20180503)

Can you post a screenshot of your AMPL folder listing? Maybe that will suggest some reason for the "library not found" error.


--
Robert Fourer
am...@googlegroups.com
{#HS:1233918983-83761#}

Irene Hsiao

unread,
Jul 23, 2020, 9:15:18 PM7/23/20
to AMPL Modeling Language
Hi Robert,

Thanks for the reply. These are the files under amplide.mswin64.
Annotation 2020-07-23 134705.png

And this is the output I ran the same option as yours.
BARON 19.7.13 (2019.07.13): lsolver=conopt
lpsolver=cplex
outlev=1
Library not found for "lpsolver=cplex"; assuming "lpsolver=cbc".
===========================================================================
 BARON version 19.7.13. Built: WIN-64 Sat Jul 13 12:11:46 EDT 2019
 . . . . . . .
===========================================================================
 This BARON run may utilize the following subsolver(s)
 For LP/MIP/QP: CLP/CBC

 For NLP: AMPL external NLP, IPOPT, FILTERSD, FILTERSQP
===========================================================================


Baron/Cplex/Conopt were already included in the New Graduate Program package. I don't know if this causes the problem.
Should I or am I applicable for updating the version of the solvers?

Thank you.

AMPL Google Group 在 2020年7月23日 星期四上午10:40:58 [UTC-7] 的信中寫道:

AMPL Google Group

unread,
Jul 24, 2020, 9:53:39 AM7/24/20
to AMPL Modeling Language
We should test to see whether the CPLEX in your package is working all at. You could pick a linear model and data from our Example Files page, and then try to solve directly using "option solver cplex;". Reply with whatever output you see from CPLEX, and then I'll refer you to someone who can get you an updated BARON and an updated CPLEX if necessary.


--
Robert Fourer
am...@googlegroups.com
{#HS:1233918983-83761#}
On Thu, Jul 23, 2020 at 5:40 PM UTC, AMPL Google Group <am...@googlegroups.com> wrote:
We have not been able to reproduce this error. There is a newer version of BARON (19.12.7) but we tried running with the version you currently have (19.7.13), and these options:

option baron_options 'lsolver=conopt lpsolver=cplex outlev=1';

The output from BARON showed CPLEX being used:

BARON 19.7.13 (2019.07.13): lsolver=conopt
lpsolver=cplex
outlev=1
===========================================================================
 BARON version 19.7.13. Built: WIN-64 Sat Jul 13 12:11:46 EDT 2019
 . . . . . . .
===========================================================================
 This BARON run may utilize the following subsolver(s)
 For LP/MIP/QP: ILOG CPLEX                                      
 For NLP: AMPL external NLP, IPOPT, FILTERSD, FILTERSQP
===========================================================================

The versions of the subsolvers were as follows:

AMPL/CPLEX 12.10.0.0 (MS VC++ 10.0, 64-bit), driver(20200412), ASL2(20200404)
AMPL/CONOPT 3.17A (MS cl 16.0, Intel Fortran 12.1 for x86_64), driver(20180314), ASL2(20180503)

Can you post a screenshot of your AMPL folder listing? Maybe that will suggest some reason for the "library not found" error.


--
Robert Fourer
am...@googlegroups.com

Irene Hsiao

unread,
Jul 24, 2020, 5:44:36 PM7/24/20
to AMPL Modeling Language
I used diet.mod and diet.dat. It worked just fine when using CPLEX directly and this is the output:
===================================================
CPLEX 12.10.0.0: display 2
No LP presolve or aggregator reductions.
Initializing dual steep norms . . .

Iteration      Dual Objective            In Variable           Out Variable
     1              88.200000                     x5               c3 range
CPLEX 12.10.0.0: optimal solution; objective 88.2
1 dual simplex iterations (0 in phase I)
===================================================

I am quite confused and hope this problem can be fixed. Thank you for your help.

AMPL Google Group 在 2020年7月24日 星期五上午6:53:39 [UTC-7] 的信中寫道:

AMPL Google Group

unread,
Jul 25, 2020, 12:54:09 PM7/25/20
to AMPL Modeling Language
We determined that BARON is failing to look for the CPLEX 12.10 library, cplex12100.dll.

To work around this, download the CPLEX 12.9 package from https://ampl.com/dl/cplex129/cplex.mswin64.20190908.zip. After unzipping this package, move the file cplex1290.dll to the same folder as baron.exe.


--
Robert Fourer
am...@googlegroups.com
{#HS:1233918983-83761#}
On Fri, Jul 24, 2020 at 9:44 PM UTC, AMPL Modeling Language <am...@googlegroups.com> wrote:
I used diet.mod and diet.dat. It worked just fine when using CPLEX directly and this is the output:
===================================================
CPLEX 12.10.0.0: display 2
No LP presolve or aggregator reductions.
Initializing dual steep norms . . .

Iteration Dual Objective In Variable Out Variable
1 88.200000 x5 c3 range
CPLEX 12.10.0.0: optimal solution; objective 88.2
1 dual simplex iterations (0 in phase I)
===================================================

I am quite confused and hope this problem can be fixed. Thank you for your help.

AMPL Google Group 在 2020年7月24日 星期五上午6:53:39 [UTC-7] 的信中寫道:

We should test to see whether the CPLEX in your package is working all at. You could pick a linear model and data from our Example Files page, and then try to solve directly using "option solver cplex;". Reply with whatever output you see from CPLEX, and then I'll refer you to someone who can get you an updated BARON and an updated CPLEX if necessary.

--
Robert Fourer
On Fri, Jul 24, 2020 at 1:53 PM UTC, AMPL Google Group <am...@googlegroups.com> wrote:
We should test to see whether the CPLEX in your package is working all at. You could pick a linear model and data from our Example Files page, and then try to solve directly using "option solver cplex;". Reply with whatever output you see from CPLEX, and then I'll refer you to someone who can get you an updated BARON and an updated CPLEX if necessary.


--
Robert Fourer
am...@googlegroups.com

Irene Hsiao

unread,
Jul 26, 2020, 1:49:55 PM7/26/20
to AMPL Modeling Language
Thank you for your assistance. It's now working normally.

AMPL Google Group 在 2020年7月25日 星期六上午9:54:09 [UTC-7] 的信中寫道:
Reply all
Reply to author
Forward
0 new messages