import numpy as np
import os
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import time
from collections import defaultdict
from copy import deepcopy
# OR-Tools pour la programmation par contraintes
from ortools.sat.python import cp_model
# Helpers partages de la serie Search (resolution robuste du path)
import sys
from pathlib import Path as _Path
def _find_search_dir():
"""Trouve le repertoire Search/ contenant search_helpers.py en remontant les parents."""
for base in [_Path.cwd(), *_Path.cwd().parents]:
candidate = base / "search_helpers.py"
if candidate.exists():
return str(base)
# Recherche dans un sous-dossier Search/ (cas ou CWD = repo root ou MyIA.AI.Notebooks)
for sub in ["Search", "MyIA.AI.Notebooks/Search"]:
alt = base / sub / "search_helpers.py"
if alt.exists():
return str(alt.parent)
# Fallback : chemin relatif classique (CWD = notebook dir)
return os.path.abspath(os.path.join(os.path.dirname("."), "..", ".."))
sys.path.insert(0, _find_search_dir())
from search_helpers import benchmark_table, plot_benchmark
print("Imports OK")
print(f"OR-Tools version : {cp_model.__name__}")Imports OK
OR-Tools version : ortools.sat.python.cp_model






