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

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.

Related

gams solve lst file is too large to be opened

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.

Imported text data to variable?

I have a little problem while creating my UWP program using VB.
I'm downloading text file that has coordinates. And what I would need that every of those is a variable that later I can count.
X Y
231.15 154.65
574.89 123.78
257.15 468.98
487.87 789.97
531.15 124.65
524.89 223.78
657.15 668.98
347.87 389.97
I don't have any idea where to start. Any clues?
It's hard to say where to start since your question seems pretty sparse on details, but if you're considering making all of those variables, consider using a two-dimensional array instead. It'll save you a lot of effort and make your application run faster.

Extracting information from a file variable in d3 pick basic

I have a file variable in d3 pick basic and I am trying to figure out what file it corresponds to.
I tried the obvious thing which was to say:
print f *suppose the file variable's name is f in this case
but that didn't work, because:
SELECTION: 58[B34] in program "FILEPRINTER", Line 7: File variable used
where string expression expected.
I also tried things like:
list f *didn't compile
execute list dict f *same error
execute list f *same error
but those also did not work.
In case any one is wondering, the reason I am trying to do this in the first place is that there is a global variable that is passed up and down in the code base I am working with, but I can't find where the global variable gets its value from.
That file pointer variable is called a "file descriptor". You can't get any information from it.
You can use the file-of-files to log Write events, and after a Write is performed by the code, check to see what file was updated. The details for doing this would be a bit cumbersome. You really should rely on the Value-Add Reseller or contract with competent assistance for this.
If this is not a live end-user system, you can also modify an item getting written with some very unique text like "WHAT!FILE!IS!THIS?". Then you can do a Search-System command to search the entire account (or system) to find that text. See docs for proper use of that command.
This is probably the best option... Inject the following:
IF #USER = "CRISZ" THEN ; * substitute your user ID
READU FOO FROM F,"BLAH" ELSE
DEBUG
RELEASE F,"BLAH"
END
END
That code will stop only for one person - for everyone else it will flow as normal. When it does stop, use the LIST-LOCKS command to see which file has a read lock for item "BLAH". That's your file! Don't forget to remove and recompile the code. Note that recompiling code while users are actively using it results in aborts. It's best to do this kind of thing after hours or on a test system.
If you can't modify the code like that, diagnostics like this can be difficult. If the above suggestions don't help, I think this challenge might be beyond your personal level of experience yet and recommend you get some help.
If suggestion here Does help, please flag this as the answer. :)

SDP solver output (SDPA, CSDP ...)

i want to compute a table of SDP-solutions. I create a bash file that calls an SDP-solver (SDPA or CSDP) for different data sets:
problem1.dat-s
problem2.dat-s
...
Because i want to create a table of numbers, i dont want the whole output like iterations etc. Is there a way to avoid these messages? Or even better, a way to create one solution-set-file of the data sets?
Thanks, dalvo
It's a while now, since this questions was asked, maybe you have found an answer yourself by now. If not, try calling
csdp problem1.dat-s problem1.sol > NUL
csdp problem2.dat-s problem2.sol > NUL
...
This way you'll get your solutions written to a solution file. With CSDP you'll have one vector and two matrices. Reading these files, you can easily create any other set of solutions. The information written to stdout are useless, if you're just looking for the solution, since you'll only find the error values and messages and measures of time. So redirecting stdout to NUL will help you avoid these informations.
I don't know, how this would actually work with SDPA, but considering the information found on the man-pages, it should be the same there.

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.