Jump to content

[WIN/MAC/LINUX] KSP Trajectory Optimization Tool v1.6.9 [New MATLAB Version!]


Arrowstar
 Share

Recommended Posts

Cool, good to know about the Pattern Search. It helps to know the strengths and weaknesses of each algorithm so they can be used in the right way.

The Porkchop issue does seem strange. It works fine on 1.6.5, but not on the pre-release builds 8 or 9. Everything else in the folder is untouched.

Anyway, I'll keep an eye out for anything else. Thanks a lot for all the hard work on this, I know it's not easy!

Link to comment
Share on other sites

1 hour ago, Arrowstar said:

It's a multi-select listbox

oooh I didn't even think about trying that

1 hour ago, Arrowstar said:

I could split up the action into two actions: drag coefficient and drag area if that would be helpful?

not quite what I was asking - I was saying is there even any reason to have to change the Cd values imported during the initial state? You'd know better than me if importing different Cd values at the same time I'm changing the drag area would be useful for some cases. If it's not useful to change Cd during the ascent then no reason to have to re-import them and it would just make that event a bit cleaner

1 hour ago, Arrowstar said:

Additionally if I move the time slider to the right the spacecraft icon disappears and I'm not sure how to extend the view to include the whole trajectory

Still not sure if this is an issue or me not understanding fully yet how to use the new view system

Link to comment
Share on other sites

Just now, Drew Kerman said:

not quite what I was asking - I was saying is there even any reason to have to change the Cd values imported during the initial state? You'd know better than me if importing different Cd values at the same time I'm changing the drag area would be useful for some cases. If it's not useful to change Cd during the ascent then no reason to have to re-import them and it would just make that event a bit cleaner

Yes, it can be useful to change the drag coefficient during a mission.  If the vehicle geometry changes substantially, so will the drag coefficient.

Quote

Still not sure if this is an issue or me not understanding fully yet how to use the new view system

Ooo forgot about one, whoops.  You're probably zoomed in too far.  Right click on the display and click revert to original view or something to that effect.  LVD now remembers your zoom and pan settings when updating the display, and if your display was originally zoomed in (because there was no trajectory there or otherwise) then you'll probably see what you're seeing.

Link to comment
Share on other sites

7 hours ago, Brian17 said:

#1 - Starting the program and running the Porkchop plotter with the default settings resulted in a ding and an error in the log file. I have had this error occur every time so far, including with other settings (Kerbin - Eve, etc). This happens immediately after the plot is displayed, as soon as the progress bar for "optimal departure/arrival" appears, but before any info is displayed in the output window.

Alright, I know what happened.  MATLAB has a built-in function called "lambert" in the Mapping toolbox and I have a function called "lambert."  In "normal" MATLAB, my function took precedence over the builtin function, but in the deployed version I've started building, for some reason I don't understand, the builtin function takes precedence.  The issue occurred when I started using a Mapping Toolbox function in KSPTOT and the whole toolbox got imported into the software.  In any event, I've come up with a fix that appears to work and we're off to the races again.

Speaking of which, I have rebuilt the PR9 executables and re-uploaded them in the same ZIP file as before.  Go ahead and download those.  They contain all of the fixes that we've discussed today.  If people could verify that their issues are now resolved, that would be great.  Thanks!

EDIT: Give it 10-20 minutes from the time of this message to give the new ZIP file time to upload, it's taking a bit longer than I thought.  And yes, Windows and Linux executables are both in there. :)

EDIT: And it's uploaded.

Edited by Arrowstar
Link to comment
Share on other sites

59 minutes ago, Arrowstar said:

Speaking of which, I have rebuilt the PR9 executables and re-uploaded them in the same ZIP file as before.  Go ahead and download those.  They contain all of the fixes that we've discussed today.  If people could verify that their issues are now resolved, that would be great.  Thanks!

All seems good here. The UT issue was resolved but it took 66s for it to catch up to the new time and so that meant the script execution was past time so I had to manually re-run the script to clear that warning. I'll just make sure to set UT at the start of the mission workup...

4 hours ago, Arrowstar said:

I couldn't reproduce the two Event 0 entries issue. 

Yea that seems gone now from the save file, if I see it again I will send a file your way. However there's also now no Event 0 option, which would be the variable set for the Initial State steering

Link to comment
Share on other sites

11 hours ago, Drew Kerman said:

All seems good here. The UT issue was resolved but it took 66s for it to catch up to the new time and so that meant the script execution was past time so I had to manually re-run the script to clear that warning. I'll just make sure to set UT at the start of the mission workup...

Yeah, this is a one time event to build the SunDotNormal cache for Kerbin.  Now that I have a use case, I'm going to try to speed this up a bit before the 1.6.6 release.

Quote

Yea that seems gone now from the save file, if I see it again I will send a file your way. However there's also now no Event 0 option, which would be the variable set for the Initial State steering

Try turning the pitch rate variable off and on again.  That should reset it and it'll show up in the list.  I'm not sure why it's not showing up now, to be honest.  I looked into it briefly this morning and couldn't see anything obvious.

Link to comment
Share on other sites

14 hours ago, Arrowstar said:

Speaking of which, I have rebuilt the PR9 executables and re-uploaded them in the same ZIP file as before.  Go ahead and download those.  They contain all of the fixes that we've discussed today.  If people could verify that their issues are now resolved, that would be great.  Thanks!

Hi there,

I'm testing v1.6.6 PR9 for Linux. I'm having some issues when enabling "Parallelize Script Optimization" in Mission Architect.

I had a basic .mat (didn't save that one) with a poor initial DV maneuver, and was looking to optimize to find a Moho encounter. With parallelization enabled, running the optimizer would give an error:

Finite difference derivatives at initial point contain Inf or NaN values. Fmincon cannot continue.

Turning parallelization off made things work. (I don't have the .mat for this; I'll try to recreate it.)

After getting a Moho encounter, I tried to enable parallelization again while optimizing for maximum spacecraft mass. It failed with:

There was an error optimizing the mission script: Subscript indices must either be real positive integers or logicals

Disabling parallelization again allowed it to proceed. The .mat file for the second error, as well as ksptot.log, are both here.

(I downloaded PR9 from the link in your PR9 announcement post; I assume that's still the valid link?)

Edit:

Both .mat files are there. The confusingly named moho1.mat is the second error, and confusingly named moho2.mat is the first.

Edited by salajander
Link to comment
Share on other sites

7 hours ago, Arrowstar said:

Try turning the pitch rate variable off and on again

Classic tech support!! :D It totally worked too :P

I do have to switch it off and on every time I load the case file tho.

Also, I haven't repro'd this yet but just FYI while working (not after just loading it) I did notice the Adjust Variables show me Event 1-11 in the drop down. When I switched the Initial State off and on to bring back Event 0 the drop down then contained Event 0-10. This is actually correct, and before I think it was just off by 1 (array indices, amirite?) and if I had tried to modify Event 1 it would have actually been Event 0. I think this came about when inserting new sequential events

Edited by Drew Kerman
Link to comment
Share on other sites

@Arrowstar So far so good, haven't had any issues with the Porkchop or the LVD yet. As Salajander noted, I did have the same messages come up occasionally in MA using PR8, but it was either when starting very far from an optimal solution or when trying to fine-tune using very tight bounds. In those cases, switching to a different solver helped. Unfortunately I don't have a log or .mat of it occurring, but if it happens again I'll post it.

Edit: Also, those errors were with the prior version, before the issues with parallel pool were fixed.

Edited by Brian17
Link to comment
Share on other sites

@Arrowstar have you noticed any delay after moving the mission time slider for the view in LVD? I'm getting several seconds of unresponsiveness after dragging it around. Here's the case file. Also OMG what in the hell did I do to make it 68MB?!? I just noticed it when I went to zip it up.

Can you add altitude as an independent variable for the GA tool? I'm often looking to see at what altitude certain things happen like staging and stuff

Edit: hrmmm I saved the file again and now its only 35MB but not sure what I did to make it smaller. Did not change much AFAIK. Here is the smaller file.

Also the <- -> buttons on the timeline do not seem to do anything for me in that case file. Should they be jumping between sequential events?

Edited by Drew Kerman
Link to comment
Share on other sites

21 hours ago, salajander said:

Hi there,

I'm testing v1.6.6 PR9 for Linux. I'm having some issues when enabling "Parallelize Script Optimization" in Mission Architect.

I had a basic .mat (didn't save that one) with a poor initial DV maneuver, and was looking to optimize to find a Moho encounter. With parallelization enabled, running the optimizer would give an error:

Finite difference derivatives at initial point contain Inf or NaN values. Fmincon cannot continue.

Turning parallelization off made things work. (I don't have the .mat for this; I'll try to recreate it.)

After getting a Moho encounter, I tried to enable parallelization again while optimizing for maximum spacecraft mass. It failed with:

There was an error optimizing the mission script: Subscript indices must either be real positive integers or logicals

Disabling parallelization again allowed it to proceed. The .mat file for the second error, as well as ksptot.log, are both here.

(I downloaded PR9 from the link in your PR9 announcement post; I assume that's still the valid link?)

Edit:

Both .mat files are there. The confusingly named moho1.mat is the second error, and confusingly named moho2.mat is the first.

I'll take a look.  Thanks for letting me know.

16 hours ago, Drew Kerman said:

Classic tech support!! :D It totally worked too :P

I do have to switch it off and on every time I load the case file tho.

Also, I haven't repro'd this yet but just FYI while working (not after just loading it) I did notice the Adjust Variables show me Event 1-11 in the drop down. When I switched the Initial State off and on to bring back Event 0 the drop down then contained Event 0-10. This is actually correct, and before I think it was just off by 1 (array indices, amirite?) and if I had tried to modify Event 1 it would have actually been Event 0. I think this came about when inserting new sequential events

Okay, so the issue is that the master list that tracks variables got out of sync with some variables in use in the initial state and one of the events.  Do you know when variables stop showing up in the Adjust Variables drop down menu?  Or how I can reproduce that?  This is going to be tricky to fix without any idea of what causes it.

14 hours ago, Drew Kerman said:

@Arrowstar have you noticed any delay after moving the mission time slider for the view in LVD? I'm getting several seconds of unresponsiveness after dragging it around. Here's the case file. Also OMG what in the hell did I do to make it 68MB?!? I just noticed it when I went to zip it up.

Yeah, I've seen that delay.  Basically when you move the slider around, all of the callbacks to that slider are still getting called, even after the slider has stopped moving.  I have logic to check for this and dismiss the callback before it does anything CPU intensive, but I honestly don't know how to kill the callbacks entirely. 

Quote

Can you add altitude as an independent variable for the GA tool? I'm often looking to see at what altitude certain things happen like staging and stuff

Sure, that'll be easy I think.  Just for LVD?

Quote

Also the <- -> buttons on the timeline do not seem to do anything for me in that case file. Should they be jumping between sequential events?

The arrow buttons are for moving around between Mission Segments (basically SoIs) when you use the "View by SoI Grouping" event plotting style in the View Settings.  This is the classic way of viewing MA and LVD data, though I much prefer the "View All" setting these days (in which the arrow buttons do nothing useful).

Link to comment
Share on other sites

Hi,

I'm having a great time using this in RSS.  Is there an option to change the maneuver window units from seconds to something like Year X, Day Y, etc?  Also, is there a way to change the Year X, Day Y format to something like 1965-10-2 for the RSS settings?  Thanks; this mod is a lifesaver for me.

Link to comment
Share on other sites

2 hours ago, Arrowstar said:

This is going to be tricky to fix without any idea of what causes it.

Yea I figured. I will keep an eye out for it.

2 hours ago, Arrowstar said:

Just for LVD?

that's my current use case, but if it's able to be copied over to MA as well easily I don't see why not have both

2 hours ago, Arrowstar said:

in which the arrow buttons do nothing useful

does the idea of paging between sequential events strike your fancy?

2 hours ago, Arrowstar said:

I have logic to check for this and dismiss the callback before it does anything CPU intensive, but I honestly don't know how to kill the callbacks entirely.

it's pretty bad, on the order of 4-5s for me sometimes. Might be worthwhile to put up the "Working" label over the figure area during this time

Link to comment
Share on other sites

1 hour ago, Entropian said:

Is there an option to change the maneuver window units from seconds to something like Year X, Day Y, etc? 

Generally if you right-click on text boxes designed to input time in universal time seconds, you'll get an option to enter the time as a date/time, and it will do the conversion for you.  I think this will basically do what you're looking for here. :)

Quote

Also, is there a way to change the Year X, Day Y format to something like 1965-10-2 for the RSS settings?  Thanks; this mod is a lifesaver for me.

There is not, I'm afraid.  I generally only promise to support stock KSP, so you'll have to do the math for that outside of KSPTOT and plug it in yourself.

Link to comment
Share on other sites

2 hours ago, Drew Kerman said:

it's pretty bad, on the order of 4-5s for me sometimes. Might be worthwhile to put up the "Working" label over the figure area during this time

ooof I have a better idea of what's happening now based on what you said and some experimentation. So every time the figure updates a bunch of callbacks are generated. If I just click along the timeline rapidly to move it forward/backwards there's only a few updates so no real delay. If I drag to scrub across, the longer I drag the longer the delay of several seconds before the app is responsive again (menus show, dialogs open, etc). If I hold down the arrow key and scrub along the entire timeline, the app stays unresponsive afterwards for a little over two minutes

Also, when creating a Set Kinematic State the UT field is empty and when you select to specify a state to inherit the UT from the UT field remains empty. When you go to save the state it won't let you because the UT field has an invalid value. So I just manually put in 0 before selecting to inherit the UT but the dialog should probably load with it as 0

I like how the GA handles when you're using separate kinematic states and plots for both (in my case, more if needed I suppose). Could you have the plot line colors automatically selected to match the line color chosen for the event the kinematic state was set? it's obvious to me here which is which, but maybe for more than two it could get confusing

My LVD case file is completed and is 172MB :o is that the new normal? I'm not complaining. Just surprised at the huge increase - previous designs have barely broken 1MB

Edited by Drew Kerman
Link to comment
Share on other sites

3 hours ago, Drew Kerman said:

ooof I have a better idea of what's happening now based on what you said and some experimentation. So every time the figure updates a bunch of callbacks are generated. If I just click along the timeline rapidly to move it forward/backwards there's only a few updates so no real delay. If I drag to scrub across, the longer I drag the longer the delay of several seconds before the app is responsive again (menus show, dialogs open, etc). If I hold down the arrow key and scrub along the entire timeline, the app stays unresponsive afterwards for a little over two minutes

Okay, so I was able to resolve the issue with holding down the arrow keys causing a massive mess that would take minutes to work out.  Unfortunately, I can't resolve the issue with the few seconds delay when you move the slider around a lot. This looks like some internal MATLAB slowness that I don't have access to.  It'll have to do for now.

Quote

Also, when creating a Set Kinematic State the UT field is empty and when you select to specify a state to inherit the UT from the UT field remains empty. When you go to save the state it won't let you because the UT field has an invalid value. So I just manually put in 0 before selecting to inherit the UT but the dialog should probably load with it as 0

Should be resolved for next release.

Quote

I like how the GA handles when you're using separate kinematic states and plots for both (in my case, more if needed I suppose). Could you have the plot line colors automatically selected to match the line color chosen for the event the kinematic state was set? it's obvious to me here which is which, but maybe for more than two it could get confusing

I could create a checkbox to either plot all data with the selected color or plot all data with the event colors.  How does that sound?

Quote

My LVD case file is completed and is 172MB :o is that the new normal? I'm not complaining. Just surprised at the huge increase - previous designs have barely broken 1MB

So here's the choice: we can either make the sun dot normal caching stuff transient, meaning that it won't save to file but you'll have to regenerate it each time you open it, or we can leave it as is and get big files. Do you have a preference?

EDIT: Never mind, I'm making it transient.  It'll reset the cache on load to empty, but it'll not start the cache from 0, which is what's going on with you, but with the first time in the first integration time step, which makes way more sense and will eliminate the super long first run time in most cases I think.

Edited by Arrowstar
Link to comment
Share on other sites

23 hours ago, Drew Kerman said:

Can you add altitude as an independent variable for the GA tool? I'm often looking to see at what altitude certain things happen like staging and stuff

Added in both MA and LVD for next release.

On 8/8/2020 at 12:02 PM, salajander said:

Hi there,

I'm testing v1.6.6 PR9 for Linux. I'm having some issues when enabling "Parallelize Script Optimization" in Mission Architect.

I had a basic .mat (didn't save that one) with a poor initial DV maneuver, and was looking to optimize to find a Moho encounter. With parallelization enabled, running the optimizer would give an error:

Finite difference derivatives at initial point contain Inf or NaN values. Fmincon cannot continue.

Turning parallelization off made things work. (I don't have the .mat for this; I'll try to recreate it.)

After getting a Moho encounter, I tried to enable parallelization again while optimizing for maximum spacecraft mass. It failed with:

There was an error optimizing the mission script: Subscript indices must either be real positive integers or logicals

Disabling parallelization again allowed it to proceed. The .mat file for the second error, as well as ksptot.log, are both here.

(I downloaded PR9 from the link in your PR9 announcement post; I assume that's still the valid link?)

Edit:

Both .mat files are there. The confusingly named moho1.mat is the second error, and confusingly named moho2.mat is the first.

Unfortunately, I've run into this before and there's nothing I can do.  It definitely is something deep within MATLAB's builtin FMINCON function that causes the issue. I'm not sure if it's only in the deployed version or if normal MATLAB experiences this as well (I believe the latter).  You'll have to turn off parallelization until your problem gets close and then try again.  Also make sure that you're using the built-in derivatives/gradient with Fmincon.  The custom gradient code I wrote is okay and should work but the built is stuff is probably faster.

Actually, just to check, can you provide me with a MAT file that exhibits this problem?  Thanks!

Link to comment
Share on other sites

20 minutes ago, Drew Kerman said:

sounds fine although why would you want all the plot lines to be the same color?

I think maybe I did a bad job explaining.  What I've done is add a checkbox to LVD's GA (not as possible in MA right now, I'm investigating for the future).  If that box is not checked, then you get the previous behavior where all data is plotted using the selected color.  If it is checked, then all data is plotted using the color of the event which generated it.  Is this not what you were after?

Edited by Arrowstar
Link to comment
Share on other sites

2 minutes ago, Arrowstar said:

If it is checked, then all data is plotted using the color of the event which generated it.  Is this not what you were after?

yes this is what I was asking for, but I just don't see why make it an option to do it that way. Having it all plotted as a single color doesn't seem in any way helpful or useful IMO. Unless... unless I missed a way to manually assign a color to each plot line?

Link to comment
Share on other sites

1 minute ago, Drew Kerman said:

yes this is what I was asking for, but I just don't see why make it an option to do it that way. Having it all plotted as a single color doesn't seem in any way helpful or useful IMO. Unless... unless I missed a way to manually assign a color to each plot line?

It can be useful to use a single color to plot things because having a whole bunch of colors on a plot can look messy and unprofessional.  There may be times when the analyst wants to display trajectories in one color on the main display because this can be useful to the eye there, but plot data (for PowerPoints or reports or the like) in a more professional white on black or black on white color scheme to look good for the management.  Or so my experience tells me lol.

Link to comment
Share on other sites

1 minute ago, Arrowstar said:

It can be useful to use a single color to plot things because having a whole bunch of colors on a plot can look messy and unprofessional.  There may be times when the analyst wants to display trajectories in one color on the main display because this can be useful to the eye there, but plot data (for PowerPoints or reports or the like) in a more professional white on black or black on white color scheme to look good for the management.  Or so my experience tells me lol.

wow. I'll certainly defer to your experience here. I would have thought management loved colorful things! :P

Link to comment
Share on other sites

Just now, Drew Kerman said:

wow. I'll certainly defer to your experience here. I would have thought management loved colorful things! :P

The honest answer is that it depends on the level of management.  My immediate line and project management leadership is pretty tech savvy and would appreciate this kind of "plot by event color" thing.  If I'm going anywhere above them, though, it's gotta be a single color on a white background or someone will complain lol.  Just the way it is...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...