gams solve lst file is too large to be opened - gams-math

The model size of my GAMS model is too large. It can be solved, but the solve.lst file is too large to be opened. I need open it to check some results. Are there anyone meet this problems before? Please give me some ideas/hints to fix it.Thanks.

if your model text is very large you can use
$Offlisting
to surpress most outputs.
$Offsymlist
will get rid of symbol listing.
$Offinclude
will prevent include file printing.
Sometimes the number of equations explicitly printed is set too high (esp. when chaining multiple solve statements with loops etc). You can set the number of listed equations per block to zero with this option:
option limrow=0;
Similarly
option limcol=0;
will set the number of variables explicitly displayed in the listing to zero.

Related

can not get a same solution from SNOPT when I try to solve a Nonlinear Program in Drake with a same initial guess

I am trying to solve a nonlinear program with Direct collocation in drake. I want to regain the solution when SNOPT solved the program successfully. First I saved the initial guess of each variable in a .txt file, then I read the initial guess and set decision variables by SetInitialGuess() , and change nothing else, but I did not get the same solution, WHY?
MOREOVER, when I run more times, the latter solutions are same.
e.g.
solution1 != solution2; solution2 == solution3; solution3 == solution4;.....
I have check each initial guess to make sure they are same. Is there options in SNOPT or initial settings in NP should be set beside the initial guess of decision variables to get a same solution?
Without knowing more about your program, one possible reason is that when you save the initial guess to a.txt, the floating number get truncated when print it to a txt file. So in the second run, the initial guess is not exactly the same as the first run. And this tiny difference in the initial guess causes the SNOPT to find a different solution. For solution 2, 3, 4, do they all load the initial guess from a.txt?
In order to print the floating number to the txt file, you could use setprecision command.

jupyterlab debugging mode contains many variables, what are they?

I have last version of jupyterlab Version 3.0.14
in debugging mode many variables not needed exists in the right box
what are they?
I want to delete them except i, j and result.
You can adjust the variableFilters setting of the debugger to hide variable that you are not interested in; see this answer for more details.
The debugger simply shows all variables that are available at runtime in the kernel; the Python kernels (IPython and Xeus Python) come with a feature of remembering your input and output for each executed cell; it is immensely useful if you execute a cell with compute-intensive task but forget to assign the result onto a variable, for example instead of:
result = do_long_calculation()
you do:
do_long_calculation()
in the latter case you can use the IPython underscore _ variable which caches the last execution result to recover the output:
result = _
If you already overwritten the most recent output, it the previous one goes to __ and so on. Learn more about this in the output caching system documentation.
Similarly _i, _ii, etc. variables cache most recent input of cells so you can check what has been executed. See more in input caching system documentation. There are also In and Out variables which store entire execution history for your reference.
Fur the future convenience I raised the idea of allowing regular expressions to hide all variables matching a pattern here.

ftell/fseek fail when near end of file

Reading a text file (which happens to be a PDS Member FB 80)
hFile = fopen(filename,"r");
and have reached up to the point in the file where there is only an empty line left.
FilePos = ftell(hFile);
Then read the last line, which only contains a '\n' character.
fseek(hFile, FilePos, SEEK_SET);
fails with:-
errno=(27) EDC5027I The position specified to fseek() was invalid.
The position specified to fseek() was returned by ftell() a few lines earlier. It has the value 841 in the specific error case I have seen. Checking through the debugger, this is also the value returned by ftell a few lines earlier. It has not been corrupted.
The same code works at other positions in the file, and only fails at the point where there is a single empty line left to read when the position is remembered.
My understanding of how ftell/fseek should work is succinctly captured by another answer on SO.
The value returned from ftell on a text stream has no predictable relationship to the number of characters you have read so far. The only thing you can rely on is that you can use it subsequently as the offset argument to fseek or fseeko to move back to the same file position.
It would seem that I cannot rely on the one thing I should be able to rely on.
My questions is, why does fseek fail in this way?
As z/OS has some file formats that are unique you might find the answer in this Knowledge Center article.
Given that you are processing a PDS member I would suspect that this is record level I/O which is handled differently than stream I/O which is more common in distributed implementations.
I do not know why fseek fails in this way, but if your common usage pattern is to use ftell to get the position and then fseek to go to that position, I strongly suggest using fgetpos and fsetpos instead for data set I/O. Not only will you avoid this problem that you are finding, but it is also better performing for certain data set characteristics.

