Gurobi mex

192 views
Skip to first unread message

Josh Quarterman

unread,
Sep 28, 2011, 12:05:34 PM9/28/11
to Gurobi Optimization
Hi,

I am a grad student and I am trying to use gurobi in MATLAB for the
first time for solving a MILP. I had no problem downloading gurobi
4.5.2 and getting the academic license. However, I have had a much
harder time with the gurobi_mex. After downloading gurobi_mex, I
attempted to call mex in MATLAB with the following:

mex -O -largeArrayDims -I"C:\gurobi452\win64\include" "C:
\gurobi_mex_v1.55\gurobi_mex.c" "C:\gurobi452\win64\lib\gurobi45.lib"

MATLAB outputs the following error:

C:\PROGRA~2\MATLAB\R2009B\BIN\MEX.PL: Error: Link of
'gurobi_mex.mexw32' failed.

??? Error using ==> mex at 221
Unable to complete successfully.

Does anyone have any suggestions for how to fix this problem? I have
been trying to carefully follow the instructions at:
http://www.convexoptimization.com/wikimization/index.php/Gurobi_Mex:_A_MATLAB_interface_for_Gurobi

Thanks,
Josh

Wotao Yin

unread,
Sep 28, 2011, 12:18:20 PM9/28/11
to Gurobi Optimization
Josh,

It seems your system is a 32-bit windows, so I suggest you try without
"-largeArrayDims". Also, you are missing "libut.lib" when calling mex.

Wotao
> been trying to carefully follow the instructions at:http://www.convexoptimization.com/wikimization/index.php/Gurobi_Mex:_...
>
> Thanks,
> Josh

Wotao Yin

unread,
Sep 28, 2011, 12:24:10 PM9/28/11
to Gurobi Optimization
Also, you should change win64 to win32 in your mex options.

On Sep 28, 11:05 am, Josh Quarterman <joshquarter...@gmail.com> wrote:
> been trying to carefully follow the instructions at:http://www.convexoptimization.com/wikimization/index.php/Gurobi_Mex:_...
>
> Thanks,
> Josh

Josh Quarterman

unread,
Sep 28, 2011, 12:32:59 PM9/28/11
to Gurobi Optimization
Actually, it is a 64 bit Windows. I downloaded the libut.lib file and
tried to call mex again as follows:

mex -O -largeArrayDims -I"C:\gurobi452\win64\include" "C:
\gurobi_mex_v1.55\gurobi_mex.c" "C:\gurobi452\win64\lib\gurobi45.lib"

I got the same error as before.

Could it be a problem with the compiler? I downloaded the Visual C++
Express 2010 but the compiler wasn't automatically recognized by
MATLAb. I chose Microsoft Visual C++ 2008 express in the choices of
compilers since the 2010 is not an option and input the location. It
seemed that the compiler was installed properly but how can I check?

Thanks again,

Josh

Josh Quarterman

unread,
Sep 28, 2011, 12:37:18 PM9/28/11
to Gurobi Optimization
In the previous post I meant that I called the following (with
libut.lib):

mex -O -largeArrayDims -I"C:\gurobi452\win64\include" "C:
\gurobi_mex_v1.55\gurobi_mex.c" "C:\gurobi452\win64\lib\gurobi45.lib"
"C:\Program Files (x86)\MATLAB\R2009b\extern\lib\win64\microsoft
\libut.lib"

Wotao Yin

unread,
Sep 28, 2011, 12:47:57 PM9/28/11
to Gurobi Optimization
Josh,

MSVC is probably not the problem.

Is your matlab also a 64-bit version? In your first email, I saw your
matlab attempted to generate a mexw32 file. So, i thought you were
using a 32-bit system. I did not know how to deal with mixed 32-bit
and 64-bit.

I have a mexw64 on my laptop compiled with gurobi 451 and for 64-bit
both windows and matlab. It probably won't run unless you have 451
instead of 452. But if you're interested, i can send you a copy.

Wotao

Josh Quarterman

unread,
Sep 28, 2011, 1:03:34 PM9/28/11
to Gurobi Optimization
Yes, I think that is the problem. I just not realized that I have 64
bit windows and 32 bit MATLAB. Yes, please send me the mexw64 file
and I will try that. I can download the previous version of gurobi if
I have to. I don't think I will need to get a new license for that
will I? could I use gurobi 4.0.2 also?

Josh

LS

unread,
Apr 13, 2015, 5:50:20 PM4/13/15
to gur...@googlegroups.com, joshqua...@gmail.com
Hi Everyone!
I also posted this on the Gurobi mex installation discussion but I am desperate! I am having trouble getting gurobi_mex to work with older versions of gurobi specifically v5.0.2.  Because you cannot directly install a license for this version you have to first install v6.03 and then download the license for this version and then install a lower version of gurobi (again in my case v5.0.2)  However when I try and run gurobi_mex with the v5.0.2 I get the following error:
Error using gurobi_mex
Error: could not create environment. Please make sure that GUROBI has a license and been validated.

Does anyone have any ideas on how to fix this. 

Thanks for any help!
Reply all
Reply to author
Forward
0 new messages