cplexProblem.Param.paramdisplay.Cur = cobraParams.printLevel~=0;
with
cplexProblem.Param.paramdisplay.Cur
= cobraParams.printLevel;
solved the problem.
Hope that helps
Thomas
Hi Ronan,
Only the second statement
cplexProblem.Param.paramdisplay.Cur = double(cobraParams.printLevel~=0);
works.
Interestingly, my suggested correction works for all allowed values of printLevel. I think this is because of the convention that an 'if statement' is true for a non-zero numerical.
It seems that IBM CPLEX does not like logical variables as generated by the original statement and the first suggested in the below message 😲 Both cause CPLEX Error 1003: Bad argument to Callable Library routine. At least, it does not work in Matlab 2019a.
Regards
Thomas
-----Ursprüngliche Nachricht-----
Von: cobra-...@googlegroups.com <cobra-...@googlegroups.com> Im Auftrag von Ronan M.T. Fleming
Gesendet: Mittwoch, 17. Februar 2021 02:11
An: COBRA Toolbox <cobra-...@googlegroups.com>
Betreff: Re: Unable to get CBT to see IBM CPLEX
You received this message because you are subscribed to a topic in the Google Groups "COBRA Toolbox" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cobra-toolbox/O0Cp_mLjURc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cobra-toolbo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cobra-toolbox/CAOivGYtGreD1hP1n_bcycPNqywYRr3rngHHNJu%3DzaRGTbRmeWA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cobra-toolbox/001601d7053c%24671d0250%24355706f0%24%40googlemail.com.
Hi Ronan,
We actually prefer Gurobi over CPLEX but lso do some studies that require CPLEX. Thus, I have installed both Gurobi and CPLEX.
We are running the toolbox on an application server hosting several Matlab versions. The behaviour to write a pathdef.m into the home directory has caused some confusion with my colleagues as it renders other Matlab versions non-functional. A simple solution is to move this pathdef.m into dedicated directory and start Matlab from there every time the CobraToolbox shall be used. Could one add the CobraToolbox paths to startup.m and load them during the Matlab start?
Kind regards
Thomas
To view this discussion on the web visit https://groups.google.com/d/msgid/cobra-toolbox/CAOivGYs%2B2J1_Dbf6Wd%3DwvPHHx7_Ey9anC0SJqazJxdy25TcLig%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cobra-toolbox/006a01d706de%24a955d540%24fc017fc0%24%40googlemail.com.
Hi Ronan,
Interestingly, Matlab advices against saving the search path in a personal pathdef.m. The reason beeing that the Matlab default paths have changed between different versions and a personal pathdef.m overwrites it (with a wrong path with a wrong path depending on the version). Thus, I do not deploy pathdef.m individually for every user due to the different Matlab version in use. Personal additions to the search path can be defined in a variable MATLABPATH, in .bashrc or .profile whatever is suitable, and are added to the default path during the start. Alternatively, a personal startup.m could be used to add folders to the Matlab path.
Then, multi-user access works perfectly fine. First, the version specific default path is loaded, and personal folders are added on top.
Thus, my current strategy is to have a dedicated folder for GSM work which contains a pathdef.m and Matlab should be started in this folder only when CobraToolbox is used. I leave it to those guys who use CoraToolbox to create the folder structure. I guess they can save the pathdef.m in that folder before they run initCobraToolbox.
Having it in startup.m would avoid having a pathdef.m lying around with the potential to mess with Matlab. What I do not know is if one can edit startup.m via script, but at the end of the day it is a text file. Just an idea
Have a nice weekend
To view this discussion on the web visit https://groups.google.com/d/msgid/cobra-toolbox/CAOivGYsULn97j8Y2w-iwcDhG_OfusribTiCpqR1v4g5H%2B3BGOA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cobra-toolbox/013401d70701%24e2a25490%24a7e6fdb0%24%40googlemail.com.
Hi Ronan,
Yes, I give it a try.
Regards
To view this discussion on the web visit https://groups.google.com/d/msgid/cobra-toolbox/CAOivGYtuu53xY0DZrqTts3nQuqZXYt_zrXsExfZKt7yrmELrww%40mail.gmail.com.
Hi Nina,
According to the configuration report you are using MATLAB 2020b. As far as I am aware IBM CPLEX 12.8 is not compatible with this MATLAB version. To my knowledge, the latest supported MATLAB version is MATLAB 2019a. That is the one I am using with Cobra Toolbox. I think I have tried MATLAB 2019b once and it failed with IBM CPLEX 12.8. Newer MATLAB version should be compatible with IBM CPLEX 12.10, but I think this is not supported by Cobra Toolbox. Thus, you may have to downgrade your MATLAB version to at least 2019a. However, you can have multiple MATLAB versions installed alongside each other. In the latter case, copy the created pathdef.m into a dedicated folder you start your session from when using Cobra Toolbox and a supported MATLAB version.
Should you still experience the problem that the solver is not recognised, run the following command:
changeCobraSolver(‘ibm_cplex’,’LP’,1,-1)
Likely, it throws an error somewhen during execution which helps to trace the origin of the problem. Basically, I followed the trail of error messages to its point of origin. I think the very first message in the list indicates the function and the line therein which causes the trouble. The subsequent messages deal with the function(s) calling the troubled function. Send me a screenshot if you need help to pinpoint the origin of the error. Then, I can try to help with that.
In my case back in March, the error occurred in function setCplexParametersForProblem in line 26, but I think that should be resolved in the latest branch of Cobra Toolbox.
Hope that helps
To view this discussion on the web visit https://groups.google.com/d/msgid/cobra-toolbox/9bd6bc2d-cdfa-47f1-bd89-6e0867ce8019n%40googlegroups.com.