This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from IPython.core.display import display, HTML | |
| display(HTML("<style>.container { width:90% !important; }</style>")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # pyconcorde: https://github.com/jvkersch/pyconcorde | |
| from concorde.tsp import TSPSolver | |
| num=30 | |
| X = np.random.random(num)*10**6 | |
| Y = np.random.random(num)*10**6 | |
| solver = TSPSolver.from_data(X, Y, norm='EUC_2D') | |
| solution = solver.solve() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| for i in range(5): | |
| print(i) | |
| # output: | |
| # 0 | |
| # 1 | |
| # 2 | |
| # 3 | |
| # 4 | |
| # print end option |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from tqdm import tqdm_notebook as tqdm | |
| pbar = tqdm(total=10) | |
| for i in range(10): | |
| pbar.update(1) | |
| pbar.close() |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from tqdm import tqdm_notebook as tqdm | |
| def min_matching(edges): | |
| # Find odd-degree nodes in MST | |
| odd = [] | |
| for i in range(num): | |
| cnt = 0 | |
| for e in sum(edges, []): | |
| if i == e: | |
| cnt += 1 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.