Functions | |
def | distance (x1, y1, x2, y2) |
def | kmedian (I, J, c, k) |
def | make_data (n, m, same=True) |
Variables | |
c | |
client = set(i for i in I if i not in facilities and i not in other) | |
list | edges = [(i, j) for (i, j) in x if model.getVal(x[i, j]) > EPS] |
int | EPS = 1.e-6 |
list | facilities = [j for j in y if model.getVal(y[j]) > EPS] |
False | |
G = NX.Graph() | |
I | |
J | |
int | k = 20 |
int | m = n |
def | model = kmedian(I, J, c, k) |
int | n = 200 |
node_color | |
node_size | |
nodelist | |
other = set(j for j in J if j not in facilities) | |
dictionary | position = {} |
same | |
with_labels | |
x | |
x_pos | |
y | |
y_pos | |
def kmedian.distance | ( | x1, | |
y1, | |||
x2, | |||
y2 | |||
) |
return distance of two points
Definition at line 45 of file kmedian.py.
def kmedian.kmedian | ( | I, | |
J, | |||
c, | |||
k | |||
) |
kmedian -- minimize total cost of servicing customers from k facilities Parameters: - I: set of customers - J: set of potential facilities - c[i,j]: cost of servicing customer i from facility j - k: number of facilities to be used Returns a model, ready to be solved.
Definition at line 15 of file kmedian.py.
References pyscipopt.expr.quicksum().
def kmedian.make_data | ( | n, | |
m, | |||
same = True |
|||
) |
c |
Definition at line 75 of file kmedian.py.
client = set(i for i in I if i not in facilities and i not in other) |
Definition at line 99 of file kmedian.py.
Definition at line 82 of file kmedian.py.
int EPS = 1.e-6 |
Definition at line 80 of file kmedian.py.
Definition at line 83 of file kmedian.py.
False |
Definition at line 110 of file kmedian.py.
G = NX.Graph() |
Definition at line 95 of file kmedian.py.
I |
Definition at line 75 of file kmedian.py.
J |
Definition at line 75 of file kmedian.py.
int k = 20 |
Definition at line 76 of file kmedian.py.
m = n |
Definition at line 74 of file kmedian.py.
n = 200 |
Definition at line 73 of file kmedian.py.
node_color |
Definition at line 110 of file kmedian.py.
node_size |
Definition at line 111 of file kmedian.py.
nodelist |
Definition at line 110 of file kmedian.py.
other = set(j for j in J if j not in facilities) |
Definition at line 98 of file kmedian.py.
position = {} |
Definition at line 106 of file kmedian.py.
same |
Definition at line 75 of file kmedian.py.
with_labels |
Definition at line 110 of file kmedian.py.
x |
Definition at line 81 of file kmedian.py.
x_pos |
Definition at line 75 of file kmedian.py.
y |
Definition at line 81 of file kmedian.py.
y_pos |
Definition at line 75 of file kmedian.py.