Created
December 28, 2018 09:02
-
-
Save eponkratova/5ad1bb24bc725926864001d8ed98d707 to your computer and use it in GitHub Desktop.
initiating_gis_5
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
def __optimize(self): | |
""" | |
Optimization of the DEA model | |
Use: http://docs.scipy.org/doc/scipy-0.17.0/reference/generated/scipy.optimize.linprog.html | |
A = coefficients in the constraints | |
b = rhs of constraints | |
c = coefficients of the target function | |
:return: | |
""" | |
d0 = self.m + self.r + self.n | |
# iterate over units | |
for unit in self.unit_: | |
# weights | |
x0 = np.random.rand(d0) - 0.5 | |
x0 = fmin_slsqp(self.__target, x0, f_ieqcons=self.__constraints, args=(unit,)) | |
# unroll weights | |
self.input_w, self.output_w, self.lambdas = x0[:self.m], x0[self.m:(self.m+self.r)], x0[(self.m+self.r):] | |
self.efficiency[unit] = self.__efficiency(unit) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment