I want to execute automatic commands through a file in the Gurobi interactive Shell.
I tried the following:
solve.bat
(should do all the work - start gurobi and execute the commands in .cmd
)
@ECHO OFF
cd D:\gurobi651\
run.bat -f PowerLPData.cmd
EXIT
run.bat
(starts Gurobi interactive shell)
cmd.exe /c gurobi.bat
PowerLPData.cmd
(provides the commands to execute)
m = read("PowerLPData.mps")
m.ModelSense = -1
m.update()
m.optimize()
m.write("PowerLPResult.sol")
quit()
My intention is to execute the commands in PowerLPData.cmd
in the interactive shell of gurobi, but this does not work. The interactive shell starts when I run solve.bat
and nothing happens after.
I have done the same princip for CPLEX and it works. CPLEX has an executable CPLEX.exe
instead of run.bat
and a customized .cmd
file.
I think that the Gurobi interactive shell is a python shell, which does not work with .cmd files
, but I couldn't find an answer.
gurobi.bat is a Python interpreter that includes the gurobipy library. To run your Python script using gurobi.bat, rename it to PowerLPData.py, then run gurobi.bat PowerLPData.py
from a Windows shell.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.