Skip to content

Commit

Permalink
Merge pull request #43 from open-thought/calendar-arithmetic
Browse files Browse the repository at this point in the history
added calendar-arithmetic tasks
  • Loading branch information
andreaskoepf authored Feb 2, 2025
2 parents f396d3d + 943651c commit aa172a1
Show file tree
Hide file tree
Showing 5 changed files with 718 additions and 0 deletions.
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

0 comments on commit aa172a1

Please sign in to comment.