Last active
March 31, 2016 16:20
-
-
Save JesseLivezey/8ea2f2ddfb51057127275a0bdf7b8d48 to your computer and use it in GitHub Desktop.
constraint 4 idea
This file contains 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
#this is the constraint that makes Pyhy[i,i] > Pyhy[i,j] | |
def con4(inputArray): | |
Pyhy_i = inputArray.reshape(n,n) | |
# get diagonal vector (Pyhy[i,i]) | |
Pyhy_diag = np.diag(Pyhy_i) | |
# get max of each row | |
Pyhy_max = Pyhy.max(axis=1) | |
# we want the difference to be positive or zero | |
diff = Pyhy_diag - Pyhy_max | |
# we want all of the differences to be positive, so we can just return the most negative one | |
worst_case = diff.min() | |
return worst_case |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment