You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As far as I understand, there is currently no way to seed the PRNG with an arbitrary seed. I've searched the code for "random" and found what I think is the random number generator delegate in /kOS.Safe/Function/Math.cs, but I see no way to actually seed it to get reproducible random number sequences.
I believe to understand how the current MATH:RANDOM() method works internally when I read the existing C# code, but as I'm not particularly familiar with C# or the overall design of kOS, I don't see where to inject a seed value and how to keep the seeded Random object in the right scope, making it even reseedable. So I can't make a PR myself.
Background:
When my sparetime allows it, I'm "working" on a self improving spaceplane launch script, basically using a "randomize last best parameter set - run scripts - evaluate flight - pick next best parameter set - repeat" approach. IIRC, it was Kevin Gisi who published a video on YT where a script finds a transfer orbit from Kerbin to the Mun using this or a very similar approach.
Problem is: The required number of flights to probe the parameter space is exponentially growing with every dimension in parameter space. That's where the fun part starts, finding optimizations.
When optimizing, e.g. using the accumulated results of several flights to extrapolate some kind of gradient in parameter space and cost function value, and using this data to do a less random "quasi conjugate gradient" approach, I see no way of actually repeating the randomized modifications on the parameters, and this makes assessment of optimizations very difficult.
At this point reproducible pseudo random number sequences would be extremely nice.
Please excuse my clunky wording and language. I hope you get the idea.
The text was updated successfully, but these errors were encountered:
As far as I understand, there is currently no way to seed the PRNG with an arbitrary seed. I've searched the code for "random" and found what I think is the random number generator delegate in /kOS.Safe/Function/Math.cs, but I see no way to actually seed it to get reproducible random number sequences.
I believe to understand how the current MATH:RANDOM() method works internally when I read the existing C# code, but as I'm not particularly familiar with C# or the overall design of kOS, I don't see where to inject a seed value and how to keep the seeded Random object in the right scope, making it even reseedable. So I can't make a PR myself.
Background:
When my sparetime allows it, I'm "working" on a self improving spaceplane launch script, basically using a "randomize last best parameter set - run scripts - evaluate flight - pick next best parameter set - repeat" approach. IIRC, it was Kevin Gisi who published a video on YT where a script finds a transfer orbit from Kerbin to the Mun using this or a very similar approach.
Problem is: The required number of flights to probe the parameter space is exponentially growing with every dimension in parameter space. That's where the fun part starts, finding optimizations.
When optimizing, e.g. using the accumulated results of several flights to extrapolate some kind of gradient in parameter space and cost function value, and using this data to do a less random "quasi conjugate gradient" approach, I see no way of actually repeating the randomized modifications on the parameters, and this makes assessment of optimizations very difficult.
At this point reproducible pseudo random number sequences would be extremely nice.
Please excuse my clunky wording and language. I hope you get the idea.
The text was updated successfully, but these errors were encountered: