File: naive-dynamic.m2

package info (click to toggle)
macaulay2 1.21%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 133,096 kB
  • sloc: cpp: 110,377; ansic: 16,306; javascript: 4,193; makefile: 3,821; sh: 3,580; lisp: 764; yacc: 590; xml: 177; python: 140; perl: 114; lex: 65; awk: 3
file content (69 lines) | stat: -rw-r--r-- 1,699 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
setRandomSeed 0;
needsPackage "MonodromySolver"
needs "cyclic.m2"

runNaiveDynamicMonodromy = polys -> (
	(p0,x0) := createSeedPair polySystem polys;

	targetSystem := x0#SolutionSystem;

	MV := computeMixedVolume (ideal(targetSystem))_*;

	nextP := ((p0)->point {apply(#coordinates p0, i->exp(2*pi*ii*random RR))});

	sols := pointArray {x0};
	PathTrackCount := 0;
	<< "Mixed volume: " << MV << endl;
	while length sols < MV do (
		petalSystem := polySystem specializeSystem (nextP(p0),polys);
		PathTrackCount = PathTrackCount + length sols;
    	    	sols1 := select(track(
			targetSystem,
			petalSystem,
			points sols,
			NumericalAlgebraicGeometry$gamma=>random CC), 
		    s->status s==Regular);
		PathTrackCount = PathTrackCount + length sols1;	
		newSols := select(track(
			petalSystem,
			targetSystem,
			sols1,
			NumericalAlgebraicGeometry$gamma=>random CC),
		    s->status s==Regular);
		for sol in newSols do (
			if not member(sol,sols) then (
				appendPoint(sols,sol);
			);
		);
		<< "#sols: " << length sols << endl;
	);
    	if length sols > MV then (
	    print "FAILED!!!";
	    infinity
	    ) else (
	    << "#Path tracks: " << PathTrackCount << endl;
	    PathTrackCount
	    )
)

end
restart
needs "naive-dynamic.m2"
L = for i to 10 list 
runNaiveDynamicMonodromy parametrizedCyclic 7
sum L / 10. -- 7486

restart
load "naive-dynamic.m2"
elapsedTime runNaiveDynamicMonodromy parametrizedCyclic 10

restart
load "naive-dynamic.m2"
elapsedTime runNaiveDynamicMonodromy parametrizedCyclic 11

restart
load "naive-dynamic.m2"
load "large-examples/noon10.m2"
elapsedTime runNaiveDynamicMonodromy parametrizedNoon 10 
-- #Path tracks: 495692
     -- 7651.17 seconds elapsed