Skip to content

Conversation

castelao
Copy link
Member

@castelao castelao commented Oct 6, 2025

Refactoring the full crate concept model to help isolating components thus isolating major refactoring in smaller parts.

@castelao castelao self-assigned this Oct 6, 2025
@castelao castelao requested a review from ppinchuk as a code owner October 6, 2025 02:29
@Copilot Copilot AI review requested due to automatic review settings October 6, 2025 02:29
@castelao castelao added p-medium Priority: medium refactor Code improvements that do not change functionality rust labels Oct 6, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the simulation concept by extracting the Simulation struct and related logic into a dedicated module to improve code organization and component isolation.

  • Moves the Simulation struct and related functionality from lib.rs to a new simulation/mod.rs module
  • Introduces new internal structs (Scenario, Solution, Features, Algorithm) to better organize simulation components
  • Updates the public API to use a compute() method that returns an iterator instead of scout() that returns a Vec

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
crates/revrt/src/simulation/mod.rs New module containing the refactored Simulation struct with improved component separation
crates/revrt/src/lib.rs Removes Simulation implementation and imports it from the new simulation module
crates/revrt/src/cost.rs Adds Clone trait to CostFunction to support the refactored design

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@castelao castelao force-pushed the neo_simulation branch 2 times, most recently from 495094a to 97495dc Compare October 6, 2025 21:11
Copy link
Collaborator

@ppinchuk ppinchuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As long as you're going through the effort of refactoring and re-organizing, do we think that "Simulation" is the right term? We're not really simulating anything, right? It's more like a "computation" or something along those lines.

Nitpicky but this is the kind of PR where we can think about those things IMO

@castelao
Copy link
Member Author

castelao commented Oct 7, 2025

As long as you're going through the effort of refactoring and re-organizing, do we think that "Simulation" is the right term? We're not really simulating anything, right? It's more like a "computation" or something along those lines.

Nitpicky but this is the kind of PR where we can think about those things IMO

I'm not super happy with Simulation, but I can't figure out a good name. The other alternative was CaseStudy.

Whatever name it is, it's state is defined by the composition of Scenario + Algorithm + Config. The Config defines if runs concurrently, how many concurrent solutions, preserve cost surface or use a temp, ... Then we can call Simulation.compute(BoundaryConditions). BTW, I'm looking for a replace name for BoundaryConditions since most people will make a confusion with the boundaries of the GIS input features. Any suggestions @ppinchuk ?

@ppinchuk ppinchuk added topic-rust-routing Issues/pull requests related to rust routing code and removed rust labels Oct 8, 2025
@castelao castelao force-pushed the neo_simulation branch 2 times, most recently from 0f7c11e to e4116a2 Compare October 8, 2025 17:59
@castelao castelao requested a review from Copilot October 9, 2025 15:55
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 6 out of 7 changed files in this pull request and generated 5 comments.

Comments suppressed due to low confidence (3)

crates/revrt/src/lib.rs:171

  • The method scout does not exist on Routing. Should use compute(...).collect() to match the new API.
        let solutions = simulation.scout(&start, end);

crates/revrt/src/lib.rs:171

  • The method scout does not exist on Routing. Should use compute(...).collect() to match the new API.
        let solutions = simulation.scout(&start, end);

crates/revrt/src/lib.rs:233

  • The method scout does not exist on Routing. Should use compute(...).collect() to match the new API.
        let solutions = simulation.scout(&start, end);

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@castelao castelao requested a review from Copilot October 10, 2025 16:27
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@castelao castelao requested a review from Copilot October 10, 2025 17:34
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@castelao castelao merged commit 7a41000 into main Oct 10, 2025
22 checks passed
@castelao castelao deleted the neo_simulation branch October 10, 2025 18:03
github-actions bot pushed a commit that referenced this pull request Oct 10, 2025
* Defining high level signature of the new Simulation concept

* refact: Moving Simulation into its own module

* refact: Retruning an iterator

Preparing to route async, that will iterate on the solutions found.

* refact: Using dataset as a scenario

* refact: Hiding dataset behind scenario

In preparation to refact away from the legacy dataset.

* feat: Adding CostFunction to Scenario

* clean:

* Back to parallel iteration on start/end combination

* refact: Renaming Simulation struct to Routing

* Renaming Simmulation struct to Routing

* feat: (input) Features

* cfg: Adding dependencies required by async Features

* feat: Scenario with Features

* Remminder on new planned structs

* clean:

* fix: Routing offers compute() instead of scout()

* typo:

* style:
@castelao castelao added this to the 0.2.0 - Python MVP milestone Oct 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

p-medium Priority: medium refactor Code improvements that do not change functionality topic-rust-routing Issues/pull requests related to rust routing code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants