Solver glpk is installed but not working properly

56 views
Skip to first unread message

Teresa

unread,
May 14, 2020, 3:32:45 AM5/14/20
to COBRA Toolbox
Hi all,

Whenever I try to use the solver glpk, there is an error which says:
>> changeCobraSolver('glpk','LP')
 > changeCobraSolver: Solver glpk is installed but not working properly.
ans =
  logical
   0

Also when I try to do the test with glpk the answer is:
>> glpktest1
LP problem
Undefined function or variable 'glpkcc'.
Error in glpk (line 508)
[xopt, fmin, status, extra] = glpkcc(c, a, b, lb, ub, ctype, vartype, sense, param);
Error in glpktest1 (line 21)
[xmin,fmin,status,extra]=glpk(c,a,b,lb,ub,ctype,vartype,s,param)
 
>> glpktest2
-- Integer problem --
Undefined function or variable 'glpkcc'.
Error in glpk (line 508)
[xopt, fmin, status, extra] = glpkcc(c, a, b, lb, ub, ctype, vartype, sense, param);
Error in glpktest2 (line 12)
[xmin,fmin,status,extra]=glpk(c,a,b,lb,ub,ctype,vartype,s,param)

I already reinstalled the cobratoolbox and tried to solve the problem.
I already tried to install glpkmex in matlab with following script:

>> makeglpkmex
GLPKMEX - A Matlab interface for GLPK. Script installer.
Version 2.7 compatible with GLPK 4.36 (or higher)
(C) 2001-2007, Nicolo' Giorgetti.
Maintained by  Niels Klitogrd
Last updated: Dec 2009.
Do you want to use graphic installer? Y/N [Y]: Y
GLPK path... C:\Program Files\MATLAB\R2019a\toolbox\cobratoolbox-master\cobratoolbox-master\external\base\solvers\glpkmex
Error using dir
Name must be a string scalar or character vector.
Error in makeglpkmex (line 58)
   d=dir(include);
 
I also already tried to install glpk manually, however then the same error occur in matlab.
Can someone give me an advise how to handle this problem?
Thanks for your help.

Regards,
Teresa

Ronan M.T. Fleming

unread,
May 14, 2020, 5:23:46 AM5/14/20
to COBRA Toolbox
Hi,
what is the result of

[solverOK, solverInstalled] = changeCobraSolver('glpk', 'LP', 1, 2)

Regards,

Ronan
> --
>
> ---
> You received this message because you are subscribed to the Google Groups "COBRA Toolbox" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to cobra-toolbo...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/cobra-toolbox/068567d2-93d7-4c94-aebd-9faf83f41830%40googlegroups.com.



--
--
Mr. Ronan MT Fleming B.V.M.S. Dip. Math. Ph.D.
----------------------------------------------------------------------------
Assistant Professor,
Division of Systems Biomedicine and Pharmacology,
Leiden Academic Centre for Drug Research,
Faculty of Science,
Leiden University.
https://www.universiteitleiden.nl/en/staffmembers/ronan-fleming
&
H2020 Project Coordinator,
Systems Medicine of Mitochondrial Parkinson’s Disease,
http://sysmedpd.eu
&
Adjunct Lecturer,
School of Medicine,
National University of Ireland, Galway.
----------------------------------------------------------------------------
Peer-reviewed publications: https://goo.gl/FZPG23
Mobile: +353 873 413 072
Skype: ronan.fleming
----------------------------------------------------------------------------
(This message is confidential and may contain privileged information.
It is intended for the named recipient only. If you receive it in
error please notify me and permanently delete the original message and
any copies.)

Teresa

unread,
May 14, 2020, 5:25:29 AM5/14/20
to COBRA Toolbox

Hi Ronan,

thanks for your answer.
This is the result:

>> [solverOK, solverInstalled] = changeCobraSolver('glpk', 'LP', 1, 2)
 > The solver compatibility is not tested with MATLAB R2019a.
Undefined function 'glpkcc' for input arguments of type 'struct'.
solverOK =
  logical
   0

solverInstalled =
  logical
   1

Ronan M.T. Fleming

unread,
May 14, 2020, 5:34:57 AM5/14/20
to COBRA Toolbox
Hi
somehow it cannot find the path to glpk

>> which glpkcc

should return something like

/fork-cobratoolbox/binary/maci64/bin/glpkcc.mexmaci64

That is for a mac. It is similar for other os. Check the contents of
the binary folder.

Regards,

Ronan
> --
>
> ---
> You received this message because you are subscribed to the Google Groups "COBRA Toolbox" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to cobra-toolbo...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/cobra-toolbox/55113819-b4b2-4339-b125-9c8762c0b586%40googlegroups.com.

Teresa

unread,
May 14, 2020, 5:58:42 AM5/14/20
to COBRA Toolbox
I checked the folder and this folder was empty. That´s why I downloaded this folder again and now it works.
Thank you for your help. I think some folders are empty somehow, this was the same for the folder test and tutorial.

This are now my results:

>> changeCobraSolver('glpk','LP')
 > The solver compatibility is not tested with MATLAB R2019a.
ans =
  logical
   1
>> glpktest1
LP problem
Writing problem data to `SimpleLP.mps'...
24 records were written
Original LP has 3 rows, 3 columns, 9 non-zeros
Presolved LP has 3 rows, 3 columns, 9 non-zeros
Scaling...
 A: min|aij| = 1.000e+000  max|aij| = 1.000e+001  ratio = 1.000e+001
Problem data seem to be well scaled
Constructing initial basis...
Size of triangular part = 3
*     0: obj =  0.000000000e+000  infeas = 0.000e+000 (0)
*     2: obj =  7.333333333e+002  infeas = 0.000e+000 (0)
OPTIMAL SOLUTION FOUND
xmin =
   33.3333
   66.6667
         0

fmin =
  733.3333

status =
     5

extra =
  struct with fields:
      lambda: [3×1 double]
    redcosts: [3×1 double]
        time: 0
      memory: 44.2051
>>



Thank you for your help!!!  
 
Reply all
Reply to author
Forward
0 new messages