Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Priority scheduler leaves a lot of empty time #397

Closed
jkampars opened this issue Jan 4, 2019 · 4 comments · Fixed by #541
Closed

Priority scheduler leaves a lot of empty time #397

jkampars opened this issue Jan 4, 2019 · 4 comments · Fixed by #541
Labels

Comments

@jkampars
Copy link

jkampars commented Jan 4, 2019

Firstly, i got this plot by copy and pasting plot_schedule_airmass() function and changing the plot_airmass() function to plot_altitude().
figure_1
The red dashed lines are the altitude constraints i have, and those are the only constraints for this scheduler. Logically, you would just start observing at 7:00, observe every target and stop, but the priority scheduler decides to spread them out to concentrate them at certain points, mostly the start, middle and end of the given time window. I tried looking into the code of priority_scheduler and scorer but i can't wrap my head around it.

@bmorris3
Copy link
Contributor

bmorris3 commented Jan 4, 2019

Hi @jkampars! The priority scheduler tries to schedule each observing block (OB) in order of priority. The top priority target gets scheduled at its optimal time, then the next target gets scheduled closest to its optimal time, modulo the already scheduled observations, and so on. By putting in an altitude constraint, you're allowing it to prioritize based on altitude – in other words, it will try to schedule top priority targets near their maximum altitude (hence the clump in the middle of the plot). If you attach a list of the priorities for each of your targets, that might help explain the behavior you're seeing.

@jkampars
Copy link
Author

jkampars commented Jan 4, 2019

Is there a way to override the scheduler, so it doesn't care about what altitude the target is at as long as it is inside the constraints, without having to make a custom scheduler or scorer? Does the scorer decide that targets should be observed at maximum altitude or the scheduler itself? The scorer returns a boolean so i didn't think that's where this error happens.
Here is the list of priorities for these targets:
w75s - 4
dr21 - 2
l1287 - 1
laha234 - 4
oh43p8 - 4
g37p479 - 4
g50p03 - 3
on1 - 2
g43p79 - 2
g107p3 - 3
g59p783 - 4
g136p84 - 2
g30p99 - 2
w3oh - 4
ngc7538 - 3
g85p41 - 2

@T0T4R4
Copy link

T0T4R4 commented Aug 19, 2020

@jkampars did you end up solving this issue ?

@michaelbaisch
Copy link
Contributor

I think I ran into a similar problem and I think I figured out what the problem ist. I believe the problem is here with np.argsort. When using boolean_constraint=True there are many equal values in the sum_scores array. And argsort without any explicit kind argument uses quicksort where equal values have no specific order.

To improve the ordering you could use:

for idx in np.argsort(sum_scores, kind='mergesort')[::-1]:

then your schedule will be filled from the back. So we want to negate before sorting:

for idx in np.argsort(-sum_scores, kind='mergesort'):

Now I think it should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants