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
| def pulp_to_dual(lp): | |
| # A x <= b | |
| # 変数の数 | |
| n = len(lp.variables()) | |
| # 制約の数 | |
| m = 0 | |
| for constraint in lp.constraints.values(): |
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
| import numpy as np | |
| from simplex_method import SimplexMethod | |
| class ReverseSearch: | |
| def __init__(self, round_digit=5): | |
| self.round_digit = round_digit | |
| return | |
| def solve(self, A, b, basis): |
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
| import numpy as np | |
| from simplex_method import SimplexMethod | |
| class PhaseOneSimplexMethod: | |
| def __init__(self, round_digit=5): | |
| self.round_digit = round_digit | |
| return | |
| def solve(self, A, b): |
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
| import numpy as np | |
| class SimplexMethod: | |
| OPTIMAL = 1 | |
| UNBOUNDED = -1 | |
| def __init__(self, round_digit=5): | |
| self.round_digit = round_digit | |
| return |
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
| import numpy as np | |
| from matplotlib import pyplot as plt | |
| # タイプ一覧(名称) | |
| types_name = [ | |
| 'normal', | |
| 'fire', | |
| 'water', | |
| 'electric', | |
| 'grass', |
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 itertools import product, combinations | |
| import numpy as np | |
| from numpy import linalg as la | |
| def get_M_list(n): | |
| M_list = [[]] | |
| for _ in range(n): | |
| M_list_ = [] | |
| for M in M_list: | |
| cones = get_cones(n, M) |
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
| import numpy as np | |
| import pulp | |
| # 行列ゲーム | |
| def solve_matrix_game(A): | |
| n_type = len(A) | |
| lp = pulp.LpProblem(sense=pulp.LpMaximize) | |
| v = pulp.LpVariable("v") | |
| x = [ pulp.LpVariable("x_"+str(i)) for i in range(n_type) ] | |
| for j in range(n_type): |
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
| import numpy as np | |
| import pulp | |
| # タイプ一覧(名称) | |
| types_name = [ | |
| 'ノーマル', | |
| '炎', | |
| '水', | |
| '電気', | |
| '草', |
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
| import numpy as np | |
| import pulp | |
| # タイプ一覧(名称) | |
| types_name = [ | |
| 'ノーマル', | |
| '炎', | |
| '水', | |
| '電気', | |
| '草', |
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 itertools import product | |
| import numpy as np | |
| from numpy import linalg as la | |
| def bruteforce(q, M): | |
| n = len(q) | |
| I = np.identity(n) |
NewerOlder