Skip to content

Instantly share code, notes, and snippets.

@Auscitte
Last active September 29, 2021 21:17
Show Gist options
  • Save Auscitte/1114fc92b9f01e4e322b0125c555efd0 to your computer and use it in GitHub Desktop.
Save Auscitte/1114fc92b9f01e4e322b0125c555efd0 to your computer and use it in GitHub Desktop.
Data for the Allocation of Interdiction problem
#Data for the Allocation of Interdiction problem (in Stephen Boyd's Convex Optimization course) generated with Matlab;
#I borrowed the list of edges from https://github.com/NoamGit/CVX101-HW-with-python/blob/master/HW10/hw10_script.py and
#used matlab to generate a and x_max.
import numpy as np
(n, m) = (10, 20)
B = m / 2.0
a = np.array([ 1.900258570294351, 0.462277027148576, 1.213685167083573, 0.971964937418599, 1.782597932297803, 1.524193666054789, 0.912935330336683, 0.037007286496449, 1.642814328590507, 0.889406728706388, 1.230864696200189, 1.583874074854071, 1.843625941489605, 1.476414491621331, 0.352532288989236, 0.811412426124191, 1.870939398215211, 1.833808879826815, 0.820540413981891, 1.787299061827067 ]).reshape((m, 1))
x_max = np.array([ 1.057891304784269, 1.352868132217000, 1.813166497303758, 1.009861300660924, 1.138890881956950, 1.202765218560273, 1.198721742661490, 1.603792479193819, 1.272187924969960, 1.198814267761062, 1.015273927029036, 1.746785676564429, 1.445096432287947, 1.931814578461665, 1.465994341675424, 1.418649467727506, 1.846221417824324, 1.525152496305172, 1.202647357650387, 1.672137468474288 ]).reshape((m, 1))
edges = [ (0, 1), (0, 2), (0, 3), (1, 2), (1, 3), (1, 5), (2, 4), (2, 5), (3, 5), (3, 6), (4, 6), (4, 7), (5, 6), (5, 7), (6, 7), (6, 8), (6, 9), (7, 8), (7, 9), (8, 9) ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment