Skip to content

Instantly share code, notes, and snippets.

View mdmitry1's full-sized avatar
:atom:
🦁

Dmitry Messerman mdmitry1

:atom:
🦁
View GitHub Profile
#!/usr/bin/python3.12
def visualize_quadtree(quadtree, points, query_rect=None, found_points=None,
filename="quadtree", title="Quadtree Visualization"):
"""Visualize the quadtree structure with points."""
fig, ax = plt.subplots(figsize=(12, 12))
# Draw all quadtree boundaries
boundaries = quadtree.get_all_boundaries()
for boundary in boundaries:
x = boundary.x - boundary.width/2

Eggholder Function Optimization

This project demonstrates global optimization techniques using SciPy on the Eggholder function, a complex mathematical function commonly used for testing optimization algorithms.

Overview

The Eggholder function is a challenging optimization problem with many local minima, making it an excellent benchmark for testing global optimization algorithms.
Eggholder function figure

Eggholder function formula

Global minimum: f(x*) = -959.6407, at x* = (512, 404.2319)

{
"version": "1.2",
"variables": [
{"label":"X1", "interface":"knob", "type":"real", "range":[0,5], "rad-abs": 0.0},
{"label":"X2", "interface":"knob", "type":"real", "range":[0,3], "rad-abs": 0.0},
{"label":"F1", "interface":"output", "type":"real"},
{"label":"F2", "interface":"output", "type":"real"}
],
"alpha": "(X1-5)*(X1-5)+X2*X2-25 and -(X1-8)*(X1-8)-(X2+3)*(X2+3)+7.7",
"objectives": {
#!/usr/bin/python3.14
# -*- coding: utf-8 -*-
import torch
import math
from hashlib import sha256
from matplotlib import pyplot as plt
def main(timeout: int=5000, size: int=100000) -> int:
dtype = torch.float
device = torch.device("cpu")
import pytest
# Mark all tests in this directory to run forked
def pytest_collection_modifyitems(items):
for item in items:
# Check if test is in this directory
if "z3" in str(item.fspath):
item.add_marker(pytest.mark.forked)
# Configure logging for forked tests