Change Solver in API/AMPL/R Interface

89 views
Skip to first unread message

Edwin Okoronkwo

unread,
Feb 11, 2019, 5:08:25 PM2/11/19
to AMPL Modeling Language

Hello,

I am new to using the API/AMPL interface with any of the programming languages and I am trying to go through an example using R. Below is the link:


However, when I try to solve the example problem the system is unable to invoke the MINOS solver, see below. The AMPL program that I have access to has CPLEX solver and not MINOS.
So the question is: Is it possible to change the solver from MINOS to CPLEX in R Studio?
Can you advise on another method to setup CPLEX as the default solver?

library(rAMPL)
ampl <- new(AMPL)

# Interpret the two files
ampl$read("models/diet/diet.mod")
ampl$readData("models/diet/diet.dat")

# Solve
ampl$solve()


Cannot invoke minos: no such program.
Objective is: 0
Increased costs of beef and ham.
Cannot invoke minos: no such program.
New objective value: 0
Updated all costs.
Cannot invoke minos: no such program.
New objective value: 0
  index0 Buy.val
1   BEEF       0
2    CHK       0
3   FISH       0
4    HAM       0
5    MCH       0
6    MTL       0
7    SPG       0
8    TUR       0
  index0 X100.Buy.j...Buy.j..ub.
1   BEEF                       0
2    CHK                       0
3   FISH                       0
4    HAM                       0
5    MCH                       0
6    MTL                       0
7    SPG                       0
8    TUR                       0

AMPL Google Group

unread,
Feb 11, 2019, 6:22:12 PM2/11/19
to Ampl Modeling Language
Dear Edwin,

You can change the solver to cplex with:

ampl$setOption("solver", "cplex")

or, alternatively:

ampl$setOption("solver", "/complete/path/to/cplex")

Best regards,
Filipe

--
Filipe Brandão
am...@googlegroups.com
{#HS:776572284-36147#}
--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ampl+uns...@googlegroups.com.
To post to this group, send email to am...@googlegroups.com.
Visit this group at https://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.



Edwin Okoronkwo

unread,
Feb 11, 2019, 7:08:45 PM2/11/19
to am...@googlegroups.com
Dear Filipe,

Thanks. It's working now...simple answer to a big problem.

image.png

agrecco

unread,
Mar 1, 2021, 8:58:03 AM3/1/21
to am...@googlegroups.com
Dear Edwin

Just for a help to solve this on Matlab
I got the same problem and I solved it writting the follow :
>>
firstExample cplex 'C:\Program Files
(x86)\amplide.mswin64\ampl.mswin64\models'

instead of: firstExample <solver> <modeldir>





--
Sent from: http://ampl.996311.n3.nabble.com/
Reply all
Reply to author
Forward
0 new messages