NetworkFW.run

NetworkFW.run(param: float = 1, warmstart=None, callback=None, **kw)[source]

Find min cost flow for param.

Parameters
paramfloat, default=1

Find min cost flow for demand(param).

warmstartLinearWarmstart, optional.

If given, use scaled warmstart flow as initial solution. Else, initial solution is found by minimizing subproblem for weights of zero-flow.

callbackcallable, optional

Called after each iteration: callback(CallBackFlag.ITER_END, self)

kwkeyword arguments

Further options, see FWConfig.

Examples

Using a callback:

import paminco
import numpy as np

network = paminco.net.load_sioux()
network.integrate_cost()
fw = paminco.NetworkFW(network)

funvals = []
def cb(fw, callbackflag):
    if callbackflag == CallBackFlag.ITER_END:
        funvals.append(fw.cost)

fw.run(print=True, param=1, max_iter=100, callback=cb)
funvals = np.array(funvals)