Linux Kernel Process Management

First, i admit all the things i will ask are about our homework but i assure you i am not asking without struggling at least two hours.
Description: We are supposed to add a field called max_cpu_percent to task_struct data type and manipulate process scheduling algorithm so that processes can not use an higher percentage of the cpu.
for example if i set max_cpu_percent field as 20 for the process firefox, firefox will not be able to use more than 20% of the cpu.
We wrote a system call to set max_cpu_percent field. Now we need to see if the system call works or not but we could not get the value of the max_cpu_percent field from a user-spaced program.
Can we do this? and how?
We tried proc/pid/ etc can we get the value using this util?
By the way, We may add additional questions here if we could not get rid of something else
Thanks All
Solution:
The reason was we did not modify the code block writing the output to the proc queries.
There are some methods in array.c file (fs/proc/array.c) we modified the function so that also print the newly added fields value. kernel is now compiling we'll see the result after about an hour =)
It Worked...
(If you simply extended getrlimit/setrlimit, then you'd be done by now…)
There's already a mechanism where similar parts of task_struct are exposed: /proc/$PID/stat (and /proc/$PID/$TID/stat). Look for functions proc_tgid_stat and proc_tid_stat. You can add new fields to the ends of these files.

Controlling Doxygen's LaTeX output for making PDF documentation

I'm using Doxygen to generate documentation for my code. I need to make a PDF version of this and using Doxygen's LaTeX output appears to be the way to do it.
However I've run into a number of annoying problems, and not knowing anything about LaTeX previously haven't really got much of an idea on how to approach them, and the countless references for LaTeX related things are not much help...
I worked out how to create a custom style thing in a sty file and how to get Doxygen to use it. After a lot of searching I found out how to set the page margins etc. through this, and I'm guessing the perhaps this is the file I want for doing the other things I want, but I cant seem to find any commands for doign what I want :(
The table of contents at the start of the document contains a lot of items Id rather it didn't as it makes the contents very long. Is there some way to limit this contents to just say the first two levels, rather than having entries for every single individual function, variable, etc.? Id quite like to keep all the bookmarks however. I did try the "COMPACT_LATEX" option but as well as removing items on the contents pages, it removed the bookmarks and the member lists at the start of each section, which I do really want to keep.
Is there a way to change the order of things, like putting the full class description at the start of the section, rather than after all the members and attributes?
Wow, that's kind of evil of Doxygen.
Okay, to get around the tocdepth counter problem, add the following line to your .sty file:
\AtBeginDocument{\setcounter{tocdepth}{2}}% or whatever level you want
You can set the PDF bookmarks depth to a separate value:
% requires you \usepackage{hyperref} first
\hypersetup{
bookmarksdepth = section, % of whatever level you want
}
Also note that if you have a list of figures/tables, the tocdepth must be at least 2 for them to show up.
I don't see any way of rearranging those items within the LaTeX files---Doxygen just barfs them out there, so we can't do much. You'll have to poke around the Doxygen documentation to see if there's any way to specify the order I guess. (Here's hoping!)
You're so close.
Googling on "latex contents level" brought me to LaTeX - customizing the depth of the table of contents for different parts of the thesis which suggests
\setcounter{tocdepth}{n}
where n starts at zero for only the highest level division. This is presumable defined in all the default styles, but is worth a try in doxygen.
You could write a Perl/Awk script to simply delete the unwanted lines from the table of contents. For the file burble.tex, Latex will generate the file burble.toc, which will contain lines such as:
\contentsline {subsection}{Class F rewrites}{38}
\contentsline {subsection}{Class M rewrites}{39}
\contentsline {section}{\numberline {7}Definition and properties of the translation}{44}
\contentsline {paragraph}{Well-formedness}{54}
Simple regexes will identify which levels each line belongs to, and you can filter the file based on that. Once you have the table of contents the way you want it, insert \nofiles in the appropriate place (the style sheet?), which means that Latex will read the auxiliary files but not overwrite them.