Skip to content

Commit

Permalink
post merge formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
andreaskoepf committed Feb 2, 2025
1 parent aa172a1 commit 8b0f634
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 21 deletions.
33 changes: 19 additions & 14 deletions GALLERY.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ This gallery shows examples from all available datasets using their default conf
- [basic_arithmetic](#basic_arithmetic)
- [bf](#bf)
- [caesar_cipher](#caesar_cipher)
- [calendar_arithmetic](#calendar_arithmetic)
- [chain_sum](#chain_sum)
- [color_cube_rotation](#color_cube_rotation)
- [countdown](#countdown)
Expand Down Expand Up @@ -256,30 +257,34 @@ 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
year = 2022
tasks = ['weekday_offset', 'weekday_of_date', 'weekday_of_date_from_first_day', 'recurring_event_day', 'count_days', 'count_business_days', 'is_leap_year']
offset_upper_bound = 100
leap_year_range = 200
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'}
Question: Between Sunday, February 27, 2022 and Wednesday, March 2, 2022 (counting both dates), what's the total count of business days (Monday through Friday)? Give the count numerically.
Answer: 3
Metadata: {'task': 'count_business_days', 'start_date': '2022-02-27', 'end_date': '2022-03-02'}
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}
Question: Starting from Monday, May 23, 2022, which weekday was it 98 days before? Write out the full weekday name.
Answer: Monday
Metadata: {'task': 'weekday_offset', 'start_date': '2022-05-23', 'offset_days': -98, 'target_date': '2022-02-14'}
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'}
```
Question: If a meeting is scheduled on the last Saturday of September 2022, on which day of the month does it occur? Respond with just the number. Answer with -1 if the ordinal does not exist in the month.
Answer: 24
Metadata: {'task': 'recurring_event_day', 'year': 2022, 'month': 9, 'ordinal': 'last', 'weekday': 'Saturday'}
````

### chain_sum
Generates simple arithmetic tasks using only + and - operators
Expand Down
2 changes: 1 addition & 1 deletion reasoning_gym/arithmetic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
"""

from .basic_arithmetic import BasicArithmeticDataset, BasicArithmeticDatasetConfig
from .calendar_arithmetic import CalendarArithmeticConfig, CalendarArithmeticDataset
from .chain_sum import ChainSum, ChainSumConfig
from .fraction_simplification import FractionSimplificationConfig, FractionSimplificationDataset
from .gcd import GCDConfig, GCDDataset
from .lcm import LCMConfig, LCMDataset
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",
Expand Down
8 changes: 4 additions & 4 deletions reasoning_gym/arithmetic/calendar_arithmetic.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from dataclasses import dataclass
from datetime import date, timedelta
import calendar
import random
import math
from typing import Optional, Tuple, List, Dict, Any
import random
from dataclasses import dataclass
from datetime import date, timedelta
from enum import Enum, auto
from typing import Any, Dict, List, Optional, Tuple

from ..factory import ProceduralDataset, register_dataset

Expand Down
6 changes: 4 additions & 2 deletions tests/test_calendar_arithmetic.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import calendar
import math
from datetime import date

import pytest
import math
import calendar

from reasoning_gym.arithmetic import CalendarArithmeticConfig, CalendarArithmeticDataset

WEEKDAYS = [
Expand Down

0 comments on commit 8b0f634

Please sign in to comment.