Adjusted python-example to work with pydayntic 2 and fixed problem dataclass to expect a list of options#180
Open
Sagmedjo wants to merge 28 commits intoreinterpretcat:masterfrom
Open
Adjusted python-example to work with pydayntic 2 and fixed problem dataclass to expect a list of options#180Sagmedjo wants to merge 28 commits intoreinterpretcat:masterfrom
Sagmedjo wants to merge 28 commits intoreinterpretcat:masterfrom
Conversation
Updated the 'objectives' field in the 'Problem' class to accept a list of 'Objective' instead of a list of lists. Removed unnecessary calls to update_forward_refs for various classes.
Removed unnecessary calls to update_forward_refs for Pydantic models.
There was a problem hiding this comment.
Pull Request Overview
This PR updates the Python interop type definitions to be compatible with Pydantic 2 and fixes the data structure for the objectives field in the Problem class.
- Removed all deprecated
__pydantic_model__.update_forward_refs()calls for Pydantic 2 compatibility - Fixed the
objectivesfield type from nested list to flat list structure - Changes align with the flattening of objectives that occurred in version 1.24.0
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| examples/python-interop/pragmatic_types.py | Removed Pydantic 1 forward reference updates and corrected objectives field type from Optional[List[List[Objective]]] to Optional[List[Objective]] to match the flattened format |
| examples/python-interop/config_types.py | Removed Pydantic 1 forward reference updates for all dataclass definitions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Introduced `minShifts` property in vehicle type schema to enforce minimum shift usage. - Updated fleet generation logic to accommodate minimum shift requirements. - Implemented a new feature to validate minimum shift usage during route planning. - Enhanced goal context creation to include minimum shift features. - Added tests to ensure correct enforcement of minimum shift constraints and their integration with existing features.
…low for breaks with offsets with departure rescheduling
Implement simple way of changing break time windows for offsets to al…
…cles Add even distribution across vehicles
- Implemented a new feature to enforce a minimum number of activities in a tour. - Introduced `create_min_activity_limit_feature` to create a soft constraint for minimum activities. - Added `MinActivityLimitObjective` to calculate penalties for routes not meeting the minimum activity requirement. - Updated the limits checker to validate against the new minimum tour size constraint. - Enhanced vehicle limits to include `min_tour_size`. - Added tests to ensure correct behavior of the new feature, including penalty calculations and validation checks. - Updated existing tests to accommodate the new minimum tour size functionality.
…idation functions
…bjective and added docs
This feature allows configuring time constraints for when jobs can be served: - earliestFirst: earliest time a vehicle can arrive at its first job - latestLast: latest time a vehicle can depart from its last job Useful for enforcing business hours, compliance requirements, and coordinating with external systems.
…on feature - Removed `target_nearest_distance` from `JobTask` struct and related code. - Updated `Objective` enum to replace `MinimizeNearestDistance` with `MinimizeVehicleDistance`. - Implemented a new feature to minimize vehicle distance penalties based on job assignments to nearest vehicles. - Added tests for the new vehicle distance feature, ensuring correct job assignments and penalty calculations. - Adjusted existing tests to remove references to the removed `target_nearest_distance`.
- Simplified function signatures and reduced line length in job time constraint tests. - Consolidated job time constraint creation in vehicle types for better readability. - Improved assertions in tests for clarity and conciseness. - Removed unnecessary whitespace and comments across various test files. - Ensured consistent formatting in vehicle shift definitions and job creation functions. - Added a new test to verify break alignment to activity boundaries when reserved time intersects with service intervals.
…and enhance asset management
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes: #153
This pull request primarily cleans up the Python interop type definition files by removing all calls to
__pydantic_model__.update_forward_refs()and fixes the structure of theobjectivesfield in theProblemclass.Codebase cleanup and simplification:
__pydantic_model__.update_forward_refs()fromconfig_types.pyandpragmatic_types.py, to comply with pydantic 2 and aboveType definition update:
objectivesfield in theProblemclass fromOptional[List[List[Objective]]]toOptional[List[Objective]], fixing the data structure for objectives to work with the vrp_cli.solve_pragmatic method.