Skip to content

Add UI for the evolutionary algorithm#1587

Closed
tahini wants to merge 14 commits intochairemobilite:mainfrom
tahini:UIforNetworkDesign
Closed

Add UI for the evolutionary algorithm#1587
tahini wants to merge 14 commits intochairemobilite:mainfrom
tahini:UIforNetworkDesign

Conversation

@tahini
Copy link
Collaborator

@tahini tahini commented Nov 17, 2025

Add the UI to configure the transit network design job: with the transit network configuration, algorithm specific parameters, as well as the simulation method parameters.

It adds a transit network design panel with a list of jobs, that can be controlled and replayed.

@tahini
Copy link
Collaborator Author

tahini commented Nov 17, 2025

@greenscientist

Ce qui fonctionne:

  • On peut configurer une job de type algo génétique et la rouler (avec son exécuteur présentement vide, mais elle "roule")
  • On peut rejouer une job précédente

Ce qui ne fonctionne pas encore:

  • La configuration de la méthode de simulation: j'aimerais réutiliser ce qu'il y a dans batchRoute le plus facilement possible
  • La gestion des fichiers sur le backend: car contrairement à batchRoute, la config dépend de la méthode choisie, il pourrait y avoir plusieurs fichiers (les poids et les OD trips, etc). on va peut-être hardcoder pour la phase 1 par simplicité

@tahini
Copy link
Collaborator Author

tahini commented Nov 18, 2025

TODO avant de sortir de draft et compléter le tout:

  • Nettoyage... beaucoup de nettoyage...
  • Fichier csv, bien gérer le téléversement du fichier, ainsi que les fichiers provenant du serveur (quand le bouton s'affiche)
  • Validation de chaque étape. S'assurer que le bouton Suivant soit actif seulement si tout est valide. Tous les champs n'ont pas encore été validés
  • Valeurs par défaut des objets. Bien que les valeurs par défaut s'affichent dans l'interface, elles ne sont pas automatiquement assignées aux objets correspondant, donc elles peuvent rester non-définies si non-modifiées
  • Traductions des champs non-traduits (ou mise à jour des traductions, car elles sont déjà en qq part)
  • Affichage du résumé et confirmation sur la dernière page.
  • S'assurer que le replay de la Job fonctionne correctement.
  • Mettre les fichiers d'entrée à l'endroit approprié sur le serveur

Mais toutes les options sont envoyées correctement sur le serveur (qui ne gère pas encore les fichiers correctement). Donc cette branche peut être utilisée pour travailler sur les tâches côté backend.

@tahini tahini force-pushed the UIforNetworkDesign branch 2 times, most recently from b2f837d to 82ce0c6 Compare November 20, 2025 20:06
When the user selects a new file, the file loading status should be
updated as the current file is not uploaded yet. We need a
`resetFileUpload` callback to be provided by the `FileUploaderHook`.
A common use case is to upload a csv file and map its fields to some
specific object data, for example, latitude/longitude of points, time,
name, ids, etc. This class and component simplifies this use case.

To use these new types and components, a description of the fields to
map is required: see the `CsvFieldMappingDescriptor` type for details.

There are 3 types of field mappings:

* `single`: maps a given key to a field in the csv field
* `latLon`: needs a latitude and longitude field from the csv. A key of
  this type will result in 2 mappings: `${key}Lat` and `${key}Lon`. Such
  a field will also require a `projection` to be specified. There is one
  `projection` per set of descriptors.
* `time`: represents a time field. For each time field, 2 additional
  information should be provided by the user: `${key}Type` will specify
  if the time is `arrival` or `departure` and `${key}Format` specifies the
  format of the time field (for example `HMM`, `HH:MM`, etc).

An object, `CsvFileMapping`, handles the validation/error messages, csv file
and mapping updates.

The React component `GenericCsvImportAndMappingForm` takes a current
mapping, along with an array of field mapping descriptors and
automatically handles the file selection and mapping widget updates.
Components requiring csv file mapping capabilities can just make use of
this component and pass a `onUpdate` callback to be notified of changes.
fixes chairemobilite#1553

Add types for the `evolutionaryTransitNetworkDesign` job. It copies the
types from the current `Simulation` class, except that the
routingAttributes will later be part of the simulation methods
instead of defined for the whole job.

This also adds the worker code to run the job in the
`TransitionWorkerPool` thread.

The result types are still to be determined.
fixes chairemobilite#1560

The `OdTripSimulationOptions` type is update to better split the
attributes into sub attributes:

* `demandAttributes`: match the type of the `batchRoute` job, and adds a
  field for the sampleRatio of the demand to evaluate each scenario. It
  also requests an optional trip weight field, from the trip's attributes.

* `transitRoutingAttributes`: They used to be defined at the
  network design level, but they belong to the simulation method

* `evaluationOptions`: Specify the cost functions to use to compare OD
  trip results between simulations.

The `SimulationAlgorithmOptionsDescriptor` type is updated to support
nested options, but also 'custom' (for now, for example for files and
csv fields). The `OdTripSimulation` method is rendered temporarily
ineffective, as issues chairemobilite#1542, chairemobilite#1545 and chairemobilite#1541 and maybe chairemobilite#1397 need to be
addressed first.
part of chairemobilite#1426

Add the translations for the network design interface strings

Add the networkDesign section to the UI, disabled by default. We can
enable it by default later when documentation and everything is set to
work. In the meantime, on can simply add the following to their local
`config.js` file:

```
sections: {
    networkDesign: {
        enabled: true
    }
}
```

Advertise the transit network design panel in the contributions.

Add the panel component, which lists the available
`evolutionaryTransitNetworkDesign` and allow to replay them. Users can
also create new network design jobs from scratch, but for now the form
is empty.
fixes chairemobilite#1426

TODO

* [] Configure simulation method
* [] Handle csv file upload/copy from job on the server-side
* [] Handle form errors
* [] Test
This component takes a `SimulationAlgorithmDescriptor` array and creates
widget for each option type.
This function takes a FileConfig object and creates the proper
configuration to let the new job get the files from where it is set.

If the file was uploaded, it fetches in the user's import directory. If
it was part of a previous job, it loads the job, makes sure the user is
allowed and fetches the file location for the desired file key.
The `TransitOdDemandFromCsv` now inherits the `CsvFileMapping` class
instead of the previous csv file. It calls the constructor with the
desired mapping descriptors. The demand type is updated to be of type
`CsvFileAndMapping`. The backend routes are updated accordingly with the
new types.

The OdTripProvider's option type is updated with the new mapped fields,
but except for naming, it works as before, using the new mappings.

In the frontend, the `BatchAttributesSelection` is not required anymore,
and the `ConfigureDemandFromCsvForm` component can be replaced with the
`GenericCsvImportAndMappingForm`.
@tahini
Copy link
Collaborator Author

tahini commented Nov 25, 2025

part of #1600

@tahini tahini closed this Nov 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant