Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit e33ae1c7 by EXT José Ignacio Requeno Jarabo

Minor changes

parent 0f0fbb87
Pipeline #51862 failed with stages
in 62 minutes and 25 seconds
 ... ... @@ -1124,8 +1124,8 @@ class Rectangle(object): self.max_corner = max_c # Matplot functions def plot_2D(self, c='red', xaxe=0, yaxe=1, opacity=1.0): # type: (Rectangle, str, int, int, float) -> patches.Rectangle def plot_2D(self, c='red', xaxe=0, yaxe=1, opacity=1.0, clipBox=None): # type: (Rectangle, str, int, int, float, Rectangle) -> patches.Rectangle """ Function that creates a graphical representation of the rectangle in 2D. In case that the rectangle has dimension higher than 2, ... ... @@ -1142,11 +1142,25 @@ class Rectangle(object): """ assert (self.dim() >= 2), 'Dimension required >= 2' mc = (self.min_corner[xaxe], self.min_corner[yaxe],) width = self.diag_vector()[xaxe] height = self.diag_vector()[yaxe] minc = (self.min_corner[xaxe], self.min_corner[yaxe],) maxc = (self.max_corner[xaxe], self.max_corner[yaxe],) if clipBox is not None: clipminc = (clipBox.min_corner[xaxe], clipBox.min_corner[yaxe],) clipmaxc = (clipBox.max_corner[xaxe], clipBox.max_corner[yaxe],) minc = maximum(minc, clipminc) minc = minimum(minc, clipmaxc) maxc = minimum(maxc, clipmaxc) maxc = maximum(maxc, clipminc) rect = Rectangle(minc, maxc) width = rect.diag_vector()[xaxe] height = rect.diag_vector()[yaxe] return patches.Rectangle( mc, # (x,y) minc, # (x,y) width, # width height, # height # color = c, #color ... ... @@ -1156,7 +1170,7 @@ class Rectangle(object): ) def plot_3D(self, c='red', xaxe=0, yaxe=1, zaxe=2, opacity=1.0, clipBox=None): # type: (Rectangle, str, int, int, int, float) -> Poly3DCollection # type: (Rectangle, str, int, int, int, float, Rectangle) -> Poly3DCollection """ Function that creates a graphical representation of the rectangle in 3D. In case that the rectangle has dimension higher than 3, ... ... @@ -1176,23 +1190,16 @@ class Rectangle(object): minc = (self.min_corner[xaxe], self.min_corner[yaxe], self.min_corner[zaxe],) maxc = (self.max_corner[xaxe], self.max_corner[yaxe], self.max_corner[zaxe],) if not (clipBox is None): if clipBox is not None: clipminc = (clipBox.min_corner[xaxe], clipBox.min_corner[yaxe], clipBox.min_corner[zaxe],) clipmaxc = (clipBox.max_corner[xaxe], clipBox.max_corner[yaxe], clipBox.max_corner[zaxe],) a = [self.min_corner[xaxe], self.min_corner[yaxe], self.min_corner[zaxe]] b = [self.max_corner[xaxe], self.max_corner[yaxe], self.max_corner[zaxe]] for i in range(len(a)): if a[i] < clipminc[i]: a[i] = clipminc[i] elif a[i] > clipmaxc[i]: a[i] = clipmaxc[i] for i in range(len(b)): if b[i] < clipminc[i]: b[i] = clipminc[i] elif b[i] > clipmaxc[i]: b[i] = clipmaxc[i] minc = (a[0], a[1], a[2],) maxc = (b[0], b[1], b[2],) minc = maximum(minc, clipminc) minc = minimum(minc, clipmaxc) maxc = minimum(maxc, clipmaxc) maxc = maximum(maxc, clipminc) rect = Rectangle(minc, maxc) ... ...
 ... ... @@ -216,12 +216,13 @@ class Segment (object): return Point.norm(diagonal) def center_eps(self, eps): # type: (Segment) -> tuple # type: (Segment, float) -> tuple """ off by eps from the center of the Segment. Args: self (Segment): The Segment, eps: a float value. self (Segment): The Segment, eps: a float value. Returns: tuple: eps-center of the Segment. ... ... @@ -276,5 +277,5 @@ class Segment (object): >>> (1, 1) """ offset = div(self.diag(), 2.0) offset = (math.floor(offset[0]), math.floor(offset[1])) offset = tuple(math.floor(off_i) for off_i in offset) return add(self.low, offset)
 ... ... @@ -22,7 +22,8 @@ actions on Evolutionary Computation, 2018. """ from ParetoLib.Geometry.Segment import Segment import copy, math import copy import math # EPS = sys.float_info.epsilon # DELTA = sys.float_info.epsilon ... ... @@ -112,6 +113,7 @@ def discrete_binary_search(x, def determine_intersection(y1, y2): # type: (Segment, Segment) -> Segment if y2.high <= y1.low: return Segment(y1.high, y1.low), NO_INTER elif y1.high <= y2.low: ... ... @@ -121,6 +123,7 @@ def determine_intersection(y1, y2): def intersection_empty_constrained(x, member1, member2, list_constraints): # type: (Segment, callable, callable, list) -> bool low_allowed = True high_allowed = True for constraint in list_constraints: ... ... @@ -142,6 +145,7 @@ def intersection_empty_constrained(x, member1, member2, list_constraints): def intersection_empty(x, member1, member2): # type: (Segment, callable, callable) -> bool # The cube doesn't contain an intersection. return (not member1(x.high)) or (not member2(x.low)) ... ... @@ -153,9 +157,40 @@ def intersection_expansion_search(x, # member1 is the function whose truth value increases with x. # member2 is the function whose truth value decreases with x. def expand_lower_side(y, z, membership, error, eps): # type: (Segment, Segment, callable, tuple, tuple) -> (Segment, Segment, int) yIn = copy.deepcopy(y) yCover = copy.deepcopy(y) zgrek = copy.deepcopy(z) # Try to expand on the lower side. zgrek.high = eps ygrek, i1 = binary_search(zgrek, membership, error) yCover.low = ygrek.low yIn.low = ygrek.high return yIn, yCover, i1 def expand_upper_side(y, z, membership, error, eps): # type: (Segment, Segment, callable, tuple, tuple) -> (Segment, Segment, int) yIn = copy.deepcopy(y) yCover = copy.deepcopy(y) zgrek = copy.deepcopy(z) # Try to expand on the upper side. zgrek.low = eps ygrek, i1 = binary_search(zgrek, membership, error) yCover.high = ygrek.high yIn.high = ygrek.low return yIn, yCover, i1 # Try to find an intersection or a proof that there doesn't exist an intersection on the given segment. i = 0 y = x z = copy.deepcopy(y) intersect_indicator = DKNOW if member1(y.low) and member2(y.high): # All the cube belongs to B1 ... ... @@ -178,15 +213,11 @@ def intersection_expansion_search(x, result1 = member1(yval) result2 = member2(yval) if result1 and result2: # assign z = copy.deepcopy(y) y.low = yval y.high = yval intersect_indicator = INTER break elif not (result1 or result2): # assign z = copy.deepcopy(y) y.low = yval y.high = yval intersect_indicator = NO_INTER ... ... @@ -202,45 +233,28 @@ def intersection_expansion_search(x, yCover = copy.deepcopy(y) # Expansion step here. eps_minus = z.center_eps(-error[0] / 2) eps_plus = z.center_eps(error[0] / 2) if intersect_indicator == NO_INTER and to_expand: eps_minus = z.center_eps(-error[0] / 2) eps_plus = z.center_eps(error[0] / 2) if not member2(eps_minus): # Try to expand on the lower side. zgrek1 = copy.deepcopy(z) zgrek1.high = eps_minus flip_member2 = lambda point: not member2(point) ygrek, i1 = binary_search(zgrek1, flip_member2, error) yIn, yCover, i1 = expand_lower_side(y, z, flip_member2, error, eps_minus) i += i1 yCover.low = ygrek.low yIn.low = ygrek.high if not member1(eps_plus): # Try to expand on the upper side. zgrek2 = copy.deepcopy(z) zgrek2.low = eps_plus ygrek, i2 = binary_search(zgrek2, member1, error) i += i2 yCover.high = ygrek.high yIn.high = ygrek.low yIn, yCover, i1 = expand_upper_side(y, z, member1, error, eps_plus) i += i1 elif intersect_indicator == INTER: eps_minus = z.center_eps(-error[0] / 2) eps_plus = z.center_eps(error[0] / 2) if member1(eps_minus): # Try to expand on the lower side. zgrek1 = copy.deepcopy(z) zgrek1.high = eps_minus ygrek, i1 = binary_search(zgrek1, member1, error) yIn, yCover, i1 = expand_lower_side(y, z, member1, error, eps_minus) i += i1 yCover.low = ygrek.low yIn.low = ygrek.high if member2(eps_plus): # Try to expand on the upper side. zgrek2 = copy.deepcopy(z) zgrek2.low = eps_plus flip_member2 = lambda point: not member2(point) ygrek, i2 = binary_search(zgrek2, flip_member2, error) i += i2 yCover.high = ygrek.high yIn.high = ygrek.low yIn, yCover, i1 = expand_upper_side(y, z, flip_member2, error, eps_plus) i += i1 return yIn, yCover, intersect_indicator, i \ No newline at end of file
 ... ... @@ -129,7 +129,6 @@ def multidim_search(xspace, end = time.time() time0 = end - start RootSearch.logger.info('Time multidim search: ' + str(time0)) print 'Time multidim search (pareto front): ' + str(time0) return rs ... ...