diff --git a/ChangeLog b/ChangeLog index 1a15db6..ffe4994 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,11 @@ Recent changes to the ets_fiberalloc package, in reverse chronological order: +yet unreleased: + https://pfs-jira.naoj.org/jira/browse/FIBERALLOC-61 + (Allow perturbation of target observation cost) + + - v3.5: https://pfs-jira.naoj.org/jira/browse/FIBERALLOC-59 (add support for cobraOps parameter "brokenCobrasMargin") diff --git a/ets_fiber_assigner/netflow.py b/ets_fiber_assigner/netflow.py index 9e4632e..14fed64 100644 --- a/ets_fiber_assigner/netflow.py +++ b/ets_fiber_assigner/netflow.py @@ -264,7 +264,8 @@ def buildProblem(bench, targets, tpos, classdict, tvisit, vis_cost=None, preassigned=None, cobraSafetyMargin=0., cobraFeatureFlags=None, - brokenCobrasMargin=0.): + brokenCobrasMargin=0., + targetCostOffset=None): """Build the ILP problem for a given observation task Parameters @@ -404,6 +405,10 @@ def buildProblem(bench, targets, tpos, classdict, tvisit, vis_cost=None, This is given as a fraction of "brokenCobrasRmax", i.e. the maximum patrol area radius of any broken Cobra. Useful values should be in the range [0;1]. + targetCostOffset: np.ndarray(float), same size as "targets" + per-target perturbation of the overall cost function, if this target + is observed. Used to break degeneracies and guarantee reproducible + assignments. Returns ======= @@ -533,6 +538,8 @@ def buildProblem(bench, targets, tpos, classdict, tvisit, vis_cost=None, f = prob.addVar(makeName("STC_T", TC, tgt.ID), tmp, 1) T_i[tidx].append(f) STC_o[TC].append(f) + if targetCostOffset is not None and targetCostOffset[tidx] != 0: + prob.cost += f*targetCostOffset[tidx] if len(STC_o[TC]) == 1: # freshly created # Science Target class node to sink f = prob.addVar(makeName("STC_sink", TC), 0, None)