
September 20th, 2013, 04:59 AM
#31
Re: help with implementation of Linear programming solver.
Originally Posted by navy1991
If you could alter the Malab code, maybe you can output 3 files, an "Objective function" file, a "Constraints" file, and a "Variable Bounds" file. For example, for the "Variable Bounds" file:
Code:
Name < <= == > >=
Adix x x 0 x x
AdPix x 0 x x 5.495024
AHCYSix x x 0 x x
AMPix x 0 x x 2.197701
...
The first line doesn't go in the file, it is to show you what each column denotes in the input file. The first column is the name of the variable. The <, <=, ==, >, >= are the relevant operations to describing the bounding condition (I used the C++ "==" to denote equal).
So for example, if you take a look at the AdPix variable bounds in your original input file:
Code:
ADPix >= 5.495024
ADPix <= 0
Then the entry in the variable bounds file would be :
Code:
AdPix x 0 x x 5.495024
The above is much easier to parse. Note that the "0" is in the <= column, and the "5.495024" is in the >= column. The "x" means "ignore", noop, i.e. whatever terminology to mean this operation doesn't apply.
This is just an idea. You need to come with a similar scheme for the maximization and constraints part of the file.
Regards,
Paul McKenzie

September 20th, 2013, 06:09 AM
#32
Re: help with implementation of Linear programming solver.
Hello Paul,
I do not have Matlab software suite. It is not open source too. I have 2 ideas:
1. To build a parser by splitting it(the string or line) and by assigning the values as coeffecients , variables, etc as you have mentioned before.. or
2. to use the Java code in this file : http://sourceforge.net/projects/lpso...solve/5.5.2.0/ and call the functions in c++ (so to create a java API in C++)
Which will be easier? I feel the second one will be easier?
Regards,
Naveen.

September 20th, 2013, 06:47 AM
#33
Re: help with implementation of Linear programming solver.
I do not have Matlab software suite.
How, exactly, is this data file produced that you want to parse?
All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

September 20th, 2013, 06:56 AM
#34
Re: help with implementation of Linear programming solver.
Hi 2Kaud,
I want to parse it like the representation shown in this header file:
/*!
\internal
Representation of a LP constraint like:
(c1 * X1) + (c2 * X2) + ... = K
or <= K
or >= K
Where (ci, Xi) are the pairs in "variables" and K the real "constant".
*/
Please have a look at previous posts too : I have described about it
Regards,
Naveen.

September 20th, 2013, 07:30 AM
#35
Re: help with implementation of Linear programming solver.
Yes, I know that you want to parse a data file. I have been following these threads. I asked how this file was produced because in post #28 you say that the file was produced using Matlab code and then in post #32 you say that you don't have Matlab. Is someone producing the data file for you? Have you discussed your parsing requirements with them?
If, as Paul and myself have suggested, you can change the program that produces this data file to produce one in a format more easily parsed, then the task of writing the parser becomes much easier as Paul explained. How is this file produced?
Also, as per posts #25 and #26 have you explored the possibility that a parser for the format of the data file you have may already have been written?
Last edited by 2kaud; September 20th, 2013 at 07:33 AM.
All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

September 20th, 2013, 07:38 AM
#36
Re: help with implementation of Linear programming solver.
Hi 2kaud,
I did not write the code in Matlab. It was written by Jonathan. I am working in a diiferent place but on the same topic : FBA (flux balance analysis) for whole cell model. I am working in a c++ platform to create this FBA solver.
Regards,
Naveen.

September 20th, 2013, 07:46 AM
#37
Re: help with implementation of Linear programming solver.
newmetabolismcopy.zip please have a look at this attachment too. It is better to parse as it has whitespace in between. I retrieved it from one of the file formats posted in that website.
Regards,
Naveen.

September 20th, 2013, 08:04 AM
#38
Re: help with implementation of Linear programming solver.
Originally Posted by navy1991
Hi 2kaud,
I did not write the code in Matlab. It was written by Jonathan. I am working in a diiferent place but on the same topic : FBA (flux balance analysis) for whole cell model. I am working in a c++ platform to create this FBA solver.
Regards,
Naveen.
It would make your job much easier if you could ask Jonathan to amend his Matlab code to produce an output data file similar in format to that suggested by Paul in post #31.
All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

September 20th, 2013, 10:13 AM
#39
Re: help with implementation of Linear programming solver.
Yes, I will ask him. In the mean time, I downloaded another LP solver : http://docs.oracle.com/javase/1.5.0/...nvocation.html .
It has a source code in Java platform. I want to incorporate this into my c++ program. So, do you think incorporating this java lp solver is better? Or should I stick to the previous one and construct a parser with the new file I posted in post 37 Or wait for jonathan to amend his code like paul has mentioned?
Too many choices , Feeling confused .
Regards,
Naveen.

September 20th, 2013, 10:35 AM
#40
Re: help with implementation of Linear programming solver.
Originally Posted by navy1991
That link doesn't link to an LP solver.
Also, if you're looking for a linear programming solver in C++, I would think that it has been done already, with full source code. Do a google search, and I'm sure it has been done.
Regards,
Paul McKenzie

September 20th, 2013, 10:41 AM
#41
Re: help with implementation of Linear programming solver.
Sorry. This was the link which had the LPsolver : http://sourceforge.net/projects/lpso...solve/5.5.2.0/
It has an implementation in many languages except c++.I was trying to use this one because we have an input file in the same format (lpsolve format).
Anyways, I will search for other c++ LP solvers too.
Regards,
Naveen.

September 20th, 2013, 10:52 AM
#42
Re: help with implementation of Linear programming solver.
Originally Posted by navy1991
Sorry. This was the link which had the LPsolver : http://sourceforge.net/projects/lpso...solve/5.5.2.0/
It has an implementation in many languages except c++.I was trying to use this one because we have an input file in the same format (lpsolve format).
Anyways, I will search for other c++ LP solvers too.
Regards,
Naveen.
As that link provides both an .exe and the source in c and you have an input file in the required format, what's the problem in using LPsolver?
All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

September 20th, 2013, 10:54 AM
#43
Re: help with implementation of Linear programming solver.
Finally, I have found one. It is called clp : http://www.coinor.org/download/source/Clp/
It seems to be very detailed . I will try to implement with this one. If I encounter any problem, I will come back.
Regards,
Naveen.

September 20th, 2013, 10:59 AM
#44
Re: help with implementation of Linear programming solver.
Hello 2Kaud,
It works perfectly fine. In fact, I solved my problem and got the result. (around 0.02) . At my place, I am trying to build / include a FBA solver in c++ platform (which will be incorporated into another suit). But, I think that the Clp Solver (post 43 ) will be good . It is implemented in c++.
Posting Permissions
 You may not post new threads
 You may not post replies
 You may not post attachments
 You may not edit your posts

Forum Rules

Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.
Featured
