GLOP: read .mps - or-tools

I have an LP in a .mps, and I'm testing it on top solvers. Usually, there's a command line supplied, which can can do:
read model.mps
optimize
GLOP doesn't have a command line, but it supports python. What's a minimal script to do that?
Maybe on the way suggest how to try other supported solvers such as PDLP and CLP?
Relatedly, maybe a hint about a specific feature that I'm looking for if it's supported:
Specify an initial solution, and use the solver for a limited time to find a better feasible solution
https://math.stackexchange.com/questions/4510587/find-a-feasible-but-not-optimal-solution-to-a-large-lp

There is a binary called solve in ortools/examples/cpp
solve --solver glop --input file.mps

Related

EES to Matlab, proces only completes when closing EES manually

I'm currently doing some combustion engine analysis which has lead me to try and pass some specific heats from EES to matlab, by using EES-macros (.emf files) to generate the properties. This works great for simple tasks where the properties are just assigned to variables in the macros which is then exported and read by Matlab.
Now, I'm interested in getting the properties of products in chemical equilibrium calculations, so I need to solve coupled equations in EES. This poses a problem since you can't have unassigned stuff on the right hand side in EES-macros.
The above problem was quickly solved simply by solving the equations for the equilibrium composition in a reguler .ees-file and then exporting the results. But this has led to another problem:
Once I call my Matlab-script the procedure starts "hanging" just before the specific heats are returned. I've found that the script completes once you manually close the now-opened EES-window, but this is not viable since i need to make several hundreds of imports.
The problem doesn't occur when using EES-macros instead of files, since in these you can simply use the Quit statement in the end, but as mentioned macros are not an option for this. Does anyone know of an equivalent statement that you can use in an EES-FILE? I've also tried to shut down EES with a system-command in my script: system('taskkill /F /IM EES.EXE');. But this doesn't seem to be able to find the EES-task, although it appears in the task manager and in the taskbar (the statement is tested, it works if you open EES manually).
Any help is very much appreciated, thanks in advance!
Regards
You can use a macro file to solve the EES file and then quit the program.
Example.emf contains:
Open C:\Example.ees
Solve
Quit
And then the MATLAB system call
system('$EESPath\ees.exe C:\Example.emf');
will do the job.
You will need to leverage the $Export directive to place the results into an external file that MATLAB can then import.

Is it possible to figure out which if statements are being fufilled in matlab

I have a lot of if statements throughout my code and was wondering if there is anyway in Matlab to see which if statements are being used when I run my code. I know I could put variables throughout my code and see which ones are being triggered, but I was wondering if there is an easier way. Maybe a built in MATLAB function or something.
Thanks
Type profile viewer in the command line of matlab and execute your code from there. There you can see in the profile report how many times each line is called as well as how long it takes executing the line of code.
More information:
http://www.mathworks.nl/help/matlab/ref/profile.html
http://www.mathworks.nl/help/matlab/matlab_prog/profiling-for-improving-performance.html
To answer precesely to your question, there is a command to log every line the execution is going through. And if you're familiar with unix-like platform, it is the same command: echo. See the Matlab help of echo to see how you can use it. For example, echo on all sets echoing on for all function files.
Besides that, I advise you two things better than analysing the output of echoing a whole script:
look at every warning in the code editor, and apply meaningful corrections.
use the profiler of matlab, as stated in the answer from EJG89, it is indeed a powerful tool!

How to open a file using matlab and change something in it automatically?

I need to open a software and give it a value and then execute it to obtain some results
but the problem is that I have many values and each time I put a value manually which is very time consuming. Is there a way to do this automatically with MATLAB?
First of all: your question title and your actual question are quite different. I'm going to give you ideas to answer your question, not your question title.
you need to find out, whether you can run your software in batch mode. That means, you need to be able to control the software from the command-line.
Once you know that, you can use the system command of matlab to run the cmd from your script.
for example:
system( 'mySoftware.exe' -myIndividualParameters )
If it's not possible to pass parameters to your software, it may can read text files, which you can create with matlab before.
Anyway, your question is specifying absolutely nothing. You have to give a lot more information: how is your software obtaining parameters? you can it be started? Which format do the parameters need? Do you want matlab to do something with results of your software?

would it be worth it to use inline::C to speed up math

i have been working on a perl program to process large amounts of dna. It outputs exactly what i need however it takes much longer than i would like using NYTprof i have narrowed down the major problem areas to be the loop that adds my values together. would using inline::C to do the math make my program faster or should i accept the speed and move on? is there another way to improve the speed? here is my program and an input it would run as well as an executable with the default values entered already.
It's unlikely you'll get useful help here (this included). I can see various problems with your code, and none have to do with the choice of language.
use CPAN. If you're parsing genbank, then use some an appropriate module.
You're writing assembly in Perl, and neither Perl nor you are very good at that. It's near impossible to know what's going on when you don't pass parameters to subroutines, instead relying on globals all over the place. What do #X1, #X2, #Y1, #Y2 mean?
The following might be your problem: until ($ender - $starter > $tlength) { (line 153). According to your test case, these start by being 103, 1, and 200, and it's not clear when or if they change. Depending on what's in #te, it might or might not ever get out of the loop; I just can't tell from your code.
It would help if we knew, exactly, what are the parameters to add, the in-out invariants, and what it is returning.
That's all I got.
I second the recommendation of PDL made in a comment, if it's applicable. Or the use of a CPAN module tailored to your problem (again, if applicable).
I didn't see anything that looked unambiguously like "the loop that adds my values together" in that code; please, show just the code you are considering optimizing, ideally with just enough structure around it to actually run it.
So to answer your generic question generically, yes, Inline::C can be a useful tool for optimization if you are certain your performance problem is limited to what it actually can do for you. In using it, be aware that invoking your C code from Perl or vice versa is non-trivially expensive, so you have to have enough code translated to C to minimize the transitions.

autoconf alternative to AC_TRY_EVAL macro?

I am using the AC_TRY_EVAL macro in a configure.ac. However, http://www.mail-archive.com/autoconf#gnu.org/msg17799.html says that this is discouraged for several reasons.
So, I was wondering if there is an alternative, recommended macro for this?
I don't want to simply call the bash's eval-command as I like the logging performed by AC_TRY_EVAL in config.log. It helps trace down possible issues.
Any suggestions please?
Best,
Shadow