Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

tileX logo

🌌 tileX β€” Genetic Algorithm Scheduler and NN Surrogate

This code, so far in a notebook form, implements and experiments with a Genetic Algorithm (GA) based sky observation scheduler and a neural-network surrogate model for fitness prediction. It is intended as a research / prototyping toolkit for optimizing telescope pointings against probabilistic sky maps (HEALPix) and operational constraints.

🧭 Overview

  • Purpose: evaluate and evolve observation schedules (chromosomes) composed of ordered pointings (genes). Fitness accounts for detection probability from HEALPix maps and operational costs (airmass, slew, overlap, visibility).
  • Inputs: HEALPix probability map(s) and optional tile grids in data/.
  • Outputs: console logs, Matplotlib / healpy visualizations (fitness evolution, best chromosome overlay), and a summary table of chromosomes and scores.

🧩 Main components

  • 🧬 Chromosome representation

  • Each chromosome is a list of genes. A gene is a dict containing id, ra_deg, dec_deg, start_time, exposure_s, and optional quality / probability fields.

  • πŸ“ Derived fields

  • recompute_derived_fields() computes per-gene airmass and slew (angular separation) using Astropy and stores them as airmass and slew_from_prev_deg.

  • βš–οΈ Fitness function (compute_fitness)

  • Reward: HEALPix probability integrated over a small circular patch around each pointing (or per-gene probability if present), time-weighted to prefer earlier observations.

  • Penalties: airmass above a threshold, slew-time (proportional to angular movement), overlap duration between pointings, and hard penalties for infeasible (below-horizon) pointings.

  • Parameters: AIRMAX, LAMBDA_SLEW, LAMBDA_AIRMASS, LAMBDA_OVERLAP, LAMBDA_HARD located in the notebook for easy tuning.

  • ♻️ Genetic Algorithm operators

  • mutate() β€” small random perturbations to RA/Dec or start time.

  • crossover() β€” single crossover point mixing parents.

  • evolve_population() β€” selection (retain fraction), elitism, breeding, and mutation.

  • πŸ€– Neural-network surrogate

  • Encodes chromosomes into fixed-length feature vectors (encode_chromosome) and trains a PyTorch MLP (FitnessNN) to regress real fitness values.

  • After training, the NN predicts fitness for chromosomes and an NN-assisted GA loop demonstrates evolution using predicted fitness.

▢️ How to run

  1. Ensure required Python packages are installed: numpy, astropy, healpy, pandas, matplotlib, torch, python-dateutil.
  2. Open and run testing.ipynb in Jupyter / VS Code. The notebook is organized to run end-to-end, but you can selectively execute sections (data load, GA-only loop, NN training, NN-assisted GA).

Example environment setup (pip):

python -m pip install -r requirements.txt
# or install packages individually:
pip install numpy astropy healpy pandas matplotlib torch python-dateutil

πŸ“ Files referenced by the notebook

  • data/LALInference_v2.fits.gz (HEALPix probability map used by default in the example)
  • data/GW170817_Generic_GRID.txt (optional tile grid used by make_population)

πŸ”Ž Key functions to review

  • normalize_chromosome() β€” normalizes input gene fields and datetimes.
  • recompute_derived_fields() β€” computes airmass and slew from prior pointing.
  • compute_fitness() β€” core reward / penalty aggregation used by the GA.
  • evolve_population(), mutate(), crossover() β€” GA operators.
  • encode_chromosome(), FitnessNN β€” NN encoding and model.

About

Genetic Algorithm to Schedule Astronomical Observations

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages