nasa / dorado-scheduling

Dorado observation planning and scheduling simulations. Replaced by https://github.com/m4opt/m4opt
Other
23 stars 8 forks source link

Add slew constraints using a lazy constraint callback #65

Closed lpsinger closed 3 years ago

lpsinger commented 3 years ago
lpsinger commented 3 years ago

Note: merge #64 first.

codecov[bot] commented 3 years ago

Codecov Report

Merging #65 (35d188c) into main (f189d26) will decrease coverage by 0.38%. The diff coverage is 21.12%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #65      +/-   ##
==========================================
- Coverage   32.71%   32.32%   -0.39%     
==========================================
  Files          32       34       +2     
  Lines        1397     1553     +156     
==========================================
+ Hits          457      502      +45     
- Misses        940     1051     +111     
Impacted Files Coverage Δ
dorado/scheduling/scripts/main.py 12.64% <0.00%> (+3.24%) :arrow_up:
...rado/scheduling/schedulers/continuous_time_slew.py 12.79% <12.79%> (ø)
dorado/scheduling/schedulers/discrete_time.py 15.51% <15.51%> (ø)
dorado/scheduling/schedulers/__init__.py 39.53% <33.33%> (-7.84%) :arrow_down:
dorado/scheduling/mission.py 93.75% <85.71%> (-2.25%) :arrow_down:
dorado/scheduling/_slew.py 86.66% <100.00%> (+36.66%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update f189d26...35d188c. Read the comment docs.

lpsinger commented 3 years ago

Here's an example invocation that demonstrates the new slew constraints:

$ dorado-scheduling examples/6.fits --roll-step '90 deg' --timeout 600 --skygrid-method sinusoidal --skygrid-step '50 deg2' --nside 256 -o examples/6.ecsv
$ cat examples/6.ecsv
# %ECSV 0.9
# ---
# datatype:
# - {name: time, datatype: string, description: Start time of observation}
# - {name: exptime, unit: min, datatype: float64, description: Exposure time}
# - {name: location.x, unit: km, datatype: float64, description: Location of the spacecraft}
# - {name: location.y, unit: km, datatype: float64, description: Location of the spacecraft}
# - {name: location.z, unit: km, datatype: float64, description: Location of the spacecraft}
# - {name: center.ra, unit: deg, datatype: float64}
# - {name: center.dec, unit: deg, datatype: float64}
# - {name: roll, unit: deg, datatype: float64, description: 'Roll angle of spacecraft, position angle of FOV'}
# meta:
#   __serialized_columns__:
#     center:
#       __class__: astropy.coordinates.sky_coordinate.SkyCoord
#       __info__: {description: Pointing of the center of the spacecraft's FOV}
#       dec: !astropy.table.SerializedColumn
#         __class__: astropy.coordinates.angles.Latitude
#         unit: &id001 !astropy.units.Unit {unit: deg}
#         value: !astropy.table.SerializedColumn {name: center.dec}
#       frame: icrs
#       ra: !astropy.table.SerializedColumn
#         __class__: astropy.coordinates.angles.Longitude
#         unit: *id001
#         value: !astropy.table.SerializedColumn {name: center.ra}
#         wrap_angle: !astropy.coordinates.Angle
#           unit: *id001
#           value: 360.0
#       representation_type: spherical
#     location:
#       __class__: astropy.coordinates.earth.EarthLocation
#       __info__: {description: Location of the spacecraft}
#       ellipsoid: WGS84
#       x: !astropy.table.SerializedColumn
#         __class__: astropy.units.quantity.Quantity
#         __info__: {description: Location of the spacecraft}
#         unit: &id002 !astropy.units.Unit {unit: km}
#         value: !astropy.table.SerializedColumn {name: location.x}
#       y: !astropy.table.SerializedColumn
#         __class__: astropy.units.quantity.Quantity
#         __info__: {description: Location of the spacecraft}
#         unit: *id002
#         value: !astropy.table.SerializedColumn {name: location.y}
#       z: !astropy.table.SerializedColumn
#         __class__: astropy.units.quantity.Quantity
#         __info__: {description: Location of the spacecraft}
#         unit: *id002
#         value: !astropy.table.SerializedColumn {name: location.z}
#     time:
#       __class__: astropy.time.core.Time
#       __info__: {description: Start time of observation}
#       format: isot
#       in_subfmt: '*'
#       out_subfmt: '*'
#       precision: 3
#       scale: utc
#       value: !astropy.table.SerializedColumn {name: time}
#   cmdline: /Users/lpsinger/Library/Caches/pypoetry/virtualenvs/dorado-scheduling-SFXHA12M-py3.8/bin/dorado-scheduling examples/6.fits
#     --roll-step 90 deg --timeout 600 --skygrid-method sinusoidal --skygrid-step 50 deg2 --nside 256 -o examples/6.ecsv
#   prob: 0.8908575824921298
#   real: 417.721768929
#   status: OPTIMAL_SOLUTION
#   sys: 18.965289
#   user: 391.320404
# schema: astropy-2.0
time exptime location.x location.y location.z center.ra center.dec roll
2012-05-02T18:58:32.699 10.0 -1751.6172079535218 -4316.900611397083 5223.012730741018 117.55102040816325 20.769230769230763 0.0
2012-05-02T19:09:14.699 10.0 -973.3043830130079 92.98057935785886 6927.010019294085 134.11764705882354 13.846153846153847 0.0
2012-05-02T19:24:18.324 10.0 1378.4783464318048 5551.147749749632 4036.794250930597 134.11764705882354 6.923076923076917 0.0
2012-05-02T19:35:44.699 10.0 2759.8342256807664 6388.449956560732 -817.8327909369189 90.0 -55.38461538461539 0.0
2012-05-02T19:46:26.699 10.0 2684.8918143840388 4086.573422741732 -5022.955119551435 66.66666666666666 -62.30769230769231 0.0
2012-05-02T19:57:08.699 10.0 1086.7009064685772 -0.4316301257354248 -6925.754617122366 80.0 -62.30769230769231 0.0
2012-05-02T20:07:50.699 10.0 -1379.4305614984585 -3897.0288989888454 -5661.511726980589 53.333333333333336 -62.30769230769231 0.0
2012-05-02T20:18:32.699 10.0 -3488.629943406112 -5803.880422692486 -1804.1324921006578 78.75 -55.38461538461539 0.0
$ dorado-scheduling-animate examples/6.fits examples/6.ecsv examples/6.gif --nside 256

6

lpsinger commented 3 years ago

I had gotten partway there ;)

Do you have any insights on the MIP formulation from your work on the problem?

lpsinger commented 3 years ago

@mcoughlin, this is ready for review now.

Both models (discrete-time and continuous-time-slew) are now kept in the tree, under dorado.scheduling.schedulers.

Output from --scheduler=continuous-time-slew

6-continuous-time-slew

Output from --scheduler=discrete-time

6-discrete-time

mcoughlin commented 3 years ago

Can we give Alexander a shot at giving it a real look @lpsinger?

lpsinger commented 3 years ago

Can we give Alexander a shot at giving it a real look @lpsinger?

Yes, please! What's Alexander's GitHub handle, by the way?

mcoughlin commented 3 years ago

@lpsinger It is @criswellalexander.

criswellalexander commented 3 years ago

I looked over the code and did some runs with both the discrete-time and continuous-time-slew settings, everything looks good and works as I'd expect!

mcoughlin commented 3 years ago

I looked through it as well. Can I merge @lpsinger ?

lpsinger commented 3 years ago

One sec, there is a broken unit test. Let me fix that.

lpsinger commented 3 years ago

Tests are passing now! @mcoughlin, would you do the honors?

mcoughlin commented 3 years ago

Honored I am!

lpsinger commented 3 years ago

John Cena tipping hat