MCPcopy Create free account
hub / github.com/ERGO-Code/HiGHS / manual_weighted

Function manual_weighted

examples/multi_objective.py:89–97  ·  view source on GitHub ↗
(h, X)

Source from the content-addressed store, hash-verified

87#
88# manual implementation of weighted multi-objective optimization
89def manual_weighted(h, X):
90 print('## Manual Weighted:\n')
91 weights = np.asarray([1.0/(k+1) for k in range(OBJECTIVES)], dtype=np.float64)
92 h.maximize(np.dot(weights[:,None] * profit, X).sum())
93
94 print(f' SOL: [{"".join(map(lambda x: "{:1.0f}".format(x), abs(h.vals(X))))}]')
95 print(f' OBJ: {pretty_print(np.dot(profit, h.vals(X)))}\n')
96
97 print(f' Obj: {h.getObjective()[0]}\n\n')
98
99
100#

Callers 1

multi_objective.pyFile · 0.85

Calls 9

rangeFunction · 0.85
mapFunction · 0.85
pretty_printFunction · 0.85
maximizeMethod · 0.80
sumMethod · 0.80
dotMethod · 0.80
joinMethod · 0.80
valsMethod · 0.80
getObjectiveMethod · 0.45

Tested by

no test coverage detected