{"method":"Whole-packing random rigid rotations and sub-micro translations before rounding; coupled integer grid moves, exact-area contact-calibrated repair, and mixed-integer local contact constraints. No unrounded rigid-motion gain claimed.","seed":22005,"official_valid":true,"official_score":"2.94852695","official_score_full":2.948526950912552,"mec":[-0.0001819080616875258,0.00013448997007248039,2.948526950912552],"errors":[],"max_pair_area":9.997822348073144e-07,"max_pair_indices":[13,2],"max_containment_residual":1.98507876802978e-13,"solution":[{"x":0.545425,"y":0.67215,"theta":-0.570778},{"x":1.135484,"y":-1.23874,"theta":2.227365},{"x":-0.584124,"y":-0.217653,"theta":-1.671787},{"x":1.843118,"y":0.631801,"theta":-0.722762},{"x":0.278186,"y":1.928675,"theta":2.264578},{"x":-0.723715,"y":1.809349,"theta":3.126118},{"x":-1.624637,"y":1.076193,"theta":-2.992325},{"x":-0.56981,"y":0.785952,"theta":-1.682231},{"x":0.032918,"y":1.724683,"theta":-0.877015},{"x":1.261991,"y":1.484613,"theta":0.453135},{"x":-1.944933,"y":-0.121111,"theta":-2.464295},{"x":-1.573106,"y":-1.149938,"theta":-1.641622},{"x":1.049635,"y":-2.567295,"theta":1.95895},{"x":-0.789401,"y":-1.781407,"theta":-0.792106},{"x":1.811166,"y":-0.718041,"theta":-0.914204}],"solution_json":"[\n  {\n    \"x\": 0.545425,\n    \"y\": 0.67215,\n    \"theta\": -0.570778\n  },\n  {\n    \"x\": 1.135484,\n    \"y\": -1.23874,\n    \"theta\": 2.227365\n  },\n  {\n    \"x\": -0.584124,\n    \"y\": -0.217653,\n    \"theta\": -1.671787\n  },\n  {\n    \"x\": 1.843118,\n    \"y\": 0.631801,\n    \"theta\": -0.722762\n  },\n  {\n    \"x\": 0.278186,\n    \"y\": 1.928675,\n    \"theta\": 2.264578\n  },\n  {\n    \"x\": -0.723715,\n    \"y\": 1.809349,\n    \"theta\": 3.126118\n  },\n  {\n    \"x\": -1.624637,\n    \"y\": 1.076193,\n    \"theta\": -2.992325\n  },\n  {\n    \"x\": -0.56981,\n    \"y\": 0.785952,\n    \"theta\": -1.682231\n  },\n  {\n    \"x\": 0.032918,\n    \"y\": 1.724683,\n    \"theta\": -0.877015\n  },\n  {\n    \"x\": 1.261991,\n    \"y\": 1.484613,\n    \"theta\": 0.453135\n  },\n  {\n    \"x\": -1.944933,\n    \"y\": -0.121111,\n    \"theta\": -2.464295\n  },\n  {\n    \"x\": -1.573106,\n    \"y\": -1.149938,\n    \"theta\": -1.641622\n  },\n  {\n    \"x\": 1.049635,\n    \"y\": -2.567295,\n    \"theta\": 1.95895\n  },\n  {\n    \"x\": -0.789401,\n    \"y\": -1.781407,\n    \"theta\": -0.792106\n  },\n  {\n    \"x\": 1.811166,\n    \"y\": -0.718041,\n    \"theta\": -0.914204\n  }\n]\n","solution_sha256":"cefac3368caae7f9dea0c4cdc0e87d869f3a9bd76ba75292b1cd4b7fff7c8fb9","inherited_baseline":{"official_valid":true,"official_score":"2.94852695","official_score_full":2.948526950912552,"mec":[-0.0001819080616875258,0.00013448997007248039,2.948526950912552],"solution":[{"x":0.545425,"y":0.67215,"theta":-0.570778},{"x":1.135484,"y":-1.23874,"theta":2.227365},{"x":-0.584124,"y":-0.217653,"theta":-1.671787},{"x":1.843118,"y":0.631801,"theta":-0.722762},{"x":0.278186,"y":1.928675,"theta":2.264578},{"x":-0.723715,"y":1.809349,"theta":3.126118},{"x":-1.624637,"y":1.076193,"theta":-2.992325},{"x":-0.56981,"y":0.785952,"theta":-1.682231},{"x":0.032918,"y":1.724683,"theta":-0.877015},{"x":1.261991,"y":1.484613,"theta":0.453135},{"x":-1.944933,"y":-0.121111,"theta":-2.464295},{"x":-1.573106,"y":-1.149938,"theta":-1.641622},{"x":1.049635,"y":-2.567295,"theta":1.95895},{"x":-0.789401,"y":-1.781407,"theta":-0.792106},{"x":1.811166,"y":-0.718041,"theta":-0.914204}],"provenance":{"path":"artifacts/goal/batches/repro/items/published/result.json","sha256":"89ffaa96cbc8f60cbce1ebe7c61e0bfac270d013b5aff71bc9d5c7da1a374161","reported_score":"2.94852695","use":"baseline solution"}},"best_new_score":null,"best_fresh_score":5.9067079960562685,"strict_radius":null,"structure":{"full_disk_pairs":0,"sliding_seams_0_based":[[1,14],[4,8]],"description":"Asymmetric published topology, five interior pieces and ten outer pieces. Nine outer arcs support the container; piece 12 faces inward with its outer flat chord supported at both endpoints. Near-opposite flats on pairs 1/14 and 4/8 form offset sliding seams rather than full disks.","boundary_indices_0_based":[3,4,5,6,9,10,11,12,13,14],"interior_indices_0_based":[0,1,2,7,8],"symmetry":"No evident rotational or reflection symmetry; not a rigorous symmetry classification."},"scorer_check":{"seed":22005,"pair_cases":160,"pair_validity_disagreements":0,"max_pair_area_abs_difference":1.7770130866789913e-07,"mec_cases":16,"max_radius_abs_difference":7.194245199571014e-13,"tight_max_areas_exact_official":[[1.2242324081153954e-06,1.2242324071154442e-06],[1.2823580662907802e-06,1.282358054689907e-06],[1.0643280834302832e-06,1.064328073801985e-06],[1.626186671728621e-06,1.6261866710998163e-06],[1.2294515990570099e-06,1.229451598583342e-06],[1.0160669763233099e-06,1.0149382640022143e-06],[1.7394322701568516e-06,1.7394322693667363e-06],[1.013467774826915e-06,1.0123402736405055e-06]],"baseline_official":{"score":2.948526950912552,"mec":[-0.0001819080616875258,0.00013448997007248039,2.948526950912552],"valid":true,"errors":[]},"sample_score":"3.500000","sample_valid":true,"rounding":"Python round(float(value),6) for x,y,theta before all retained scores","final_exact_max_pair_area":1.001372692186614e-06,"baseline_exact_vs_polygon_note":"True circular area exceeds 1e-6 for six baseline pairs, although official inscribed polygons pass. Random-case agreement does not erase this expected difference. Official scoring is authoritative.","source_replay":"PASS: delivered minified code reproduced all 160 pair and 16 MEC checks with identical statistics; unused helper removal did not change tested routines."},"runs":[{"seed":3300934389,"start_kind":"baseline","minutes":5.000067561981268,"attempts":10390,"valid_count":0,"best_radius":2.948526950912552,"score_kind":"official validate_and_score for accepted best; cached 4096-point polygon validity for counts","errors":[],"official_calls":0,"initial_radius":2.948526950912552,"accepted":[],"variant":"rigid quantization phase","inherited_best_retained":true},{"seed":958726594,"start_kind":"fresh-ring","minutes":1.6668548746965826,"attempts":5923,"valid_count":5923,"best_radius":6.300000024870564,"score_kind":"official validate_and_score for accepted best; cached 4096-point polygon validity for counts","errors":[],"official_calls":9,"initial_radius":6.300000469449284,"accepted":[[6,6.300000454177633],[7,6.300000273263155],[21,6.300000231161546],[73,6.300000185101827],[107,6.300000119510996],[222,6.300000118800841],[1163,6.30000011294098],[1185,6.300000038860867],[2896,6.300000024870564]],"variant":"fresh randomized ring rigid phase","inherited_best_retained":false},{"seed":3220038383,"start_kind":"fresh-grid","minutes":1.6668546722270547,"attempts":5898,"valid_count":5898,"best_radius":5.9067079960562685,"score_kind":"official validate_and_score for accepted best; cached 4096-point polygon validity for counts","errors":[],"official_calls":7,"initial_radius":5.906708598602946,"accepted":[[1,5.906708411051695],[3,5.9067082298369336],[50,5.9067081293716805],[192,5.90670804865171],[4653,5.90670801064232],[4941,5.906708004678034],[4989,5.9067079960562685]],"variant":"fresh randomized grid rigid phase","inherited_best_retained":false},{"seed":3925504512,"start_kind":"grid","minutes":6.000954554850856,"attempts":8812,"valid_count":583,"best_radius":2.948526950912552,"score_kind":"official validate_and_score for accepted best; cached 4096-point polygon validity for counts","errors":[],"official_calls":0,"initial_radius":2.948526950912552,"accepted":[],"variant":"random coupled grid moves","inherited_best_retained":true},{"seed":2235833335,"start_kind":"rigid-phase-and-coupled-grid-repair","minutes":6.0000076550447075,"attempts":910756,"valid_count":0,"best_radius":2.948526950912552,"initial_radius":2.948526950912552,"score_kind":"official validate_and_score for every retained improvement","errors":[],"official_calls":0,"accepted":[],"restarts":74,"variant":"contact-calibrated exact-area stochastic grid repair","inherited_best_retained":true},{"seed":1402357391,"start_kind":"rigid-phase-coupled-integer-linear-grid","minutes":6.012394855854412,"attempts":18,"valid_count":2,"best_radius":2.948526950912552,"initial_radius":2.948526950912552,"score_kind":"official validate_and_score","errors":[{"attempt":1,"errors":["Semicircles 1 and 14 overlap","Semicircles 4 and 8 overlap"]},{"attempt":2,"errors":["Semicircles 4 and 8 overlap"]},{"attempt":3,"errors":["Semicircles 4 and 8 overlap"]},{"attempt":4,"errors":["Semicircles 1 and 14 overlap","Semicircles 4 and 8 overlap"]},{"attempt":5,"errors":["Semicircles 1 and 14 overlap","Semicircles 4 and 8 overlap"]},{"attempt":6,"errors":["Semicircles 4 and 8 overlap"]},{"attempt":8,"errors":["Semicircles 1 and 14 overlap","Semicircles 4 and 8 overlap"]},{"attempt":9,"errors":["Semicircles 1 and 14 overlap"]},{"attempt":10,"errors":["Semicircles 1 and 14 overlap","Semicircles 4 and 8 overlap"]},{"attempt":11,"errors":["Semicircles 1 and 14 overlap","Semicircles 4 and 8 overlap"]},{"attempt":13,"errors":["Semicircles 4 and 8 overlap"]},{"attempt":14,"errors":["Semicircles 4 and 8 overlap"]},{"attempt":15,"errors":["Semicircles 1 and 14 overlap","Semicircles 4 and 8 overlap"]},{"attempt":16,"errors":["Semicircles 0 and 3 overlap","Semicircles 4 and 8 overlap"]},{"attempt":17,"errors":["Semicircles 4 and 8 overlap"]},{"attempt":18,"errors":["Semicircles 1 and 14 overlap","Semicircles 4 and 8 overlap"]}],"accepted":[],"solver_statuses":[1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1,1,1],"variant":"linearized coupled integer grid","inherited_best_retained":true},{"seed":2180471550,"start_kind":"rigid-phase-coupled-integer-linear-grid","minutes":6.012820545265762,"attempts":18,"valid_count":12,"best_radius":2.948526950912552,"initial_radius":2.948526950912552,"score_kind":"official validate_and_score","errors":[{"attempt":2,"errors":["Semicircles 1 and 14 overlap"]},{"attempt":4,"errors":["Semicircles 4 and 8 overlap"]},{"attempt":5,"errors":["Semicircles 4 and 8 overlap"]},{"attempt":7,"errors":["Semicircles 4 and 8 overlap"]},{"attempt":13,"errors":["Semicircles 4 and 8 overlap"]},{"attempt":15,"errors":["Semicircles 1 and 14 overlap"]}],"accepted":[],"solver_statuses":[1,1,0,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1],"variant":"integer grid with seam cuts","inherited_best_retained":true},{"seed":3665816918,"start_kind":"rigid-phase-coupled-integer-linear-grid","minutes":6.0116084748180585,"attempts":19,"valid_count":13,"best_radius":2.948526950912552,"initial_radius":2.948526950912552,"score_kind":"official validate_and_score","errors":[{"attempt":8,"errors":["Semicircles 6 and 10 overlap"]}],"accepted":[],"solver_statuses":[2,1,1,1,1,1,1,1,1,1,1,0,2,1,1,1,1,0,1],"variant":"seam cuts and proposed 1e-8 radius improvement constraint","inherited_best_retained":true},{"seed":1810134338,"start_kind":"rigid-phase-coupled-integer-linear-grid","minutes":5.014870626813111,"attempts":14,"valid_count":9,"best_radius":2.948526950912552,"initial_radius":2.948526950912552,"score_kind":"official validate_and_score","errors":[{"attempt":7,"errors":["Semicircles 4 and 8 overlap"]},{"attempt":8,"errors":["Semicircles 4 and 8 overlap","Semicircles 7 and 8 overlap"]},{"attempt":9,"errors":["Semicircles 1 and 14 overlap"]},{"attempt":11,"errors":["Semicircles 4 and 8 overlap"]},{"attempt":13,"errors":["Semicircles 4 and 8 overlap"]}],"accepted":[],"solver_statuses":[1,1,1,1,1,1,1,1,1,1,1,1,1,1],"variant":"seam cuts plus both flat-endpoint containment constraints","inherited_best_retained":true}],"repo_commit":"78a78626f098cd236f3a09bb2cb242f72951599d","source_urls":["https://www.paradigm.xyz/puzzles/packing/about","https://github.com/benedictbrady/shape-packing-challenge","https://raw.githubusercontent.com/benedictbrady/shape-packing-challenge/78a78626f098cd236f3a09bb2cb242f72951599d/src/semicircle_packing/config.py","https://raw.githubusercontent.com/benedictbrady/shape-packing-challenge/78a78626f098cd236f3a09bb2cb242f72951599d/src/semicircle_packing/geometry.py","https://raw.githubusercontent.com/benedictbrady/shape-packing-challenge/78a78626f098cd236f3a09bb2cb242f72951599d/src/semicircle_packing/scoring.py","https://raw.githubusercontent.com/benedictbrady/shape-packing-challenge/78a78626f098cd236f3a09bb2cb242f72951599d/README.md"],"inputs":[{"path":"artifacts/goal/batches/repro/items/published/result.json","sha256":"89ffaa96cbc8f60cbce1ebe7c61e0bfac270d013b5aff71bc9d5c7da1a374161","reported_score":"2.94852695","use":"baseline solution"},{"path":"artifacts/goal/batches/repro/items/penalty-lbfgs/result.json","sha256":"bb9fa2b781a052c7a2751ba869c6d0adb055af032b1f2809b31141c6353bee5f","reported_score":3.16365945,"use":"inspected as data; no geometry reused"},{"path":"artifacts/goal/batches/repro/items/annealing/result.json","sha256":"8f979bb6b01c9cb949349334957d1beb220831ee63038857fcf71b73cecf3e47","reported_score":"2.97206264","use":"inspected as data; no geometry reused"},{"path":"artifacts/goal/batches/repro/items/basin-hopping/result.json","sha256":"40fa4cfa3e5c2c82ecb82f7f28c5ad17771cf455cee37836c53b34061b47cb70","reported_score":2.98929011,"use":"inspected as data; no geometry reused"},{"path":"artifacts/goal/batches/repro/items/hand-built/result.json","sha256":"38ed7fda0807c52d4aa6d2612f5a07cef42a050f7328558fe682b867207d3d08","reported_score":2.96147487,"use":"analytical scorer source"}],"search_source":{"fast.py":"_B=1.\n_A=.0\nfrom math import acos,atan2,cos,hypot,pi,sin,sqrt\nimport numpy as np\ntry:from numba import njit\nexcept ImportError:\n\tdef njit(**A):return lambda function:function\n@njit()\ndef _support_xy(nx,ny,ax,ay):\n\tif nx*ax+ny*ay>=0:return _B\n\treturn abs(nx*ay-ny*ax)\n@njit()\ndef _gap_normal(a,b):\n\tI,J=b[0]-a[0],b[1]-a[1];E,F=cos(a[2]),sin(a[2]);G,H=-cos(b[2]),-sin(b[2]);C,K,L=-1e100,_B,_A\n\tfor(A,B)in((-E,-F),(-G,-H)):\n\t\tD=I*A+J*B-_support_xy(A,B,E,F)-_support_xy(A,B,G,H)\n\t\tif D>C:C,K,L=D,A,B\n\tfor P in range(-1,2):\n\t\tfor Q in range(-1,2):\n\t\t\tM,N=I+P*F+Q*H,J-P*E-Q*G;O=sqrt(M*M+N*N)\n\t\t\tif O==0:continue\n\t\t\tA,B=M/O,N/O;D=I*A+J*B-_support_xy(A,B,E,F)-_support_xy(A,B,G,H)\n\t\t\tif D>C:C,K,L=D,A,B\n\treturn C,K,L\n@njit()\ndef gap(a,b):return _gap_normal(a,b)[0]\n@njit()\ndef farthest(a,x,y):\n\tA,B=a[0]-x,a[1]-y;C,D=cos(a[2]),sin(a[2]);E=hypot(A,B)\n\tif A*C+B*D>=0:\n\t\tif E==0:return a[0]+C,a[1]+D\n\t\treturn a[0]+A/E,a[1]+B/E\n\tF=_B if B*C-A*D>=0 else-_B;return a[0]-F*D,a[1]+F*C\n@njit()\ndef _candidate(a,x,y,r,best):\n\tA=best\n\tif r>=A[2]or r<_B-1e-12 or not np.isfinite(r):return A\n\tB=r\n\tfor D in a:\n\t\tE,F=farthest(D,x,y);C=hypot(E-x,F-y)\n\t\tif C>r+1e-10:return A\n\t\tB=max(B,C)\n\tif B<A[2]:return x,y,B\n\treturn A\n@njit()\ndef _mec(a):\n\tF=np.empty((len(a)*3,3))\n\tfor G in range(len(a)):A,B,Y=a[G];Z,b=-sin(Y),cos(Y);F[3*G]=A,B,_B;F[3*G+1]=A+Z,B+b,_A;F[3*G+2]=A-Z,B-b,_A\n\tC=_A,_A,_B+max(np.sqrt(a[:,0]**2+a[:,1]**2))\n\tfor G in range(len(F)):\n\t\tA,B,D=F[G];C=_candidate(a,A,B,D,C)\n\t\tfor c in range(G):\n\t\t\tj,k,d=F[c];H,I,K=j-A,k-B,d-D;T=hypot(H,I)\n\t\t\tif T<1e-14:continue\n\t\t\tU=(T+D+d)/2;C=_candidate(a,A+H*(U-D)/T,B+I*(U-D)/T,U,C)\n\t\t\tfor l in range(c):\n\t\t\t\tm,n,o=F[l];L,M,N=m-A,n-B,o-D;O=H*M-I*L\n\t\t\t\tif abs(O)<1e-13:continue\n\t\t\t\te=(H*H+I*I-K*K)/2;f=(L*L+M*M-N*N)/2;P,Q=(e*M-I*f)/O,(H*f-e*L)/O;R,S=(K*M-I*N)/O,(H*N-K*L)/O;V,J,W=R*R+S*S-1,2*(P*R+Q*S),P*P+Q*Q\n\t\t\t\tif abs(V)<1e-14:\n\t\t\t\t\tif abs(J)>1e-14:E=-W/J;C=_candidate(a,A+P+E*R,B+Q+E*S,D+E,C)\n\t\t\t\t\tcontinue\n\t\t\t\tg=J*J-4*V*W\n\t\t\t\tif g<0:continue\n\t\t\t\th=sqrt(g);X=(-J-h if J>=0 else-J+h)/2;i=X/V;p=W/X if X!=0 else i\n\t\t\t\tfor E in(i,p):\n\t\t\t\t\tif E>=max(_A,K,N)-1e-12:C=_candidate(a,A+P+E*R,B+Q+E*S,D+E,C)\n\treturn C\ndef mec(placements):A=np.asarray(placements,dtype=float).copy();B=A[:,:2].mean(axis=0);A[:,:2]-=B;C,D,E=_mec(A);return C+B[0],D+B[1],E\n@njit()\ndef _parts(a,b):\n\tC,D=a[0]-b[0],a[1]-b[1];E,F,G=a[2],cos(b[2]),sin(b[2]);K,X=E-pi/2,E+pi/2;H=[K,X];R=hypot(C,D)\n\tfor(A,B,Y)in((C,D,-R*R/2),(F,G,-C*F-D*G)):\n\t\tS=hypot(A,B)\n\t\tif S>1e-15 and abs(Y)<S:\n\t\t\tZ=atan2(B,A);c=acos(Y/S)\n\t\t\tfor j in(Z-c,Z+c):\n\t\t\t\td=K+(j-K)%(2*pi)\n\t\t\t\tif K<d<X:H.append(d)\n\tH.sort();L=_A\n\tfor e in range(len(H)-1):\n\t\tM,N=H[e],H[e+1];f=(M+N)/2;A,B=C+cos(f),D+sin(f)\n\t\tif A*A+B*B<=1+1e-13 and A*F+B*G>=-1e-13:O=.5 if R<1e-14 else _B;L+=O*(N-M+a[0]*(sin(N)-sin(M))-a[1]*(cos(N)-cos(M)))\n\tI,J=sin(E),-cos(E);T,U=C-I,D-J;g=T*I+U*J;h=T*J-U*I\n\tif abs(h)>=1:return L\n\ti=sqrt(1-h**2);V,W=max(_A,-g-i),min(2.,-g+i);P,Q=I*F+J*G,T*F+U*G;O=_B\n\tif P>1e-14:V=max(V,-Q/P)\n\telif P<-1e-14:W=min(W,-Q/P)\n\telif Q<-1e-14:return L\n\telif abs(Q)<=1e-14 and cos(E-b[2])>0:O=.5\n\treturn L+O*max(_A,W-V)*(a[0]*J-a[1]*I)\n@njit()\ndef intersection_area(a,b):\n\tif gap(a,b)>=-1e-14:return _A\n\tA=np.array([_A,_A,a[2]]);B=np.array([b[0]-a[0],b[1]-a[1],b[2]]);return max(_A,(_parts(A,B)+_parts(B,A))/2)\ndef rounded(placements):return np.array([[round(float(A),6)for A in A]for A in placements])","search.py":"_F='errors'\n_E='baseline.json'\n_D='seed'\n_C='score'\n_B='solution'\n_A=True\nimport json,sys,time,math\nfrom pathlib import Path\nimport numpy as np\nfrom shapely import polygons,intersection,area\nfrom semicircle_packing.geometry import Semicircle\nfrom semicircle_packing.scoring import validate_and_score\nimport fast\nD=Path(__file__).parent\ndef objs(a):return[dict(zip(('x','y','theta'),map(float,A)))for A in a]\ndef official(a):return validate_and_score([Semicircle(**A)for A in objs(a)])\ndef array(o):return np.array([[A[B]for B in('x','y','theta')]for A in o])\ndef polyareas(a):B=None;A=a[:,2,B]+np.linspace(-math.pi/2,math.pi/2,4096);A=np.array([np.linspace(A-math.pi/2,A+math.pi/2,4096)for A in a[:,2]]);C=polygons(np.stack([a[:,0,B]+np.cos(A),a[:,1,B]+np.sin(A)],axis=-1));D,E=np.triu_indices(15,1);F=np.sum((a[D,:2]-a[E,:2])**2,axis=1)<=4;return area(intersection(C[D[F]],C[E[F]]))\ndef rigid(a,rng):A=rng.uniform(-math.pi,math.pi);C,D=math.cos(A),math.sin(A);B=a.copy();B[:,:2]=a[:,:2]@np.array([[C,D],[-D,C]])+rng.uniform(-5e-07,5e-07,2);B[:,2]=(a[:,2]+A+math.pi)%(2*math.pi)-math.pi;return fast.rounded(B)\ndef check():\n\tP='fallback.json';E=.0;B=np.random.default_rng(22005);H=array(json.loads((D/_E).read_text()));C=official(H);(D/P).write_text(json.dumps({_B:objs(H),_C:C.score,'mec':C.mec,'valid':C.valid,_F:C.errors}));assert C.valid;I=[];J=0;from semicircle_packing.geometry import semicircle_polygon as Q\n\tfor F in range(160):\n\t\tif F<80:A=fast.rounded(B.uniform(-2,2,(2,3)))\n\t\telse:\n\t\t\tA=np.array([[E,E,E],[2.+B.uniform(-.0002,.0002),E,math.pi]])\n\t\t\tif F%2:A=np.array([[E,E,E],[B.uniform(-2e-06,2e-06),B.uniform(-.5,.5),math.pi+B.uniform(-2e-06,2e-06)]])\n\t\t\tA=fast.rounded(A)\n\t\tG=fast.intersection_area(*A);K=[Q(Semicircle(*A))for A in A];L=K[0].intersection(K[1]).area;I.append(abs(G-L));J+=int((G>1e-06)!=(L>1e-06))\n\tM=[];N=[]\n\tfor F in range(16):\n\t\tA=rigid(H,B)if F<8 else fast.rounded(B.uniform(-4,4,(15,3)));from semicircle_packing.scoring import compute_mec as R;C=R([Semicircle(*A)for A in A]);S=fast.mec(A);M.append(abs(C[2]-S[2]))\n\t\tif F<8:G=max(fast.intersection_area(A[B],A[C])for B in range(15)for C in range(B));T=max(polyareas(A));N.append([G,T])\n\tO={_D:22005,'pair_cases':160,'pair_validity_disagreements':J,'max_pair_area_abs_difference':max(I),'mec_cases':16,'max_radius_abs_difference':max(M),'tight_max_areas_exact_official':N,'baseline_official':json.loads((D/P).read_text())};(D/'check.json').write_text(json.dumps(O));print(json.dumps(O),flush=_A)\ndef run(seed,kind,seconds):\n\tZ=False;Y='grid';M='best.json';H=kind;F=seed;A=np.random.default_rng(F);E=array(json.loads((D/_E).read_text()))\n\tif H==Y:E=array(json.loads((D/M).read_text())[_B])\n\tif H=='fresh-ring':S=np.arange(15)*2*math.pi/15+A.uniform(-.015,.015,15);E=np.c_[5.3*np.cos(S),5.3*np.sin(S),A.uniform(-math.pi,math.pi,15)]\n\tif H=='fresh-grid':E=np.array([[2.2*(B%5-2)+A.uniform(-.02,.02),2.2*(B//5-1)+A.uniform(-.02,.02),A.uniform(-math.pi,math.pi)]for B in range(15)])\n\tE=fast.rounded(E);J=official(E);assert J.valid,J.errors;K=E.copy();B=J.score;G=L=0;T=[];U=0;N=time.monotonic();V=N;W=[]\n\tdef O():\n\t\tA={_D:F,'start_kind':H,'minutes':(time.monotonic()-N)/60,'attempts':G,'valid_count':L,'best_radius':B,'score_kind':'official validate_and_score for accepted best; cached 4096-point polygon validity for counts',_F:T,'official_calls':U,'initial_radius':J.score,'accepted':W,_B:objs(K)};(D/f\"run-{F}.json\").write_text(json.dumps(A));C=json.loads((D/M).read_text())if(D/M).exists()else{_C:1e30}\n\t\tif B<C[_C]:(D/M).write_text(json.dumps({_C:B,_B:objs(K),_D:F}))\n\twhile time.monotonic()-N<seconds:\n\t\tG+=1\n\t\tif H==Y:\n\t\t\tC=K.copy();P=int(A.choice([1,2,3,4,15],p=[.3,.4,.15,.1,.05]));a=A.choice(15,P,replace=Z);b=int(A.choice([1,2,3,5,10],p=[.65,.2,.08,.05,.02]));Q=A.integers(-1,2,(P,3))*b*1e-06\n\t\t\tif P>1 and A.random()<.5:Q[:]=Q[0]\n\t\t\tC[a]+=Q;C=fast.rounded(C)\n\t\telse:C=rigid(E,A)\n\t\tR=Z\n\t\tfor X in range(15):\n\t\t\tfor c in range(X):\n\t\t\t\tif fast.intersection_area(C[X],C[c])>1.15e-06:R=_A;break\n\t\t\tif R:break\n\t\tif not R:\n\t\t\td=polyareas(C)\n\t\t\tif max(d,default=0)<=1e-06:\n\t\t\t\tL+=1;e=fast.mec(C)[2]\n\t\t\t\tif e<B-2e-12:\n\t\t\t\t\tI=official(C);U+=1\n\t\t\t\t\tif I.valid and I.score<B:K=C;B=I.score;W.append([G,B]);O();print(F,G,B,flush=_A)\n\t\t\t\t\telif not I.valid:T.append(I.errors)\n\t\tif time.monotonic()-V>=60:O();V=time.monotonic();print('checkpoint',F,G,L,B,flush=_A)\n\tO();print('done',F,G,L,B,flush=_A)\nif __name__=='__main__':\n\tif sys.argv[1]=='check':check()\n\telse:run(int(sys.argv[1]),sys.argv[2],float(sys.argv[3]))","repair.py":"import sys,time,json,math,numpy as np\nfrom pathlib import Path\nfrom numba import njit\nfrom search import D,array,objs,official,polyareas,rigid\nimport fast\nfrom semicircle_packing.geometry import Semicircle,semicircle_polygon\n@njit()\ndef loss(a,c,r,allow):\n\tC=.0\n\tfor B in range(15):\n\t\tD=fast.farthest(a[B],c[0],c[1]);A=max(.0,math.hypot(D[0]-c[0],D[1]-c[1])-r)*1e6;C+=A*A\n\t\tfor E in range(B):A=max(.0,fast.intersection_area(a[B],a[E])-allow[B,E])*1e6;C+=A*A\n\treturn C\ndef run(seed,seconds):\n\tY=seconds;X=True;W='score';V='solution';U='best.json';F=seed;B=np.random.default_rng(F);Z=json.loads((D/U).read_text());C=array(Z[V]);A=Z[W];j=A;a=[semicircle_polygon(Semicircle(*A))for A in C];M=np.zeros((15,15))\n\tfor K in range(15):\n\t\tfor N in range(K):M[K,N]=1e-06+max(.0,fast.intersection_area(C[K],C[N])-a[K].intersection(a[N]).area)-2e-11\n\tL=time.monotonic();b=L;H=c=d=0;e=[];f=[];O=0\n\tdef P():\n\t\tB='seed';E={B:F,'start_kind':'rigid-phase-and-coupled-grid-repair','minutes':(time.monotonic()-L)/60,'attempts':H,'valid_count':c,'best_radius':A,'initial_radius':j,'score_kind':'official validate_and_score for every retained improvement','errors':e,'official_calls':d,'accepted':f,'restarts':O,V:objs(C)};(D/f\"run-{F}.json\").write_text(json.dumps(E));G=json.loads((D/U).read_text())\n\t\tif A<G[W]:(D/U).write_text(json.dumps({W:A,V:objs(C),B:F}))\n\twhile time.monotonic()-L<Y:\n\t\tO+=1;G=rigid(C,B)if O%3==0 else C.copy();Q=np.array(fast.mec(G)[:2]);g=A-B.uniform(3e-08,3e-07);E=loss(G,Q,g,M);h=E;R=0\n\t\tfor k in range(25000):\n\t\t\tif time.monotonic()-L>=Y:break\n\t\t\tH+=1;I=G.copy();S=Q.copy()\n\t\t\tif B.random()<.08:S+=B.integers(-1,2,2)*1e-07\n\t\t\telse:l=int(B.choice([1,2,3,15],p=[.65,.25,.08,.02]));m=B.choice(15,l,replace=False);n=int(B.integers(3));o=int(B.choice([-2,-1,1,2],p=[.05,.45,.45,.05]));I[m,n]+=o*1e-06;I=fast.rounded(I)\n\t\t\tT=loss(I,S,g,M);i=5e-05*(1-k/25000)**2\n\t\t\tif T<E or i>0 and B.random()<math.exp(min(.0,(E-T)/i)):G,Q,E=I,S,T\n\t\t\tif E<h-1e-12:h=E;R=0\n\t\t\telse:R+=1\n\t\t\tif E<1e-10:\n\t\t\t\tif max(polyareas(G),default=0)<=1e-06:\n\t\t\t\t\tc+=1;J=official(G);d+=1\n\t\t\t\t\tif J.valid and J.score<A:C=G.copy();A=J.score;f.append([H,A]);P();print(F,H,A,flush=X)\n\t\t\t\t\telif not J.valid:e.append(J.errors)\n\t\t\t\tbreak\n\t\t\tif R>4000:break\n\t\t\tif time.monotonic()-b>60:P();b=time.monotonic();print('checkpoint',F,H,A,'loss',E,flush=X)\n\tP();print('done',F,H,A,flush=X)\nif __name__=='__main__':run(int(sys.argv[1]),float(sys.argv[2]))","milp.py":"import sys,time,json,math,numpy as np\nfrom scipy.optimize import milp,Bounds,LinearConstraint\nfrom search import D,array,objs,official,rigid,polyareas\nfrom semicircle_packing.geometry import Semicircle,semicircle_polygon\nimport fast\ndef run(seed,seconds):\n\tr='errors';j=seconds;i=True;h='score';g='solution';f='best.json';J=seed;N=np.random.default_rng(J);k=json.loads((D/f).read_text());O=array(k[g]);I=k[h];s=I;R=time.monotonic();l=R;L=S=0;m=[];n=[];o=[]\n\tdef X():\n\t\tA='seed';(D/f\"run-{J}.json\").write_text(json.dumps({A:J,'start_kind':'rigid-phase-coupled-integer-linear-grid','minutes':(time.monotonic()-R)/60,'attempts':L,'valid_count':S,'best_radius':I,'initial_radius':s,'score_kind':'official validate_and_score',r:m,'accepted':n,'solver_statuses':o,g:objs(O)}));B=json.loads((D/f).read_text())\n\t\tif I<B[h]:(D/f).write_text(json.dumps({h:I,g:objs(O),A:J}))\n\twhile time.monotonic()-R<j:\n\t\tL+=1;E=rigid(O,N)if L%3 else O.copy();T=np.array(fast.mec(E)[:2]);Y=fast.mec(E)[2];p=[semicircle_polygon(Semicircle(*A))for A in E];P=[];Q=[];K=1e-07;t=float(N.choice([0,1e-11,5e-11,1e-10]));U=int(N.choice([2,4,8,16]))\n\t\tfor A in range(15):\n\t\t\tfor G in range(A):\n\t\t\t\tif np.sum((E[A,:2]-E[G,:2])**2)>4.001:continue\n\t\t\t\tV=p[A].intersection(p[G]).area\n\t\t\t\tif V<1e-09:continue\n\t\t\t\tC=np.zeros(48)\n\t\t\t\tfor M in[A,G]:\n\t\t\t\t\tfor F in range(3):B=E.copy();B[M,F]+=K;H=fast.intersection_area(B[A],B[G]);B[M,F]-=2*K;Z=fast.intersection_area(B[A],B[G]);C[3*M+F]=(H-Z)/(2*K)*100\n\t\t\t\tP.append(C);Q.append((1e-06-V-t)*1e8)\n\t\tif J!=1402357391:\n\t\t\tfor A in range(15):\n\t\t\t\tfor G in range(A):\n\t\t\t\t\tif abs(math.sin(E[A,2]-E[G,2]))>.001 or np.sum((E[A,:2]-E[G,:2])**2)>4:continue\n\t\t\t\t\tfor v in range(16):\n\t\t\t\t\t\tB=E.copy();B[[A,G]]+=N.uniform(-U,U,(2,3))*1e-06;V=fast.intersection_area(B[A],B[G]);C=np.zeros(48)\n\t\t\t\t\t\tfor M in[A,G]:\n\t\t\t\t\t\t\tfor F in range(3):B[M,F]+=K;H=fast.intersection_area(B[A],B[G]);B[M,F]-=2*K;Z=fast.intersection_area(B[A],B[G]);B[M,F]+=K;C[3*M+F]=(H-Z)/(2*K)*100\n\t\t\t\t\t\tP.append(C);Q.append((1e-06-V-1e-10)*1e8+C[:45]@((B-E).ravel()*1e6))\n\t\tfor A in range(15):\n\t\t\tdef a(b,q):return math.dist(fast.farthest(b,q[0],q[1]),q)\n\t\t\tW=a(E[A],T);C=np.zeros(48)\n\t\t\tfor F in range(3):B=E[A].copy();B[F]+=K;H=a(B,T);B[F]-=2*K;C[3*A+F]=(H-a(B,T))/(2*K)\n\t\t\tC[45:47]=-C[3*A:3*A+2];C[47]=-1;P.append(C);Q.append((Y-W)*1e6-1e-07)\n\t\tif J==1810134338:\n\t\t\tfor A in range(15):\n\t\t\t\tfor q in[-1,1]:F=E[A,2];H=E[A,:2]+q*np.array([-math.sin(F),math.cos(F)])-T;W=np.linalg.norm(H);b=H/W;C=np.zeros(48);C[3*A:3*A+2]=b;C[3*A+2]=b@(-q*np.array([math.cos(F),math.sin(F)]));C[45:47]=-b;C[47]=-1;P.append(C);Q.append((Y-W)*1e6-1e-06)\n\t\tc=np.zeros(48);c[47]=1;c[:45]=N.uniform(-1e-08,1e-08,45);u=np.full(48,-U,dtype=float);d=np.full(48,U,dtype=float)\n\t\tif J==3665816918:d[47]=min(d[47],(I-Y)*1e6-.01)\n\t\te=milp(c,integrality=np.r_[np.ones(45),np.zeros(3)],bounds=Bounds(u,d),constraints=LinearConstraint(np.array(P),-np.inf,np.array(Q)),options={'time_limit':min(2e1,max(.1,j-(time.monotonic()-R))),'mip_rel_gap':1e-07});o.append(int(e.status))\n\t\tif e.x is not None:\n\t\t\tB=fast.rounded(E+np.rint(e.x[:45]).reshape(15,3)*1e-06);H=official(B)\n\t\t\tif H.valid:\n\t\t\t\tS+=1\n\t\t\t\tif H.score<I:O=B;I=H.score;n.append([L,I]);X();print(J,L,I,flush=i)\n\t\t\telse:m.append({'attempt':L,r:H.errors})\n\t\tif time.monotonic()-l>60:X();l=time.monotonic();print('checkpoint',J,L,S,I,flush=i)\n\tX();print('done',J,L,S,I,flush=i)\nif __name__=='__main__':run(int(sys.argv[1]),float(sys.argv[2]))"},"search_source_characters":13685,"plot":{"format":"image/svg+xml","filename":"packing.svg","svg":"<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"720\" height=\"760\" viewBox=\"-3.35 -3.55 6.7 7.1\">\n<rect x=\"-3.35\" y=\"-3.55\" width=\"6.7\" height=\"7.1\" fill=\"white\"/>\n<text x=\"0\" y=\"-3.2\" text-anchor=\"middle\" font-size=\".17\">15 semicircles | R=2.94852695</text>\n<g transform=\"scale(1,-1)\">\n<path d=\"M 0.00513812 -0.16933089 A 1 1 0 0 1 1.08571188 1.51363089 Z\" fill=\"hsl(0,45%,78%)\" stroke=\"#333\" stroke-width=\".012\"/>\n<path d=\"M 1.92757538 -0.62833747 A 1 1 0 0 1 0.34339262 -1.84914253 Z\" fill=\"hsl(24,45%,78%)\" stroke=\"#333\" stroke-width=\".012\"/>\n<path d=\"M -1.57902877 -0.11683391 A 1 1 0 0 1 0.41078077 -0.31847209 Z\" fill=\"hsl(48,45%,78%)\" stroke=\"#333\" stroke-width=\".012\"/>\n<path d=\"M 1.18165936 -0.11818064 A 1 1 0 0 1 2.50457664 1.38178264 Z\" fill=\"hsl(72,45%,78%)\" stroke=\"#333\" stroke-width=\".012\"/>\n<path d=\"M 1.04701933 2.56812422 A 1 1 0 0 1 -0.49064733 1.28922578 Z\" fill=\"hsl(96,45%,78%)\" stroke=\"#333\" stroke-width=\".012\"/>\n<path d=\"M -0.70824096 2.80922927 A 1 1 0 0 1 -0.73918904 0.80946873 Z\" fill=\"hsl(120,45%,78%)\" stroke=\"#333\" stroke-width=\".012\"/>\n<path d=\"M -1.77335097 2.06507325 A 1 1 0 0 1 -1.47592303 0.08731275 Z\" fill=\"hsl(144,45%,78%)\" stroke=\"#333\" stroke-width=\".012\"/>\n<path d=\"M -1.56360758 0.89715619 A 1 1 0 0 1 0.42398758 0.67474781 Z\" fill=\"hsl(168,45%,78%)\" stroke=\"#333\" stroke-width=\".012\"/>\n<path d=\"M -0.73591555 1.08523404 A 1 1 0 0 1 0.80175155 2.36413196 Z\" fill=\"hsl(192,45%,78%)\" stroke=\"#333\" stroke-width=\".012\"/>\n<path d=\"M 1.69977729 0.58553394 A 1 1 0 0 1 0.82420471 2.38369206 Z\" fill=\"hsl(216,45%,78%)\" stroke=\"#333\" stroke-width=\".012\"/>\n<path d=\"M -2.57162246 0.65815809 A 1 1 0 0 1 -1.31824354 -0.90038009 Z\" fill=\"hsl(240,45%,78%)\" stroke=\"#333\" stroke-width=\".012\"/>\n<path d=\"M -2.57059891 -1.07917153 A 1 1 0 0 1 -0.57561309 -1.22070447 Z\" fill=\"hsl(264,45%,78%)\" stroke=\"#333\" stroke-width=\".012\"/>\n<path d=\"M 1.97524444 -2.18881492 A 1 1 0 0 1 0.12402556 -2.94577508 Z\" fill=\"hsl(288,45%,78%)\" stroke=\"#333\" stroke-width=\".012\"/>\n<path d=\"M -1.50123499 -2.48375475 A 1 1 0 0 1 -0.07756701 -1.07905925 Z\" fill=\"hsl(312,45%,78%)\" stroke=\"#333\" stroke-width=\".012\"/>\n<path d=\"M 1.01908906 -1.32846226 A 1 1 0 0 1 2.60324294 -0.10761974 Z\" fill=\"hsl(336,45%,78%)\" stroke=\"#333\" stroke-width=\".012\"/>\n<circle cx=\"-0.0001819080616875258\" cy=\"0.00013448997007248039\" r=\"2.948526950912552\" fill=\"none\" stroke=\"#c22\" stroke-width=\".018\"/></g>\n<text x=\"0.902561\" y=\"-0.442845\" text-anchor=\"middle\" dominant-baseline=\"middle\" font-size=\".13\">0</text>\n<text x=\"0.876421\" y=\"0.902566\" text-anchor=\"middle\" dominant-baseline=\"middle\" font-size=\".13\">1</text>\n<text x=\"-0.626913\" y=\"0.639904\" text-anchor=\"middle\" dominant-baseline=\"middle\" font-size=\".13\">2</text>\n<text x=\"2.161420\" y=\"-0.351069\" text-anchor=\"middle\" dominant-baseline=\"middle\" font-size=\".13\">3</text>\n<text x=\"0.006795\" y=\"-2.254978\" text-anchor=\"middle\" dominant-baseline=\"middle\" font-size=\".13\">4</text>\n<text x=\"-1.148077\" y=\"-1.815916\" text-anchor=\"middle\" dominant-baseline=\"middle\" font-size=\".13\">5</text>\n<text x=\"-2.044331\" y=\"-1.013077\" text-anchor=\"middle\" dominant-baseline=\"middle\" font-size=\".13\">6</text>\n<text x=\"-0.617007\" y=\"-0.364171\" text-anchor=\"middle\" dominant-baseline=\"middle\" font-size=\".13\">7</text>\n<text x=\"0.304309\" y=\"-1.398380\" text-anchor=\"middle\" dominant-baseline=\"middle\" font-size=\".13\">8</text>\n<text x=\"1.643572\" y=\"-1.670415\" text-anchor=\"middle\" dominant-baseline=\"middle\" font-size=\".13\">9</text>\n<text x=\"-2.275665\" y=\"0.387086\" text-anchor=\"middle\" dominant-baseline=\"middle\" font-size=\".13\">10</text>\n<text x=\"-1.603140\" y=\"1.573287\" text-anchor=\"middle\" dominant-baseline=\"middle\" font-size=\".13\">11</text>\n<text x=\"0.889003\" y=\"2.174454\" text-anchor=\"middle\" dominant-baseline=\"middle\" font-size=\".13\">12</text>\n<text x=\"-0.491315\" y=\"2.083519\" text-anchor=\"middle\" dominant-baseline=\"middle\" font-size=\".13\">13</text>\n<text x=\"2.070237\" y=\"1.054209\" text-anchor=\"middle\" dominant-baseline=\"middle\" font-size=\".13\">14</text>\n</svg>"},"commands":["git clone https://github.com/benedictbrady/shape-packing-challenge official","git -C official checkout 78a78626f098cd236f3a09bb2cb242f72951599d","cd official && uv sync && uv run python run.py","uv pip install --python official/.venv/bin/python numba scipy","Extract search_source files side by side; write inherited_baseline.solution to baseline.json in that directory.","official/.venv/bin/python search.py check","cp fallback.json best.json","OPENBLAS_NUM_THREADS=1 timeout 450 official/.venv/bin/python search.py 3300934389 baseline 300","OPENBLAS_NUM_THREADS=1 timeout 450 official/.venv/bin/python search.py 958726594 fresh-ring 100","OPENBLAS_NUM_THREADS=1 timeout 450 official/.venv/bin/python search.py 3220038383 fresh-grid 100","OPENBLAS_NUM_THREADS=1 timeout 450 official/.venv/bin/python search.py 3925504512 grid 360","OPENBLAS_NUM_THREADS=1 timeout 450 official/.venv/bin/python repair.py 2235833335 360","OPENBLAS_NUM_THREADS=1 timeout 450 official/.venv/bin/python milp.py 1402357391 360","OPENBLAS_NUM_THREADS=1 timeout 450 official/.venv/bin/python milp.py 2180471550 360","OPENBLAS_NUM_THREADS=1 timeout 450 official/.venv/bin/python milp.py 3665816918 360","OPENBLAS_NUM_THREADS=1 timeout 450 official/.venv/bin/python milp.py 1810134338 300","Write solution_json verbatim as solution.json and plot.svg verbatim as packing.svg.","From a separate unmodified pinned clone: uv sync; uv run python run.py /path/to/solution.json --save-plot /path/to/check.png","Full precision: load the rounded JSON as Semicircle objects, call unmodified semicircle_packing.scoring.validate_and_score, print repr(result.score) and format(result.score,\".8f\")."],"notes":["The returned baseline is numerically below 2.94853, but it is the supplied published packing, not a new record. No improved baseline-derived packing was retained.","best_new_score means a retained improvement over the supplied baseline; fresh-start results are reported separately. best_radius includes each run's initial fallback. Proposal valid_count can include duplicates and nonimproving candidates.","Seeds are the first nine uint32-range draws from numpy.random.default_rng(22005).integers(0,2**32-1,10). Search uses wall-clock budgets, so scheduling and MILP solver timing can change attempted counts on replay.","Fresh starts are independently randomized sparse ring and grid placements. They are controls for this rigid/grid strategy, not global topology optimization; rigid motion cannot close their large radius gap.","Official checks ran locally only. No submission, login, or signing was performed.","All five source quotations were checked against downloaded page/source text. The pinned clone has an empty git diff.","Final validation is a separate process using a fresh unmodified clone; no second agent was available, so the requested different-agent rerun is not claimed.","Strict zero-overlap radius was not measured. The official polygon tolerance, not exact circular-area validity, determines this result.","Analytical scorer reused from the handed hand-built result, with provenance hash above; other handed scores are reported inputs rather than independent verifications.","Temporary clones, dependencies and checkpoints are scratch work. The deliverable is the two requested JSON files, including solution text, SVG and code; reproduction of searches requires the stated Python dependencies."]}
