Skip to content

Instantly share code, notes, and snippets.

View phabee's full-sized avatar

Fabian Leuthold phabee

View GitHub Profile
@phabee
phabee / sudoku_solver_milp.py
Last active December 8, 2023 15:26
Sudoku Solver using MILP
from ortools.linear_solver import pywraplp
import numpy as np
def solve(sudoku):
"""
Solve the sudoku passed
:param sudoku: a 9x9 sudoku field
:return: the completed 9x9 sudoku field
"""
# Create the model.
import matplotlib.pyplot as plt
def remove_duplicate_candidates(N):
'''
Accept a list of candidate solutions (being binary lists) and make sure, each (element)-list is contained only once.
:param N:
:return: revised list containing no duplicate candidates
'''