Update from HH
[Flyspeck/.git] / legacy / glpk / glpk / tame_archive_hard_notes.hl
1 (* ========================================================================== *)
2 (* FLYSPECK - CODE FORMALIZATION                                              *)
3 (*                                                                            *)
4 (* Lemma: Linear Programs                                                     *)
5 (* Program: Tame Hypermap                                                     *)
6 (* Author: Thomas C. Hales                                                    *)
7 (* Date: 2010-08-01                                                           *)
8 (* ========================================================================== *)
9
10
11
12
13 (* Case notes for the various hard cases 
14
15    This code probably isn't directly executable, because it consists
16    of notes from interactive sessions, run over a period of about a
17    year (but mostly at the beginning of August, 2010).  
18
19    It is a historical trace of how I got all the linear programs to work
20    to eliminate the 12 hard tame hypermaps.
21
22    It is part of the scafffolding.  It has served its purpose and is no longer
23    needed, except as a historical record.
24 *)
25
26 (*
27 When running these scripts, I opened all modules in sight!
28
29 Glpk_link, Lpproc, Hard_lp, Temp_ineq, Tame_scaffolding, List,...
30
31 *)
32
33 raise (failwith "File is not executable");;
34
35
36 open Temp_ineq;;
37
38 (*
39
40 (* There are parallel versions of several functions here XX and
41   XX_include_flat.  I think we can use the XX_include_flat version
42   everywhere and delete the others.
43 *)
44
45   let add_hints_force bb = 
46   try(
47   let _ = init_hash bb in
48   let dart = snd(hd(sorted_azim_weighted_diff darts_of_std_tri bb)) in 
49   let f = face_of_dart dart bb in
50   if not(mem f (bb.std3_big @ bb.std3_small)) then bb.hints <-  [Triangle_split f] else
51   let f1 = subtract f  (bb.node_200_218 @ bb.node_218_252) in
52   if not(f1 = []) then bb.hints <- [High_low (hd f1)] else 
53   let f2 = intersect (highish bb) f in
54   if not(f2 = []) then  bb.hints <- [High_low (hd f2)] else
55   let d1 = subtract (rotation [dart]) (bb.d_edge_200_225 @ bb.d_edge_225_252) in
56   if not (d1 = []) then bb.hints <- [Edge_split (hd d1)] else ()
57   ) with Failure _ -> failwith "add_hints";;
58
59   let add_hints bb = 
60   if not(is_feas bb) then () else
61   if not(bb.hints = []) then () else
62   add_hints_force bb;;
63
64   let filter_feas_hint bbs = filter_feas_f add_hints bbs;;
65
66   let onepass_hint = function 
67   [] -> []
68   | bb::bbss as bbs -> 
69   let _ = onepass_backup := bbs in
70   let brs =  switch_hint bb in
71   let brs1 = map set_face_numerics brs in
72   let brs2 = map set_node_numerics brs1 in
73   let _ = echo bbs in
74   sortbb ((filter_feas_hint brs2) @ bbss);;
75
76   let rec allpass_hint count bbs = 
77   if  count <= 0 then bbs else allpass_hint (count - 1) (onepass_hint bbs);;
78 *)
79
80 let resolve_with_hints t = 
81   let u = resolve t in 
82   let _ = add_hints_force u in
83     u;;
84
85
86 (* ========================================================================== *)
87 (* Case: Hard 11                                                             *)
88 (* ========================================================================== *)
89  
90
91
92 (* early note on case 11 *)
93
94
95 let bb = findid "34970074286" hard_bb;;
96
97 let bb1 = allpass 2 [bb];;
98 let bb2 = allpass 4 bb1;;
99 let bb3 = allpass 15 bb2;;
100 length bb3;; (* 992 *)
101 map (fun t -> t.lpvalue) bb3;;
102
103 let bbmax = find_max bb3;;
104 bbmax;;
105
106 init_dumpfile bbmax;;
107 init_hash();;
108 yn 0;;
109
110 dumpfile;;
111 get_dumpvar "yn.1.*=";; 
112 get_azim_table dih_y [5;4;3] bbmax;;
113
114 get_azim_diff dih_y [4;3;5] bbmax;;
115 get_tri bbmax;;
116 biggest_azim_diff dih_y bbmax;;
117
118
119
120 (* ========================================================================== *)
121 (* Case: Hard 9                                                               *)
122 (* ========================================================================== *)
123  
124
125 Glpk_link.resetc();;
126 let b1 = allpass_hint 500 [hard 9];;
127 let bx = nth b1 0;; (* 12.011042 , it has become worse?? *) (* 12.0074 *)
128 #print_length 600;;
129 resolve_with_hints bx;; (* 0 *)
130 let b1' = tl b1;;
131 let b2 = allpass_hint 500 b1';;
132
133
134 (* ========================================================================== *)
135 (* Case: Hard 8                                                               *)
136 (* ========================================================================== *)
137
138
139
140 (* hard 8 , early notes work in progress.  *)
141 Glpk_link.resetc();;
142 let b1 = allpass_hint 500 [hard 8];;
143 let bx = hd b1;;
144
145 (* Aug 3 notes on hard 8. *)
146 length (filter (fun t-> (t.hints = [])) b1);;
147 bx;;
148 sorted_azim_diff darts_of_std_tri bx;; 
149 sorted_azim_weighted_diff (fun bb -> rotation (bb.apex_flat))  bx;; 
150 display_ampl bx;;
151 get_azim_table[6;11;4] bx;; (* lll_xww *)
152 let jj = generate_ineq_datum_p  
153   "Dihedral" "{2,2,2.14,2,2.25,2.25}" "{2,2,2,2,2.25,2.25}" "{2.18,2.18,2.18,2.52,2.52,2.52}";;
154 jj;;
155 let fjj = ocaml_eval jj;;
156 testval fjj  [6;11;4] bx;;  (* 0.035  not great, but use it *)
157
158 (* Aug 3 am . TO HERE, the ineq above has been added to the system,
159    but haven't called remake, the one below is in the makes.  It
160    hasn't been added, still at the experimentation stages.  *)
161
162 get_azim_table [3;6;4] bx;;   (* lll_wxx *)
163 let kk = generate_ineq_datum  "Dihedral2" "{2,2,2,2.25,2,2}" "{2.18,2.18,2.18,2.52,2.52,2.52}";;
164 let fkk = ocaml_eval kk;;
165 testvalsym fkk [3;6;4] bx;;  (* 0.012, not great, but use *)
166 let bx1 = clone bx;;
167 remake_model();;
168 bx.lpvalue;;  (* 12.05 *)
169 resolve_with_hints bx1;;  (* This digression has helped.  12.018 *)
170 length b1;;
171 get_azim_table [3;4;0] bx;;  
172 let jj1 = generate_ineq_datum_p  
173   "mDihedral" "{2.18,2.1,2.1,2.52,2,2}" "{2,2,2,2.52,2,2}" "{2.52,2.52,2.52,sqrt8,2.52,2.52}";;
174 let fjj1 = ocaml_eval jj1;;
175 testvalsym fjj1 [3;4;0] bx;;  (* 0.045, not great, but use *)
176 let bx1 = clone bx;;
177 remake_model();;
178 resolve_with_hints bx1;;  (* This digression didn't  help, still  12.018 *)
179 get_azim_table [3;4;0] bx1;;  (* but it made the angles more accurate. *)
180 sorted_azim_diff darts_of_std_tri bx1;;  (* [6;3;2], a mini *)
181 get_azim_table [6;3;2] bx1;;
182 let jj2 = generate_ineq_datum_p 
183    "Dihedral" "{2,2.18,2.18,2,2.25,2.25}" "{2,2,2,2,2,2}" "{2.18,2.18,2.18,2.25,2.25,2.25}";;
184 let fjj2 = ocaml_eval jj2;;
185 testval fjj2 [6;3;2] bx1;;   (* 0.005 huge improvement, use *)
186 get_azim_table [6;3;2] bx1;;
187 let jj3 = generate_ineq_datum_p 
188    "mDihedral2" "{2,2.18,2.18,2,2.25,2.25}" "{2,2,2,2,2,2}" "{2.18,2.18,2.18,2.25,2.25,2.25}";;
189 jj3;;
190 let fjj3 = ocaml_eval jj3;;
191 testval fjj3 [6;3;2] bx1;;   (* 0.003 huge improvement, use *)
192 let bx2 = clone bx;;
193 remake_model();;
194 resolve_with_hints bx2;;  (* still 12.018 *)
195 get_azim_table [6;3;2] bx2;;  (* This didn't fix the angles, there must be a bug *)
196 (* why didn't 9828015955 ineq get used?? *)
197 display_lp bx2;;
198 modelbody;;
199 Glpk_link.cpx_branch model "/tmp/cpx.out"  ampl_of_bb bx2;;
200 (* bug found dart_std3_mini incorrectly defined in head.mod, fixed. Aug 3, 2010 *)
201 let bx2 = clone bx;;
202 remake_model();;
203 resolve_with_hints bx2;;  (* still 0.0, bug fixed!, unneeded mini inequalities removed. *)
204
205
206
207 (* hard 8 , restart work in progress.  *)
208 Glpk_link.resetc();;
209 let b1 = allpass_hint 5000 [hard 8];;  (* runs out of hints at 3177, stack stize 1025 *)
210
211 (* Aug 4 *)
212 length b1;;
213 let bx = hd b1;;
214 bx;;
215 sorted_azim_diff darts_of_std_tri bx;; 
216 sorted_azim_weighted_diff (fun bb -> rotation (bb.apex_flat))  bx;; 
217 unset_edge bx;;
218 get_azim_table[3;6;4] bx;;
219 let jj = generate_ineq_datum_p  
220   "Dihedral2" "{2.18,2,2,2.52,2,2.25}" "{2,2,2,2.25,2,2}" "{2.18,2.18,2.18,2.52,2.52,2.52}";;
221 jj;;
222 let fjj = ocaml_eval jj;;
223 testval fjj  [3;6;4] bx;;  (* 0.041   use it *)
224 let jj1 = generate_ineq_datum_p  
225   "mDihedral3" "{2.18,2,2,2.52,2,2.25}" "{2,2,2,2.25,2,2}" "{2.18,2.18,2.18,2.52,2.52,2.52}";;
226 jj1;;
227 let fjj1 = ocaml_eval jj1;;
228 testval fjj1  [3;6;4] bx;;  (* 0.018   use it *)
229 testvalsym fjj1 [11;4;6] bx;;
230 get_azim_table[11;4;6] bx;;
231 get_azim_table[3;2;6] bx;;
232 let bx1 = clone bx;;
233 let bx1 = resolve_with_hints bx1 (* drops to 0 *);;
234
235 (* OK, lets go again *)
236 map (fun t -> t.lpvalue <- None) b1;;
237 let b1' = filter_feas_hint b1;;
238 let b1'' = sortbb b1';;
239 let bx = hd b1'';;
240 sort (<) bx.d_edge_200_225;;
241 resolve_with_hints bx;; 
242 sorted_azim_diff darts_of_std_tri bx;; 
243 sorted_azim_weighted_diff darts_of_std_tri bx;; 
244 sorted_azim_weighted_diff (fun bb -> rotation (bb.apex_flat))  bx;; 
245 unset_edge bx;;
246 get_azim_table[2;7;6] bx;;
247 get_azim_table[2;6;3] bx;;
248 get_azim_table[4;6;11] bx;;
249 get_azim_table[4;3;6] bx;;
250 let kk1 = generate_ineq_datum
251   "mDihedral" "{2.18,2,2,2,2.25,2}" "{2.36,2.18,2.18,2.25,2.52,2.25}";;
252 let fkk1 = ocaml_eval kk1;;
253 testval fkk1  [2;7;6] bx;;
254 testvalsym fkk1[2;6;3] bx;;
255 testvalsym fkk1[4;6;11] bx;;
256 testval fkk1[4;3;6] bx;;
257 let kk2 = generate_ineq_datum_p
258   "mDihedral" "{2.18,2,2,2.25,2.52,2}" "{2.18,2,2,2,2.25,2}" "{2.36,2.18,2.18,2.25,2.52,2.25}";;
259 let fkk2 = ocaml_eval kk2;;
260 testval fkk2  [2;7;6] bx;;
261 testvalsym fkk2[2;6;3] bx;;
262 testvalsym fkk2[4;6;11] bx;;
263 testval fkk2[4;3;6] bx;;
264 kk2;;
265 let kk3 = generate_ineq_datum_p
266   "mDihedral" "{2.18,2,2,2.25,2.52,2}" "{2.18,2,2,2,2,2}" "{2.36,2.18,2.18,2.25,2.52,2.52}";;
267 let fkk3 = ocaml_eval kk3;;
268 testval fkk3  [2;7;6] bx;;
269 testvalsym fkk3[2;6;3] bx;;
270 testvalsym fkk3[4;6;11] bx;;
271 testval fkk3[4;3;6] bx;;
272 let kk4 = generate_ineq_datum_p
273   "Dihedral2" "{2.18,2,2,2.25,2,2.52}" "{2.18,2,2,2,2,2}" "{2.36,2.18,2.18,2.25,2.52,2.52}";;
274 let fkk4 = ocaml_eval kk4;;
275 testval fkk4  [2;7;6] bx;;
276 testval fkk4[2;6;3] bx;;
277 testval fkk4[4;6;11] bx;;
278 testvalsym fkk4[4;3;6] bx;;
279 kk3;;
280 kk4;;
281 remake_model();;
282 let bcx = clone bx;;
283 resolve bcx;;
284
285 (* OK, lets go again *)
286 map (fun t -> t.lpvalue <- None) b1'';;
287 let b2 = sortbb(filter_feas_hint b1'');;
288 length b2;;
289 let bx = hd b2;;
290 bx;;
291 sort (<) bx.d_edge_225_252;;
292 unset_edge bx;;
293 resolve_with_hints bx;; 
294 sorted_azim_diff darts_of_std_tri bx;; 
295 sorted_azim_weighted_diff darts_of_std_tri bx;; 
296 (* [6;2;3], [3;6;4], [6;7;12], [6;2;7], [4;6;11], [7;12;6], *)
297 sorted_azim_weighted_diff (fun bb -> rotation (bb.apex_flat))  bx;; 
298 get_azim_table[3;6;4] bx;;
299
300 (* continue *)
301 let b3 = allpass_hint 500 b2;;
302 let b4 = allpass_hint 1500 b3;;
303
304 length b3;;
305 let bx = hd b3;;
306 sort (<) bx.d_edge_225_252;;
307 unset_edge bx;;
308 sorted_azim_diff darts_of_std_tri bx;; 
309 sorted_azim_weighted_diff darts_of_std_tri bx;; 
310 get_azim_table[6;7;12] bx;;
311
312
313
314 (* ========================================================================== *)
315 (* Case: Hard 7                                                               *)
316 (* ========================================================================== *)
317  
318
319
320 (* starts out at 12.4 *)
321
322 let b1 =  allpass_hint 10 [hard 7];;
323
324 (* hard 6 done, hard 4 done, hard 2 done *)
325
326
327 (* ========================================================================== *)
328 (* Case: Hard 5                                                               *)
329 (* ========================================================================== *)
330  
331
332 (* starts at 12.291 *)
333 resetc();;
334 let b1 = allpass_hint 505 [hard 5];;
335 length b1;;
336 let b2 = allpass_hint 5000 b1;;
337 let bxi = hd !onepass_backup;;
338
339
340
341
342 (* ========================================================================== *)
343 (* Case: Hard 3                                                               *)
344 (* ========================================================================== *)
345
346 resetc();;
347 let c1 =  allpass_hint 1500 [hard 3];;  
348 let cx = hd c1;;  (* 12.041 , about 600 cases *)
349 resolve_with_hints_include_flat cx;;
350 let c2 = allpass_hint_include_flat 500 c1;;
351 length c2;;
352 let cx = hd c2;;  (* 12.036, 598 cases *)
353 length cx.node_200_218;;
354 #print_length 1000;;
355 sorted_azim_diff darts_of_std_tri cx;; (* 0.04 *)
356 sorted_azim_weighted_diff darts_of_std_tri cx;;  (* 0.012 *)
357 sorted_azim_weighted_diff (fun bb -> rotation (bb.apex_flat))  cx;;  (* 0.119 *)
358 sorted_azim_weighted_diff (fun bb -> rotation (bb.apex_sup_flat))  cx;;  (* 0.332 *)
359 [0;1;2];;
360 get_azim_table[1;2;0] cx;;
361 cx;;
362
363 let kk1 = generate_ineq_datum
364   "mDihedral3" "{2,2,2,sqrt8,2,2}" "{2.52,2.52,2.52,3.0,2.52,2.52}";;
365 let fkk1 = ocaml_eval kk1;;
366 testval fkk1  [1;2;0] cx;;  (* improves to 0.024, use. *)
367 kk1;;
368
369 let kk2 = generate_ineq_datum_p
370   "Dihedral2" "{2.1,2.1,2.3,sqrt8,2.1,2.1}" "{2,2,2,sqrt8,2,2}" "{2.52,2.52,2.52,3.0,2.52,2.52}";;
371 let fkk2 = ocaml_eval kk2;;
372 testval fkk2  [1;2;0] cx;;  (* improves to 0.074, use. *)
373 kk2;;
374 remake_model();;
375 resolve_with_hints_include_flat cx;;
376
377 (* restart *)
378 let c3 = allpass_hint_include_flat 500 c2;;
379 length c3;; (* 98 , worst is 12.015 *)
380 let c4 = allpass_hint_include_flat 500 c3;; 
381
382
383 (* rerun *)
384
385 b65974205892();;
386
387
388 (* ========================================================================== *)
389 (* Case: Hard 2                                                               *)
390 (* ========================================================================== *)
391
392
393
394 let c1 =  allpass_hint 100 [hard 2];;
395 let c2 = allpass_hint 1000 c1;;
396
397
398
399 (* ========================================================================== *)
400 (* Case: Hard 0                                                               *)
401 (* ========================================================================== *)
402
403
404 (* NEW CASE *)
405 resetc();;
406 (* with prune size 10, the list died out before an empty hint was found *)
407
408 let b1 = allpass_prune_hint 80 1000 [hard 0];;
409 let bx = hd b1;;
410
411 sorted_azim_diff darts_of_std_tri bx;; (* [2;0;1]; 0.14,   [0;1;2];   [4;2;1]; [2;3;0]  *)
412 get_azim_table[0;1;2] bx;;
413 nub (sort (<) (map (fun t-> t.node_218_252) (filter (fun t-> 2 = length t.node_218_252) b1)));;
414
415 bx;;
416 let kk1 = generate_ineq_datum_p
417   "Dihedral" "{2,2.18,2.18,2,2.25,2.25}" "{2,2.18,2.18,2,2,2}" "{2.18,2.52,2.52,2.52,2.52,2.52}";;
418 let fkk1 = ocaml_eval kk1;;
419 testval fkk1  [0;1;2] bx;;  (* improves to 0.0727, use. *)
420 let kk2 = generate_ineq_datum_p
421   "mDihedral2" "{2,2.18,2.18,2,2.25,2.25}" "{2,2.18,2.18,2,2,2}" "{2.18,2.52,2.52,2.52,2.52,2.52}";;
422 let fkk2 = ocaml_eval kk2;;
423 testvalsym fkk2  [0;1;2] bx;;  (* improves to 0.0402, use. *)
424 remake_model();;
425 let bcx = clone bx;;
426 resolve_with_hints bcx;;
427
428 (* restart *)
429 let b2 = map resolve_with_hints b1;;
430 let b3 = allpass_prune_hint 80 100 b2;;
431 let bx = hd b3;; (* 12.02 *)
432 sorted_azim_diff darts_of_std_tri bx;; (* [3;8;0]; [1;5;4] *)
433 sorted_azim_weighted_diff darts_of_std_tri bx;; (* [3;8;0]; [1;5;4] *)
434 get_azim_table[3;8;0] bx;;
435 bx;;
436 let b4 = allpass_prune_hint 80 300 b3;;
437 let bx = hd b4;;  (* 12.007 *)
438 sorted_azim_diff darts_of_std_tri bx;; (* [4;2;1]; [0;1;2]; [0;3;8]; [4;1;5]; [4;3;2]; *)
439 sorted_azim_weighted_diff darts_of_std_tri bx;; (* [3;8;0]; [1;5;4] *)
440 let b5 = allpass_prune_hint 80 300 b4;;  (* this goes to zero as well *)
441
442 (* restart *)
443 resetc();;
444 let b1 = allpass_hint 10000 [hard 0];;
445
446
447
448 (* ========================================================================== *)
449 (* Case: Hard 1                                                               *)
450 (* ========================================================================== *)
451
452
453 (* NEW CASE *)
454
455 resetc();;
456 let b1 = allpass_hint_include_flat 30000 [hard 1];;
457 (* runs to 13334 before giving one without hints *)
458 length b1;;  (* 1430 *)
459 let bx = hd b1;;  (* 12.004, almost there!  *)
460 map (fun t-> length t.node_236_252) b1;;
461 sorted_azim_diff darts_of_std_tri bx;; (* [5;3;2]; [6;5;2]  [5;4;3] *)
462 sorted_azim_weighted_diff darts_of_std_tri bx;; (* 0 *)
463 sorted_azim_weighted_diff (fun bb -> rotation (bb.apex_flat))  bx;;  (* [1;2;3], [1;3;0] *)
464 bx;;
465 length bx.node_200_218;;
466 get_azim_table[2;3;1] bx;;
467 let kk1 = generate_ineq_datum_p
468   "Dihedral3" "{2.36,2.1,2.1,2.6,2.1,2.1}" "{2.18,2,2,2.52,2,2}" "{2.52,2.52,2.52,sqrt8,2.52,2.52}";;
469 let fkk1 = ocaml_eval kk1;;
470 testval fkk1  [2;3;1] bx;; 
471 let kk3 = generate_ineq_datum_p
472   "Dihedral3" "{2.36,2.1,2.1,2.55,2.1,2.0}" "{2.18,2,2,2.52,2,2}" "{2.52,2.52,2.52,sqrt8,2.52,2.52}";;
473 let fkk3 = ocaml_eval kk3;;
474 testval fkk3  [2;3;1] bx;; 
475 kk3;;
476 let kk3 = generate_ineq_datum_p
477   "Dihedral3" "{2.36,2.1,2.1,2.55,2.1,2.0}" "{2,2,2,2.52,2,2}" "{2.52,2.52,2.52,sqrt8,2.52,2.52}";;
478 let fkk3 = ocaml_eval kk3;;
479 testval fkk3  [2;3;1] bx;; 
480 kk3;;
481 let kk2 = generate_ineq_datum_p
482   "Dihedral3" "{2.36,2.1,2.1,2.6,2.1,2.1}" "{2.18,2,2,2.52,2,2}" "{2.52,2.18,2.18,sqrt8,2.52,2.52}";;
483 let fkk2 = ocaml_eval kk2;;
484 testval fkk2  [2;3;1] bx;; 
485 get_azim_table[2;5;3] bx;;
486 let jj1 = generate_ineq_datum_p
487   "mDihedral3" "{2.36,2.1,2.1,2.45,2.,2.45}" "{2.18,2,2,2,2,2}" "{2.52,2.18,2.18,2.52,2.52,2.52}";;
488 let fjj1 = ocaml_eval jj1;;
489 testval fjj1  [2;5;3] bx;;
490 jj1;;
491
492 get_azim_table[2;5;3] bx;;
493 let jj2 = generate_ineq_datum_p
494   "Dihedral2" "{2.36,2.1,2.1,2.45,2.,2.45}" "{2.18,2,2,2,2,2}" "{2.52,2.18,2.18,2.52,2.52,2.52}";;
495 let fjj2 = ocaml_eval jj2;;
496 testval fjj2  [2;5;3] bx;;
497 jj2;;
498
499 get_azim_table[2;6;5] bx;;
500 testvalsym fjj1 [2;6;5] bx;;
501 testvalsym fjj2 [2;6;5] bx;;
502
503 kk3;;
504 Ineq.getexact "6725783616";;
505 Ineq.getexact "9185711902";;
506 Ineq.getexact "6284721194";;
507 remake_model();;
508 let bcx = clone bx;;
509 resolve_with_hints bcx;;
510
511 (* restart *)
512 let b1' = map resolve_with_hints_include_flat b1;;
513
514 let b2 = sortbb(filter_feas_hint b1);;
515 length b2;;  (* 564, this is more reasonable! *)
516 let bx = hd b2;;
517 sorted_azim_diff darts_of_std_tri bx;; (* [5;11;10] [5;4;3] [1;6;2] *)
518 sorted_azim_weighted_diff darts_of_std_tri bx;; 
519 sorted_azim_weighted_diff (fun bb -> rotation (bb.apex_flat))  bx;;
520 get_azim_table [2;3;1] bx;;
521 let b3 = allpass_hint_include_flat 1000 b2;;
522 length b3;; (* down to 158 *)
523 let b4 = allpass_hint_include_flat 1000 b3;;
524 b4 = [];;
525
526
527 (* ========================================================================== *)
528 (* Case: Hard 5                                                               *)
529 (* ========================================================================== *)
530
531
532 resetc();;
533 let b1 =  allpass_hint_include_flat 30000 [hard 5];;
534 let bx = hd b1;;
535 sorted_azim_diff darts_of_std_tri bx;; (* [5;9;0]; [1;0;9];  *)
536 sorted_azim_weighted_diff darts_of_std_tri bx;;  (* 0 *)
537 sorted_azim_weighted_diff (fun bb -> rotation (bb.apex_flat))  bx;; (* [1;3;0]  [5;0;3] *)
538 get_azim_table [0;1;3]bx ;;
539 get_azim_table [0;3;5] bx;;
540 length b1;; (* 1575 *)
541 map (fun t-> (length t.node_218_236,length t.node_236_252)) b1;;
542 map (fun t -> t.node_218_236) b1;;
543 bx;; (* 12.014 *)
544 let jj1 = generate_ineq_datum_p
545   "Dihedral2" "{2.25,2,2.18,2.65,2.,2.2}" "{2.18,2,2,2.52,2,2}" "{2.52,2.52,2.52,sqrt8,2.52,2.52}";;
546 let fjj1 = ocaml_eval jj1;;
547 testval fjj1  [0;1;3] bx;;
548 testvalsym fjj1  [0;3;5] bx;;  (* use *)
549 let jj2 = generate_ineq_datum_p
550   "Dihedral2" "{2.25,2,2.18,2.65,2.,2.2}" "{2.18,2,2,2.52,2,2}" "{2.36,2.52,2.52,sqrt8,2.52,2.52}";;
551 let fjj2 = ocaml_eval jj2;;  (* don't use *)
552 testval fjj2  [0;1;3] bx;;
553 remake_model();;
554 let bcx = clone bx;;
555
556
557 (* restart case 5 *)
558 resetc();;
559 let b1 =  allpass_hint_include_flat 30000 [hard 5];;
560
561 (* This is the last of the 
562 linear programming cases.  This is when it finished running:
563 Thu Aug  5 13:31:11 ICT 2010  *)
564
565
566 1;;
567
568 (* ========================================================================== *)
569 (* Case: OLD NOTES, 2009- July 31, 2010                                       *)
570 (* ========================================================================== *)
571
572 (* OLD *)
573
574 (* pick it up here tomorrow *)
575 let jj = generate_ineq_datum_p
576   "mDihedral" "{2.09,2.1,2.1,2.52,2,2}"  
577    "{2,2,2,2.52,2,2}" "{2.18,2.52,2.52,sqrt8,2.52,2.52}";;
578 let fn = Temp_ineq.ocaml_eval jj;;
579 testvalsym fn [3;4;0] bx;;
580
581 testvalsym (Temp_ineq.ocaml_eval(hd(Ineq.getexact "8384511215"))) [0;3;5] bx;;
582 testvalsym (Temp_ineq.ocaml_eval(hd(Ineq.getexact "7291663656"))) [0;3;5] bx;;
583 testvalsym (fun y1 y2 y3 y4 y5 y6 -> [y1;y2;y3;y4;y5;y6]) [0;3;5] bx;;
584 let jj = generate_ineq_datum_p
585   "Dihedral2" "{2.18,2.18,2,2.65,2,2.3}"  
586    "{2,2,2,2.52,2,2}" "{2.18,2.52,2.52,sqrt8,2.52,2.52}";;
587
588
589 get_azim_table [0;1;3] bx;;
590 let ii = generate_ineq_datum_p "Dihedral2" "{2,2,2.3,2.65,2,2.2}"
591  "{2,2,2,2.52,2,2}" "{2.52,2.52,2.52,sqrt8,2.52,2.52}";;
592 let fn = Temp_ineq.ocaml_eval ii;;
593 testvalsym fn [0;3;5] bx;; (* 0.139931, lousy here, need a new ineq. *)
594 testval fn [4;5;3] bx;;  (* 0.0629 , install it. *)
595 testval fn [0;1;3] bx;;  (* 0.0464 , install it. *)
596 testvalsym (fun y1 y2 y3 y4 y5 y6 -> [y1;y2;y3;y4;y5;y6]) [0;3;5] bx;;
597 let jj = generate_ineq_datum_p "Dihedral2" "{2.18,2.0,2.2,2.6,2.0,2.25}"
598    "{2,2,2,2.52,2,2}" "{2.52,2.52,2.52,sqrt8,2.52,2.52}";;
599 let jj = generate_ineq_datum 
600   "Dihedral" "{2,2,2,2,2,2}" "{2.18,2.18,2.18,2.25,2.25,2.25}";;
601 let jj = generate_ineq_datum_p
602   "Dihedral" "{2,2.1,2.1,2,2.25,2.25}" "{2,2,2,2,2,2}" "{2.18,2.18,2.18,2.25,2.25,2.25}";;
603 let fnjj = Temp_ineq.ocaml_eval jj;;
604 let idq = hd(Ineq.getexact "9229542852");;
605 let fn9 = Temp_ineq.ocaml_eval idq;;
606 testval fnjj [5;9;0] bx;;
607 get_azim_table [5;9;0] bx;;
608 remake_model();;
609 resolve (hard 9);;
610
611
612
613 (* OLD experiments *)
614
615 #print_length 600;;;
616 let bx = hd b2;;
617 bx;; (* 12.001 *)
618 sorted_azim_diff darts_of_std_tri bx;; 
619 get_azim_table [2;0;1] bx;;
620 get_azim_table [2;3;0] bx;;
621 get_azim_table [2;1;4] bx;;
622 let ii = hd(Ineq.getexact "7409690040");;
623 ocaml_fun_of_ineq  ii.ineq;;
624 let fxx = (fun y1 y2 y3 y4 y5 y6 -> ( dih2_y y1 y2 y3 y4 y5 y6  +. 0.0042) -. (0.952682 +. (((-. 0.268837) *. ((-. 2.36) +. y1)) +. ((0.130607 *. ((-. 2.) +. y2)) +. (((-. 0.168729) *. ((-. 2.) +. y3)) +. (((-. 0.0831764) *. ((-. 2.52) +. y4)) +. ((0.580152 *. ((-. 2.) +. y5)) +. (0.0656612 *. ((-. 2.25) +. y6)))))))));;
625 testval fxx [2;0;1] bx;;
626 remake_model();;
627 resolve amx2;;  (* 2.063 *)
628 add_hints_force amx2;;
629
630
631 (* <= Jul 31 2010 *)
632
633 let tests = ref [];;
634
635 (* std4_diag3 disappears: *)
636 length hard_bb;;  (* 12 *)
637
638
639 let testsuper _ = 
640   let allhardpassA_bb = allpass 3 hard_bb in 
641   let allhardpassS_bb =  (filter (fun t -> length t.std4_diag3 >0) allhardpassA_bb) in
642   let allhardpassF_bb =  filter (fun t -> ( length t.std4_diag3 = 0) && (length t.apex_sup_flat > 0))  allhardpassA_bb in 
643     allhardpassS_bb = [] && allhardpassF_bb = [];; 
644
645 tests := testsuper :: !tests;;
646
647 (* July 29 , 2010  "161847242261" starts out 12.06... *)
648 let b1 = onepass_hint [hard 0];;
649 let b2 = allpass_prune_hint 15 [hard 0];;
650 let b3 = allpass_prune_hint 15 b2;;
651 let b4 = allpass_prune_hint 15 b3;;
652 let b5 = allpass_prune_hint 15 b4;;
653 map (fun bb -> bb.hints) b5;;
654 let c1 = find_max b5;;  (* runs out of hints at this stage, length of b5 is only 8 *)
655
656 (* 223336279535, starts out at 12.130 *)
657 let a1 = onepass_hint [hard 1];;
658 let a2 = allpass_prune_hint 5 15 [hard 1];;
659 let a3 = allpass_prune_hint 5 15 a2;;
660 find_max (!onepass_backup);;
661
662 (* see where this goes....  July 29, 2010, stack started at 145 *)
663 let a_test_july29 = allpass_prune_hint 40 80 hard_bb;;
664 let a0 = a_test_july29;;
665 map (fun bb -> bb.hints) a0;; (* no hints left *)
666 let amx = find_max (a0);;
667 map (fun bb -> bb.hypermap_id) a0;;
668 get_azim_table [4;5;3] amx;;
669 get_azim_table [0;3;5] amx;;
670  (fun bb -> (bb.node_200_218,bb.node_218_236,bb.node_236_252)) amx;;
671 fst(chop_list 15 (sorted_azim_diff darts_of_std_tri amx));;
672
673
674 darts_of_std_tri;;
675 find_max (!onepass_backup);;
676
677 #print_length 600;;
678 amx;;
679 let amx2 =   {hypermap_id = "154005963125"; lpvalue = None; hints = [];
680    diagnostic = No_data;
681    string_rep =
682     "154005963125 20 4 0 1 2 3 4 0 3 4 5 3 4 3 2 3 4 2 6 3 6 2 7 3 7 2 1 3 7 1 8 3 8 1 9 3 9 1 0 3 9 0 5 3 9 5 10 3 10 5 11 3 11 5 4 3 11 4 6 3 11 6 12 3 12 6 7 3 12 7 8 3 12 8 10 3 8 9 10 3 10 11 12 ";
683    std_faces_not_super =
684     [[4; 3; 2]; [4; 2; 6]; [6; 2; 7]; [7; 2; 1]; [7; 1; 8]; [8; 1; 9];
685      [9; 1; 0]; [9; 0; 5]; [9; 5; 10]; [10; 5; 11]; [11; 5; 4]; [11; 4; 6];
686      [11; 6; 12]; [12; 6; 7]; [12; 7; 8]; [12; 8; 10]; [8; 9; 10];
687      [10; 11; 12]];
688    std56_flat_free = []; std4_diag3 = [];
689    std3_big = [[7; 1; 8]; [9; 1; 0]; [9; 0; 5]; [8; 1; 9]; [9; 5; 10]];
690    std3_small =
691     [[11; 4; 6]; [6; 2; 7]; [10; 11; 12]; [11; 6; 12]; [12; 6; 7];
692      [12; 7; 8]; [7; 2; 1]; [4; 2; 6]; [11; 5; 4]; [12; 8; 10]; [10; 5; 11];
693      [8; 9; 10]; [4; 3; 2]];
694    apex_sup_flat = [];
695    apex_flat = [[4; 5; 3]; [0; 3; 5]; [2; 3; 1]; [0; 1; 3]]; apex_A = [];
696    apex5 = []; apex4 = [];
697    d_edge_225_252 = [[5; 9; 0]; [9; 1; 0]; [9; 5; 10]; [1; 9; 8]];
698    d_edge_200_225 =
699     [[11; 4; 6]; [4; 6; 11]; [6; 11; 4]; [6; 2; 7]; [2; 7; 6]; [7; 6; 2];
700      [10; 11; 12]; [11; 12; 10]; [12; 10; 11]; [11; 6; 12]; [6; 12; 11];
701      [12; 11; 6]; [12; 6; 7]; [6; 7; 12]; [7; 12; 6]; [12; 7; 8]; [7; 8; 12];
702      [8; 12; 7]; [7; 2; 1]; [2; 1; 7]; [1; 7; 2]; [4; 2; 6]; [2; 6; 4];
703      [6; 4; 2]; [11; 5; 4]; [5; 4; 11]; [4; 11; 5]; [7; 1; 8]; [8; 7; 1];
704      [1; 8; 7]; [12; 8; 10]; [8; 10; 12]; [10; 12; 8]; [0; 5; 9]; [9; 0; 5];
705      [10; 5; 11]; [5; 11; 10]; [11; 10; 5]; [8; 9; 10]; [9; 10; 8];
706      [10; 8; 9]; [0; 9; 1]; [1; 0; 9]; [10; 9; 5]; [8; 1; 9]; [9; 8; 1];
707      [5; 10; 9]; [4; 3; 2]; [3; 2; 4]; [2; 4; 3]];
708    node_218_252 = [3]; node_236_252 = [3]; node_218_236 = [];
709    node_200_218 = [6; 11; 12; 7; 2; 0; 4; 10; 5; 9; 1; 8]};;
710
711 (* amx2;; 2.1878 *)
712 resolve amx2;;
713 add_hints_force amx2;;
714 sorted_azim_diff darts_of_std_tri amx2;; 
715 sorted_azim_weighted_diff (fun bb -> rotation (bb.apex_flat))  amx2;; 
716 (* [(0.17937279505957382, [3; 4; 5]); (0.129169044058939808, [5; 3; 4]);
717    (0.115889948342437377, [5; 0; 3]); (0.101279767307688728, [1; 3; 0]);
718    (0.101279767307671298, [1; 2; 3]); (0.081429255816779289, [0; 3; 5]);];; *)
719 (* added new ineq 4750199435 *)
720 resolve amx2;;  (* 2.1718 *)
721 add_hints_force amx2;;
722 sorted_azim_diff darts_of_std_tri amx2;; 
723 sorted_azim_weighted_diff (fun bb -> rotation (bb.apex_flat))  amx2;; 
724 amx2;;
725 get_azim_table [4;5;3] amx2;;
726 get_azim_table [0;3;5] amx2;;
727 get_azim_table [0;1;3] amx2;;
728 get_azim_table [2;3;1] amx2;;
729 let f00 = (fun y1 y2 y3 y4 y5 y6 -> (( Sphere_math.dih2_y y1 y2 y3 y4 y5 y6  -.  1.083) +. (((0.6365 *. (y1 -.  2.)) -.  (0.198 *. (y2 -.  2.))) +. ((0.352 *. (y3 -.  2.)) +. (((0.416 *. (y4 -.  2.52)) -.  (0.66 *. (y5 -.  2.))) +. (0.071 *. (y6 -.  2.)))))) -. 0.);;
730
731 let dih2_y = Sphere_math.dih2_y;;
732
733 ocaml_fun_of_ineq i8384511215.ineq;;
734 let fxx = (fun y1 y2 y3 y4 y5 y6 -> ( dih2_y y1 y2 y3 y4 y5 y6  +. 0.0015) -. (0.913186 +. (((-. 0.390288) *. ((-. 2.) +. y1)) +. ((0.115895 *. ((-. 2.) +. y2)) +. ((0.164805 *. ((-. 2.52) +. y3)) +. (((-. 0.271329) *. ((-. 2.82843) +. y4)) +. ((0.584817 *. ((-. 2.) +. y5)) +. ((-. 0.170218) *. ((-. 2.) +. y6)))))))));;
735
736 testval f00 [4;5;3] amx2;;
737
738 remake_model();;
739 resolve amx2;;  (* 2.063 *)
740 add_hints_force amx2;;
741 sorted_azim_diff darts_of_std_tri amx2;; 
742 sorted_azim_weighted_diff (fun bb -> rotation (bb.apex_flat))  amx2;; 
743 get_azim_table[8;1;9] amx2;;
744 get_azim_table[0;5;9] amx2;;
745 get_azim_table[0;9;1] amx2;;
746 ocaml_fun_of_ineq  i7819193535.ineq;;
747 let fxx = (fun y1 y2 y3 y4 y5 y6 -> ( dih2_y y1 y2 y3 y4 y5 y6  +. 0.0011) -. (1.16613 +. (((-. 0.296776) *. ((-. 2.) +. y1)) +. ((0.208935 *. ((-. 2.) +. y2)) +. (((-. 0.243302) *. ((-. 2.) +. y3)) +. (((-. 0.360575) *. ((-. 2.25) +. y4)) +. ((0.636205 *. ((-. 2.) +. y5)) +. ((-. 0.295156) *. ((-. 2.) +. y6)))))))));;
748 testval fxx [8;1;9] amx2;;
749
750 remake_model();;
751 resolve amx2;;  (* 2.056 *)
752 add_hints_force amx2;;
753 sorted_azim_diff darts_of_std_tri amx2;; 
754 sorted_azim_weighted_diff (fun bb -> rotation (bb.apex_flat))  amx2;; 
755 get_azim_table[0;3;5] amx2;;
756 get_azim_table[0;5;9] amx2;;
757 get_azim_table[0;9;1] amx2;;
758 ocaml_fun_of_ineq i2621779878.ineq;;
759 let fxx = (fun y1 y2 y3 y4 y5 y6 -> ( dih2_y y1 y2 y3 y4 y5 y6  +. 0.0011) -. (1.16613 +. (((-. 0.296776) *. ((-. 2.) +. y1)) +. ((0.208935 *. ((-. 2.) +. y2)) +. (((-. 0.243302) *. ((-. 2.) +. y3)) +. (((-. 0.360575) *. ((-. 2.25) +. y4)) +. ((0.636205 *. ((-. 2.) +. y5)) +. ((-. 0.295156) *. ((-. 2.) +. y6)))))))));;
760 testval fxx [8;1;9] amx2;;
761
762 (* material from 2009 *)
763 (* case 86506100695 *)
764 let h86 _ =
765   let h86 = [findid "86506100695" hard_bb] in
766   let h86a = allpass 10 h86 in
767   let h86b = allpass 10  h86a in
768     allvpass h86b = [];;
769 tests := h86 :: !tests;;
770
771
772 (* the 2 pressed icosahedra remain *)
773
774 let hard2_bb = filter (fun t -> mem t.hypermap_id ["161847242261";"223336279535"]) hard_bb;;
775
776
777 length hard2_bb;;
778 let h16 = allvpass (findall "161847242261" hard_bb);;
779 let h16max = find_max h16;;  (* 12.0627 *)
780 let b16 = h16;;
781 let b16a = all_highvpass b16;;
782 length b16a;;
783 let b16Amax = find_max b16a;; (* 12.0627 *)
784 let b16b =   (one_epass b16a);;
785 let b16c  = one_epass (one_epass b16b);;
786 let b16d = one_epass b16c;;
787 length b16d;;
788 let b16e = find_max b16d;;   (* 12.051 *)
789 0;; (* -- *)
790 let c16a= allpass 10 b16d;;
791 let c16Amax = find_max c16a;; (* 12.048 *)  (* was 12.059 *)
792 length c16a;;  (* 997 *)
793 let c16b = allpass 15 c16a;;
794 let c16Bmax = find_max c16b;;  (* 12.026 *) (* was 12.037 *)
795 length c16b;;  (* 657 *) (* was 636 *)
796
797
798 (*
799
800 (* this one is a dodecahedron modified with node 2 pressed
801     into an edge *)
802   let h  = findid (nth hardid 3);;  (* 12223336279535  *)
803   let h1 = allpass [h];;
804   length h1;;   (* length 1885 *)
805   let k1 = find_max h1;;  (* 12.0416 *)
806   let h2 = onevpassi h1 2;; (* length h2 : 2637 *)
807 (* unfinished... *)
808
809 (* this one is triangles only, types {6,0}, {4,0}, {6,0}. *)
810   let r  = findid (nth hardid 5);;  (* 12161847242261  *)
811   length r1;;   (* length  *)
812   let r1 = allvpass [r];;
813   let r2 = allpass r1;;
814 (* unfinished *)
815
816 *)
817
818
819
820
821 (*
822 let allhardpassB_bb = allpass 8 hard2_bb;;
823 *)
824
825 (*
826 let hard2_bb = [nth  hard_bb 0;nth hard_bb 1];;
827 (* to here *)
828
829 length (allhardpassB_bb);;  (* 288 *)
830 let h16 = find_max allhardpassB_bb;;
831 (* unfinished *)
832 *)
833
834 (*
835 let h0 = nth hard_bb 0;;
836 let h1 = 
837   let s i l= flatten((map (fun t -> switch_node t i)) l) in
838   let branches =   s 4(  s 3(  s 2(  s 1 (s 0 [h0])) ) )  in
839    filter_feas branches;;
840 length h1;;
841 find_max h1;;
842 let all16_bb = allpass 6 h1;;
843 (* unfinished *)
844 *)
845
846
847 (* ========================================================================== *)
848 (* Case: OLD NOTES, Aug 4, 2010                                               *)
849 (* ========================================================================== *)
850
851 (* Don't need the rest of the file, if execute works. *)
852
853 (* this eliminates case 11 *)
854 let b34970074286() = allpass_hint 500 [hard 11];;
855
856 (* this eliminates case 10, about 5000 linear programs *)
857
858 let b75641658977() = allpass_hint 2500 [hard 10];;
859
860 (*
861   let b1 = allpass_hint 500 [hard 10] in
862   let b2 = allpass_hint 500 b1 in
863   let b3 = allpass_hint 500 b2 in
864   let b4 = allpass_hint 500 b3 in
865   let b5 = allpass_hint 500 b4 in
866     b5;;
867 *)
868
869
870 let b88089363170() = allpass_hint 1000 [hard 9];;
871
872 let b86506100695() = allpass_hint 2000 [hard 8];;
873
874 let b242652038506() =  allpass_hint_include_flat 10 [hard 7];;
875
876 let b179189825656() = allpass_hint 50 [hard 6];;
877
878 let b154005963125() = allpass_hint 3000 [hard 5];;
879
880 let b39599353438() = allpass_hint 10 [hard 4];;
881
882 let b65974205892() = allpass_hint 30 [hard 3];;
883
884 let b50803004532() = allpass_hint 500 [hard 2];;
885
886 let b223336279535() = allpass_hint_include_flat 20000 [hard 1];;
887
888 let b161847242261() = allpass_hint 5000 [hard 0];;  (* runs to 3583 *)
889