Skip to content

Commit 26bd320

Browse files
committed
Merge branch 'devel' for 0.3.2
2 parents c69b993 + fc12a25 commit 26bd320

File tree

2 files changed

+2
-93
lines changed

2 files changed

+2
-93
lines changed

octoprint_gcodeleveling/maxima.py

Lines changed: 1 addition & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,9 @@
22
import numpy as np
33
from octoprint_gcodeleveling.twoDimFit import twoDpolyEval
44

5-
6-
from abc import ABC, abstractmethod
7-
85
threshold = 0.005
96

10-
class PathWiseMaximizer(ABC):
7+
class PathWiseMaximizer():
118

129
def optimize(self, value, first, second):
1310
pass
@@ -19,67 +16,6 @@ def testPoint(self, value, q):
1916
else:
2017
return (False, False)
2118

22-
class Spaceshot(PathWiseMaximizer):
23-
def __init__(self, shots):
24-
self.shots = shots
25-
self.max = None
26-
self.maxQ = None
27-
28-
def optimize(self, value, first, second):
29-
self.maxQ = None
30-
self.max = 0
31-
for shot in range(self.shots):
32-
q = shot/self.shots
33-
tp, tv = self.testPoint(value, q)
34-
if (tp and tv > self.max):
35-
self.maxQ = tp
36-
self.max = tv
37-
return self.maxQ
38-
39-
class Scatershot(PathWiseMaximizer):
40-
def __init__(self, shots):
41-
self.shots = shots
42-
self.max = None
43-
self.maxQ = None
44-
45-
def optimize(self, value, first, second):
46-
self.maxQ = None
47-
self.max = 0
48-
for shot in range(self.shots):
49-
q = random.random()
50-
tp, tv = self.testPoint(value, q)
51-
if (tp and tv > self.max):
52-
self.maxQ = tp
53-
self.max = tv
54-
return self.maxQ
55-
56-
class SinglePointNewton(PathWiseMaximizer):
57-
def __init__(self, height=0.00001, telos=0.1, point=0.5):
58-
self.hMin = height
59-
self.telos = telos
60-
self.point = point
61-
62-
def optimize(self, value, first, second):
63-
q = self.point
64-
65-
lvl = 1
66-
height = 10
67-
while (abs(height) > self.hMin):
68-
slope = second(q)
69-
if (slope != 0.0):
70-
height = first(q)
71-
q = -height/slope + q
72-
lvl += 1
73-
else:
74-
break
75-
76-
if (q > self.telos and q < 1-self.telos):
77-
tp, _ = self.testPoint(value, q)
78-
if tp:
79-
return tp
80-
else:
81-
return None
82-
8319
class SingleGradientAscent(PathWiseMaximizer):
8420
def __init__(self, ds=0.00001, step=10.0, telos=0.01, point=0.5, lvl=200):
8521
self.sMin = ds
@@ -108,33 +44,6 @@ def optimize(self, value, first, second):
10844
else:
10945
return None
11046

111-
class DynastepSingleGradientAscent(PathWiseMaximizer):
112-
def __init__(self, ds=0.00001, step=10.0, telos=0.01, point=0.5, lvl=500):
113-
self.sMin = ds
114-
self.step = step
115-
self.telos = telos
116-
self.point = point
117-
self.lvl = lvl
118-
119-
def optimize(self, value, first, second):
120-
q = self.point
121-
122-
lvl = 0
123-
slope = 10
124-
while (abs(slope) > self.sMin and q > self.telos and q < 1-self.telos and lvl < self.lvl):
125-
slope = first(q)
126-
q += slope*self.step*math.exp(-lvl)
127-
lvl += 1
128-
129-
if (q > self.telos and q < 1-self.telos):
130-
tp, tv = self.testPoint(value, q)
131-
if (tp):
132-
return tp
133-
else:
134-
return None
135-
else:
136-
return None
137-
13847
def der(coeffs):
13948
xPartial = []
14049
yPartial = []

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
plugin_name = "OctoPrint-GcodeLeveling"
1515

1616
# The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module
17-
plugin_version = "0.3.1"
17+
plugin_version = "0.3.2"
1818

1919
# The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin
2020
# module

0 commit comments

Comments
 (0)