chenglong0931
chenglong0931

Reputation: 33

How to connect cplex and pyomo?

opt = SolverFactory('cplex', executable="/Applications/CPLEX_Studio_Community129/cplex/bin/x86-64_osx/cplex")

If using the executable option (as above), it works. If not, we get the following error:

ApplicationError: No executable found for solver 'cplex'

Upvotes: 2

Views: 4343

Answers (2)

user17068386
user17068386

Reputation:

Try this

SolverFactory('cplex_direct')

Upvotes: 4

rkersh
rkersh

Reputation: 4465

If you don't want to specify the path with the executable option, you need to add the following directory to your PATH environment variable:

/Applications/CPLEX_Studio_Community129/cplex/bin/x86-64_osx

For example, you can do this from the command line, like so:

export PATH=$PATH:/Applications/CPLEX_Studio_Community129/cplex/bin/x86-64_osx

If that works, then you can make this permanent by adding it to your ~/.bash_profile using the technique described here

Upvotes: 2

Related Questions