You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: GEMINI.md
+23-8Lines changed: 23 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,18 @@
1
+
# ⚠️ CRITICAL AGENT INSTRUCTIONS ⚠️
2
+
3
+
**Adhere strictly to the following mandates. Failure to do so is a critical error.**
4
+
5
+
1.**NO GIT MODIFICATIONS:**
6
+
***STATUS:****STRICTLY READ-ONLY**.
7
+
***FORBIDDEN COMMANDS:**`git add`, `git commit`, `git push`, `git merge`, `git rebase`, `git checkout` (for creating branches), `git stash`, and ANY other command that modifies the git index, history, or working tree.
***ACTION:** If the user asks you to commit changes, **REFUSE** and remind them that you are an AI assistant without authority to alter the project's version control history. You may propose commit messages or explain what changed, but **DO NOT** execute the commands.
10
+
11
+
2.**Verbosity:** Low. Do not explain the code unless asked. Just output the diff or the file.
12
+
3.**Reasoning:** Perform deep reasoning internally, but output only the final solution.
13
+
14
+
---
15
+
1
16
# Gemini Project: JRES Solver C++
2
17
3
18
This document provides instructions for understanding, building, and contributing to the JRES Solver C++ project.
@@ -64,6 +79,11 @@ The project uses GoogleTest for its test suite. To run the tests, execute the fo
64
79
ctest
65
80
```
66
81
82
+
There is also a script to test the formatter's stdout functionality:
83
+
```bash
84
+
./test_formatter_stdout.sh
85
+
```
86
+
67
87
### Running the CLI Tools
68
88
69
89
The compiled executables are located in the `build/` directory.
@@ -74,8 +94,8 @@ The compiled executables are located in the `build/` directory.
@@ -96,9 +116,4 @@ The formatter takes the JSON output from the solver and can generate different r
96
116
* **Dependencies:** C++ library dependencies are managed as Git submodules (`cxxopts`, `nlohmann/json`). The HiGHS solver is an external dependency.
97
117
* **Testing:** The test suite is built with GoogleTest and run via CTest. New tests should be added to the `test/` directory.
98
118
* **API Design:** The core logic is exposed as a C-API for wider compatibility. Helper functions are provided for JSON serialization and deserialization.
99
-
***Code Style:** The codebase is written in C++. Please follow the existing coding style when contributing.
100
-
101
-
# MODEL INSTRUCTIONS
102
-
- **Verbosity:** Low. Do not explain the code unless asked. Just output the diff or the file.
103
-
- **Reasoning:** Perform deep reasoning internally, but output only the final solution.
104
-
- **Git Operations:** READ-ONLY. You may use `git status`, `git log`, or `git diff` to understand the context. You must *NEVER* run `git add`, `git commit`, `git push`, or any command that modifies the git history or index. Leave all version control management to the user.
119
+
* **Code Style:** The codebase is written in C++. Please follow the existing coding style when contributing.
*`--switching-penalty`: Cost for driver swaps (positive disincentivizes switching)
20
16
*`--role-coupling-weight`: Incentive for role coupling (positive incentivizes coupling)
21
17
*`--rotation-beat-weight`: Penalty for fairness deviation (positive incentivizes adherence)
22
18
@@ -37,7 +33,8 @@ The C-API uses the following structs to pass data to and from the solver.
37
33
| Field | Type | Description |
38
34
| :--- | :--- | :--- |
39
35
|`consecutiveStints`|`int`| Hard constraint: Required number of consecutive stints a driver must perform (block size). |
40
-
|`minimumRestHours`|`int`| Hard constraint: Minimum contiguous rest time required once per race. <br> **Integrated Mode:** Applies to combined Driving and Spotting time. <br> **Sequential Mode:** Applies only to Driving. |
36
+
|`minimumRestHours`|`int`| Hard constraint: Minimum contiguous rest time required once per race. |
37
+
|`firstStintDriver`|`const char*`| Hard constraint: The name of the team member who must drive the first stint. |
41
38
|`teamMembers`|`JresTeamMember*`| A pointer to an array of team members. |
42
39
|`teamMembers_len`|`int`| The number of team members. |
43
40
|`availability`|`JresMemberAvailability*`| A pointer to an array of availability information. |
@@ -98,7 +95,6 @@ These structs are used to represent the availability of team members.
98
95
|`spotterMode`|`JresSpotterMode`| Type of spotter scheduling to use (`NONE`, `INTEGRATED`, `SEQUENTIAL`). |
99
96
|`allowNoSpotter`|`bool`| Allow stints to have no spotter assigned. |
100
97
|`optimalityGap`|`double`| Solver stops when the gap to optimal is less than this (e.g., `0.2`). |
101
-
|`switchingPenalty`|`double`| Penalty applied when switching drivers between stints (default: `0.0`). |
102
98
|`roleCouplingWeight`|`double`| Weight for coupling driver and spotter roles (default: `0.0`). |
103
99
|`rotationBeatWeight`|`double`| Weight for adhering to a rotation beat or fairness metric (default: `0.0`). |
@@ -165,14 +160,6 @@ Mixed Integer Programming problems like race scheduling are NP-hard. The solver
165
160
166
161
The solver prioritizes hard constraints (rest times, fuel, availability) first. The optimality gap only affects soft preferences like minimizing consecutive stints. A 20% gap on these preferences is imperceptible in real-world use.
167
162
168
-
#### Switching Penalty
169
-
170
-
The `switchingPenalty` option adds a cost to the optimization objective every time the driver changes between two consecutive stints.
171
-
172
-
* **Goal**: To encourage the solver to keep the same driver in the car for multiple stints (e.g., doing a "double stint"), even if it's not strictly required by the `consecutiveStints` constraint.
173
-
* **Relationship to `consecutiveStints`**: `consecutiveStints` is a **hard constraint** (the solver *must* schedule blocks of this size). The `switchingPenalty` is a **soft incentive** that applies at the boundaries of these blocks to discourage swapping drivers even when a block ends.
174
-
* **Recommended Value**: Start with `10.0`. If the solver still switches drivers too often for your preference, increase it. If it starts violating preferred availability slots just to avoid a switch, decrease it.
175
-
176
163
-----
177
164
178
165
### JSON Helper Functions
@@ -194,7 +181,8 @@ The `raceDataJson` string passed to `jres_input_from_json` must strictly follow
194
181
| Field | Type | Required | Description |
195
182
| :--- | :--- | :--- | :--- |
196
183
| `consecutiveStints` | Integer | No (Default `1`) | Hard constraint: Required number of consecutive stints a driver must perform (block size). |
197
-
| `minimumRestHours` | Integer | No (Default `0`) | Hard constraint: Minimum contiguous rest time required once per race. <br> **Integrated Mode:** Applies to combined Driving and Spotting time. <br> **Sequential Mode:** Applies only to Driving. |
184
+
| `minimumRestHours` | Integer | No (Default `0`) | Hard constraint: Minimum contiguous rest time required once per race. |
185
+
| `firstStintDriver` | String | No | Hard constraint: The name of the team member who must drive the first stint. |
198
186
| `teamMembers` | Array | Yes | List of drivers and spotters (see below). |
199
187
| `availability` | Object | Yes | Map of availability constraints (see below). |
200
188
| `stints` | Array | Yes | List of pre-defined race stints (see below). |
@@ -238,6 +226,7 @@ The `availability` object maps a **Team Member's Name** to a dictionary of **Tim
238
226
{
239
227
"consecutiveStints": 2,
240
228
"minimumRestHours": 4,
229
+
"firstStintDriver": "Niki",
241
230
"teamMembers": [
242
231
{
243
232
"name": "Niki",
@@ -333,6 +322,10 @@ When the solver fails, the `schedule` array will be empty, and the `diagnosis` a
333
322
}
334
323
```
335
324
325
+
---
326
+
>[!NOTE]
327
+
>this is based on the python JRES Solver https://github.com/popmonkey/jres_solver
328
+
336
329
---
337
330
338
331
_Created by popmonkey, Gemini 2.5, Gemini 3.0, and ChatGPT 5.1_
Copy file name to clipboardExpand all lines: TOOLS.md
+3-13Lines changed: 3 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@
3
3
This suite consists of two command-line tools designed to generate and format driver schedules for endurance racing events.
4
4
5
5
> [!NOTE]
6
-
Currently the easiest way to generate input for the tools (and library) is to use [the JRES Availability Planner spreadsheet](https://docs.google.com/spreadsheets/d/1k2WaNDhXjyHXLirju2IQKxrYExQpDCT5z6jCBM71KVc/edit?usp=sharing)
6
+
Currently the easiest way to generate input for the tools (and library) is to use [the JRES Availability Planner spreadsheet](https://docs.google.com/spreadsheets/d/1hayKeug7IdZqwmta68PlqOCc8Y1JaL-QeaVal_-APxA/edit?usp=sharing)
7
7
8
8
## Platform Support
9
9
@@ -39,21 +39,20 @@ jres_solver.exe [options]
39
39
40
40
### Input/Output Behavior
41
41
42
-
***Input:** Accepts a JSON file via the `-i` flag. If no input flag is provided, it reads from **Standard Input (stdin)**.
42
+
***Input:** Accepts a JSON file via the `-i` flag (Required).
43
43
***Output:** Prints the schedule summary to **stdout** (unless `-q` is used). To save the raw solution for the Formatter, use the `-o` flag.
0 commit comments