FlyerTalk Forums

FlyerTalk Forums (https://www.flyertalk.com/forum/index.php)
-   oneworld (https://www.flyertalk.com/forum/oneworld-411/)
-   -   RTW optimizer tool I've been developing (https://www.flyertalk.com/forum/oneworld/2212682-rtw-optimizer-tool-ive-been-developing.html)

xelnaga Feb 10, 2026 5:11 am

RTW optimizer tool I've been developing
 
Hi folks,

Long time lurker, first time poster. This weekend I put together a basic command-line tool for optimizing oneworld Explorer RTW tickets. It handles validation against Rule 3015, cost estimates (including carrier surcharges), BA NTP calculations, segment value ratings, route searches with live pricing, D-class availability checks via ExpertFlyer, and booking scripts. Has Claude Code harnesses built in - and best used in conjunction with a Serpapi key and an expertflyer paid account.

It's open-source and early-stage—check it out here if interested: https://github.com/kavanaghpatrick/rtw-optimizer

Feedback or suggestions welcome; I'm just hoping it might help someone.
https://cimg1.ibsrv.net/gimg/www.fly...c051d4d4af.png

Dr. HFH Feb 10, 2026 8:57 pm


Originally Posted by xelnaga (Post 37588772)
This weekend I put together a basic command-line tool for optimizing oneworld Explorer RTW tickets.

I think that you need to determine your definition of optimizing. Some people optimize for most efficient flight schedule. Others optimize for cities in a specific sequence, others don't care about the sequence as long as all the stopovers are hit. Some (like me) optimize to hit a few required stopovers, then maximize mileage for the rest of the itinerary as MRs up to the 16 flights. It's complicated.

Mwenenzi Feb 10, 2026 10:20 pm


Originally Posted by xelnaga (Post 37588772)
Hi folks,

Long time lurker, first time poster. This weekend I put together a basic command-line tool for optimizing oneworld Explorer RTW tickets. It handles validation against Rule 3015, cost estimates (including carrier surcharges), BA NTP calculations, segment value ratings, route searches with live pricing, D-class availability checks via ExpertFlyer, and booking scripts. Has Claude Code harnesses built in - and best used in conjunction with a Serpapi key and an expertflyer paid account.

It's open-source and early-stage—check it out here if interested: https://github.com/kavanaghpatrick/rtw-optimizer

Feedback or suggestions welcome; I'm just hoping it might help someone.
https://cimg1.ibsrv.net/gimg/www.fly...c051d4d4af.png

Have you tested all the rules?
  • 4k 4l The rules about trans continental in USA and AU
  • 4j QF codeshares on JQ Jetstar
  • 4c must terminate at the same point, except that origin-destination surface segments are permitted as follows:
  • 4f exception
  • The DOH transits
How does it handle surface segments?

xelnaga Feb 11, 2026 7:21 am


Originally Posted by Dr. HFH (Post 37590377)
I think that you need to determine your definition of optimizing. Some people optimize for most efficient flight schedule. Others optimize for cities in a specific sequence, others don't care about the sequence as long as all the stopovers are hit. Some (like me) optimize to hit a few required stopovers, then maximize mileage for the rest of the itinerary as MRs up to the 16 flights. It's complicated.

Yes Claude code can be your parter on strategy - for example if you are working towards maximizing NTP, it will work on itineraries for that. This is, at the end of a day, a decision-making harness for Claude Code to apply reasoning.

xelnaga Feb 11, 2026 7:23 am


Originally Posted by Mwenenzi (Post 37590465)
Have you tested all the rules?
  • 4k 4l The rules about trans continental in USA and AU
  • 4j QF codeshares on JQ Jetstar
  • 4c must terminate at the same point, except that origin-destination surface segments are permitted as follows:
  • 4f exception
  • The DOH transits
How does it handle surface segments?

Just did an audit based on your questions: Summary: 6 Missing Rules to Implement



1. 4(c) open-jaw validation — Permitted surface pair checking

2. 4(f) country-of-origin intl departure limit — 1 intl departure/arrival from origin

country (US exception)

3. 4(i) transoceanic surface ban — No surface between TC1-TC2 / TC1-TC3 (SWP exception)

4. 4(j) codeshare validation — QF/JQ permitted, AS/IB stock restriction

5. 4(l) Australia transcontinental — East coast-PER/DRW/BME/KTA nonstop limits

6. Section 8 city-pair direction — Same pair, same direction banned

7. (bonus) DOH transit continent counting — Implicit Asia count for SWP-EU/ME single flight

Will work on this in the coming days - thanks for the feedback,

Mwenenzi Feb 11, 2026 12:20 pm


Originally Posted by xelnaga (Post 37591089)
Just did an audit based on your questions: Summary: 6 Missing Rules to Implement

1. 4(c) open-jaw validation — Permitted surface pair checking
2. 4(f) country-of-origin intl departure limit — 1 intl departure/arrival from origin country (US exception)
3. 4(i) transoceanic surface ban — No surface between TC1-TC2 / TC1-TC3 (SWP exception)
4. 4(j) codeshare validation — QF/JQ permitted, AS/IB stock restriction
5. 4(l) Australia transcontinental — East coast-PER/DRW/BME/KTA nonstop limits
6. Section 8 city-pair direction — Same pair, same direction banned
7. (bonus) DOH transit continent counting — Implicit Asia count for SWP-EU/ME single flight

Will work on this in the coming days - thanks for the feedback,

The various rule 4 clauses are very basic.

xelnaga Feb 15, 2026 8:10 am


Originally Posted by Mwenenzi (Post 37591649)
The various rule 4 clauses are very basic.

These are implemented:Rule Test Results

Rule: §4(c) Open-jaw

File: rule_4c_open_jaw.yaml

Expected: FAIL

Actual: FAIL

Key Output: "LHR→CDG: not permitted. United Kingdom and France are not a permitted open-jaw pair"

────────────────────────────────────────

Rule: §4(f) Country limit

File: rule_4f_country_limit.yaml

Expected: FAIL

Actual: FAIL

Key Output: "2 intl departures from UK — limit is 1" + "2 intl arrivals into UK — limit is 1"

────────────────────────────────────────

Rule: §4(i) Surface ban

File: rule_4i_surface_ban.yaml

Expected: FAIL

Actual: FAIL

Key Output: "1 transoceanic surface sector (LAX→LHR) — not permitted"

────────────────────────────────────────

Rule: §4(j) Codeshare

File: rule_4j_codeshare.yaml

Expected: FAIL+WARN

Actual: FAIL+WARN

Key Output: S7 VIOLATION + JQ/IB plating WARNING

────────────────────────────────────────

Rule: §4(l) AU transcon

File: rule_4l_au_transcon.yaml

Expected: FAIL

Actual: FAIL

Key Output: "2 AU transcontinental between east coast and Perth — only 1 permitted"

────────────────────────────────────────

Rule: §8 City-pair

File: rule_s8_citypair.yaml

Expected: FAIL

Actual: FAIL

Key Output: "DOH→LHR flown 2 times. Resolved as DOH→LON (same city group)"

────────────────────────────────────────

Rule: Implicit Asia

File: rule_implicit_asia.yaml

Expected: PASS+INFO

Actual: PASS+INFO

Key Output: "SYD-DOH cross Asian airspace. Asia counted as visited continent"

7/7 rules triggered their expected violations/warnings. Every rule correctly identifies the specific

issue and provides actionable fix suggestions.

Mwenenzi Feb 15, 2026 1:00 pm

This itinerary using some of the more obscure rules -- post 1266

xelnaga Feb 16, 2026 1:09 pm


Originally Posted by Mwenenzi (Post 37598617)
This itinerary using some of the more obscure rules -- post 1266

Thanks - cleaned up a few edge case rules - now validates - keep em coming if you've got more weird ones:### Validation Summary

- **Status**: PASS
- **Ticket**: DONE5 (Business) from OSL
- **Passengers**: 1
- **Segments**: 16 flown, 0 surface
- **Rules**: 35/38 passed
- **Violations**: 0
- **Warnings**: 3

### Rule Results

| Rule | Status | Severity | Message |
|-----------------------------------|--------|------------|---------|
| Segment Count | PASS | violation | 16 segments (limit: 16). |
| Per-Continent Segment Limit | PASS | violation | EU_ME: 2/4 segments. |
| Per-Continent Segment Limit | PASS | violation | SWP: 1/4 segments. |
| Per-Continent Segment Limit | PASS | violation | N_America: 6/6 segments. |
| Segment Connectivity | PASS | violation | All segments connected. |
| Direction of Travel | PASS | violation | Continuous eastbound direction: TC2 → TC3 → TC1 → TC2. |
| Ocean Crossings | PASS | violation | Pacific crossing: 1 (OK). |
| Ocean Crossings | PASS | violation | Atlantic crossing: 1 (OK). |
| City-Pair Direction | PASS | violation | No duplicate city-pair directions detected. |
| Minimum Stopovers | PASS | violation | 8 stopovers (minimum: 2). |
| Origin Continent Stopover Limit | FAIL | warning | 4 stopovers in origin continent EU_ME (limit: 2). Verify with AA RTW desk whether return-leg stopovers count.<br>Fix: Make intermediate return stops into transits (<24h) or confirm exemption with booking desk. |
| Origin Country Stopover Per Direction | PASS | violation | Origin country stopovers: 0 outbound, 1 return (limit: 1/direction). |
| Same-City Visit Limit | PASS | violation | Same-city visits: OK (max 3 at DOH). |
| First Segment Not Surface | PASS | violation | First segment is a flown segment. |
| Same-City Resolution | PASS | violation | No same-city pairs detected. |
| Transoceanic Surface Sectors | PASS | violation | No transoceanic surface sectors. |
| Hawaii & Alaska Restrictions | PASS | violation | Hawaii/Alaska restrictions: OK. |
| US Transcontinental Limit | PASS | violation | US transcontinental flights: 1/1. |
| AU Transcontinental Limit | PASS | violation | No AU transcontinental flights detected. |
| Implicit Continent: Asia | PASS | info | 1 direct EU/ME↔SWP flight(s) (DOH-AKL) cross Asian airspace. Asia counted as visited continent for pricing. |
| QR Not First Carrier | FAIL | warning | Qatar Airways (QR) is the first carrier. The online booking tool cannot issue tickets starting with QR; book via AA RTW desk (+1 800 843 3000) or a travel agent.<br>Fix: Start with a different carrier, or book by phone through the AA RTW desk. |
| Eligible Carriers | PASS | violation | All carriers are eligible oneworld members. |
| QF/Jetstar Codeshare | PASS | violation | No codeshare restrictions applicable. |
| Return to Origin | PASS | violation | Returns to origin: OSL (same city as OSL). |
| Open-Jaw Permitted Pairs | PASS | violation | Returns to origin — not an open jaw. |
| Continent Count | FAIL | warning | Visiting 6 continents but ticket is for 5. Continents: EU_ME, Africa, SWP, N_America, S_America, Asia.<br>Fix: Adjust ticket type to DONE6 or modify routing to visit exactly 5 continents. |
| Ticket Validity Period | PASS | info | Insufficient dates to check validity period. |
| Origin Matches First Segment | PASS | violation | Origin OSL matches first segment departure OSL. |
| Date Sequence | PASS | info | Insufficient dates to check sequence. |
| Hemisphere Revisit | PASS | info | Hemisphere revisit check passed. Sequence: EU_ME -> Africa -> EU_ME -> SWP -> N_America -> S_America -> N_America -> EU_ME. EU_ME visited 3/2 times (northern hemisphere allows 2) \| N_America visited 2/2 times (northern hemisphere allows 2) |
| EU/ME-Africa Zone Restriction | PASS | violation | EU/ME-Africa zone: no excluded airports found. |
| Intercontinental Arrival/Departure Limit | PASS | info | Africa: 1/1 intercontinental arrivals, 1/1 departures. |
| Intercontinental Arrival/Departure Limit | PASS | info | EU_ME: 2/2 intercontinental arrivals, 2/2 departures. |
| Intercontinental Arrival/Departure Limit | PASS | info | N_America: 2/2 intercontinental arrivals, 2/2 departures. |
| Intercontinental Arrival/Departure Limit | PASS | info | SWP: 1/1 intercontinental arrivals, 1/1 departures. |
| Intercontinental Arrival/Departure Limit | PASS | info | S_America: 1/1 intercontinental arrivals, 1/1 departures. |
| Origin Country Intl Flights | PASS | info | Norway international flights: 1/1 departures, 1/1 arrivals. |
| Origin Country Return Ban | PASS | violation | No mid-journey return to Norway. |


All times are GMT -6. The time now is 10:01 pm.


This site is owned, operated, and maintained by MH Sub I, LLC dba Internet Brands. Copyright © 2026 MH Sub I, LLC dba Internet Brands. All rights reserved. Designated trademarks are the property of their respective owners.