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

added calendar-arithmetic tasks #43

Merged
merged 1 commit into from
Feb 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions GALLERY.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,32 @@ Metadata: {'rotation': 17, 'cipher_text': 'ZW PFLI JKFDRTY ZJ FLK FW ZK DLJK SV

````

### calendar_arithmetic
Generates various calendar arithmetic tasks
Default configuration:
```python
year = 2024
tasks = None
seed = 42
size = 500
```

Example tasks:
```
Example 1:
Question: How many business days (Monday-Friday) are there from Tuesday, December 17, 2024 to Sunday, December 29, 2024 (inclusive of both dates)? Give the count numerically.
Answer: 9
Metadata: {'task': 'count_business_days', 'start_date': '2024-12-17', 'end_date': '2024-12-29'}
Example 2:
Question: Given that January 1 fell on a Sunday, which weekday occurs on August 17? State the weekday (Monday through Sunday).
Answer: Friday
Metadata: {'task': 'first_day_of_year', 'year': 2024, 'first_day': 'Sunday', 'target_date': '2024-08-17', 'delta_days': 229}
Example 3:
Question: In August 2024, if an event recurs on the first Tuesday, what is the date (day of the month) of the event? Answer with a number. Answer with -1 if the ordinal does not exist in the month.
Answer: 6
Metadata: {'task': 'recurring_event_day', 'year': 2024, 'month': 8, 'ordinal': 'first', 'weekday': 'Tuesday'}
```

### chain_sum
Generates simple arithmetic tasks using only + and - operators

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ See the [Dataset Gallery](GALLERY.md) for a complete list of available datasets
### <small>Arithmetic Tasks</small>

- `BasicArithmeticDataset`: Generate arithmetic expressions with configurable complexity and operators (+, -, \*, /)
- `CalendarArithmeticDatset`: Generate arithmetic problems around calendar navigation logic
- `ChainSum`: Generate addition/subtraction chains with configurable length and digit counts
- `FractionSimplificationDataset`: Generate fraction simplification tasks with configurable complexity
- `GCDDataset`: Generate Greatest Common Divisor problems with configurable number of integers
Expand Down
5 changes: 5 additions & 0 deletions reasoning_gym/arithmetic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,18 @@
from .leg_counting import LegCountingConfig, LegCountingDataset
from .prime_factorization import PrimeFactorizationConfig, PrimeFactorizationDataset
from .time_intervals import TimeIntervalsConfig, TimeIntervalsDataset
from .calendar_arithmetic import CalendarArithmeticConfig, CalendarArithmeticDataset

__all__ = [
"BasicArithmeticDataset",
"BasicArithmeticDatasetConfig",
"basic_arithmetic_dataset",
"ChainSum",
"ChainSumConfig",
"CalendarArithmeticConfig",
"CalendarArithmeticDataset",
"Weekday",
"CalendarTask",
"FractionSimplificationConfig",
"FractionSimplificationDataset",
"GCDConfig",
Expand Down
Loading
Loading