|Subject:||Re: [Help-glpk] Import data from Matlab variables to GLPK/GMPL|
|Date:||Sun, 29 Dec 2013 10:39:06 -1000|
Hello Jeff,Thanks for your email. I am using windows and Matlab 2013. GLPKMex requires GLPK installation through http://en.wikibooks.org/wiki/GLPK/Windows. I was able to install GLPK through windows executables (http://en.wikibooks.org/wiki/GLPK/Windows_executables) but could not install GLPK through http://en.wikibooks.org/wiki/GLPK/Windows. GLPKMex is asking for glpk.h and libglpk.a file and I think that I can only get them from GLPK Windows batch file based installation.Although, my current description will deviate from the subject topic, I will describe the steps that I performed in GLPK installation.1. I downloaded and installed all packages that are described in http://en.wikibooks.org/wiki/GLPK/Windows (Visual C++, Windows SDK, Visual Studio 2010, Visual C++ 2010 Service Pack).2, I downloaded glpk-4.48 from http://ftp.gnu.org/gnu/glpk/.3. I go to the /glpk-4.48/w64/ folder and run 'Build_GLPK_with_VC10_DLL' as an administrator and it shows me the following message:"The specified configuration type is missing. The tools for the configuration might not be installed" !!4. I tried "CALL "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64" in my cmd. But it did not create the vcvars64.bat file in C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\ directory. I don't know why this might be happening :S.5. Someone of this forum suggested me to generated vcvars64.bat file by notepad. But I don't know what I should put there. I see vcvarsall.bat file in my C:/Program Files/Visual Studio 10.0/vc/ subfolder directory but I don't know how I can change the contents to create vcvars64.bat file.My current option is to uninstall all packages of http://en.wikibooks.org/wiki/GLPK/Windows (Visual C++, Windows SDK, Visual Studio 2010, Visual C++ 2010 Service Pack) and install them again. I wanted to check with you if I missed any step before I went through that route.Any feedback regarding this installation will be really helpful. At present, I don't have much clue why this is happening.Thanks,NazmulOn Sun, Dec 29, 2013 at 11:25 AM, Jeffrey Kantor <address@hidden> wrote:
I may not be understanding your intended use. If the problem has already been reduced to canonical form with A, b, c, lb, and ub as Matlab matrices, then there is little value to introducing a modeling layer. You could just call a glpk through glpkmex (see http://en.wikibooks.org/wiki/GLPK/Matlab) and avoid the overhead of converting your data to a text format, building the model, and reading the results.If you do wish to use a modeling language, such as Mathprog, then you might consider using AWK to manipulate and generate instances of data inputs to your model. But from your note, it sounds like you've already got that worked out in Matlab.Also, if you have access to it, you may want to look into the prerelease of Matlab 2014a.Jeff
On Saturday, December 28, 2013, Nazmul Islam wrote:Hello Reg (& others),Thanks a lot for your email.As a fast step, I want to solve a mixed integer linear program like followsmin c'xs.t. Ax <= b,lb <= x <= ubSome variables of x are binary ones.I have generated A, b, c, lb, ub in Matlab and stored them in .mat format. I have to convert them to GMPL readable format so that I can solve this code using GLPK. I have attached a sample of those files with my email. I will really appreciate if you could tell me how I can convert them using AWK. Please let me know if you want me to send a .mat file with smaller size.Your help will be very appreciated.Thanks,NazmulOn Fri, Dec 27, 2013 at 3:30 PM, Reginald Beardsley <address@hidden> wrote:
I suggest you consider using awk to generate data files in GMPL format from ASCII text (.txt) files if you have very many instances to solve. You put the problem formulation in one file and the data for each instance in another file and execute "gplsol -m model.dat -d data.dat". I've found this works very well solving large numbers of problem instances. In particular, it makes changing the model very simple. I can't find out anything about the Guesk editor so I can't comment on setting up GMPL notation data files using that.
I tried using the CSV import facility in GMPL, but found it not very convenient because of restrictions on the CSV format glpk accepts.
There is a MATLAB binding for GLPK, but I don't know how usable it is. The MATLAB clone, Octave, also has a built-in binding to GLPK.
There is a Gnu implementation of awk, gawk, which is standard on Linux systems. It's also available on Windows.
If you need help with writing an awk script to convert the MATLAB .txt files to GMPL notation send me a small example of the MATLAB .txt file and I'll add an example to the GLPK wiki.
You'll need to figure out how to write a basic GMPL problem first. A good place to look is in the examples directory at cf12a.mod which implements an L1 line fit. I solve physics inverse problems by basis pursuit using GMPL notation so I can probably offer some help. I do problems with 30,000 columns by 50-300 rows. The resulting files are huge, so you want to get everything working using a small example before doing something that large. I did some little 10x10 problems to figure out how to set it up.
On Thu, 12/26/13, Nazmul Islam <address@hidden> wrote:
Subject: [Help-glpk] Import data fr
|[Prev in Thread]||Current Thread||[Next in Thread]|