Skip to content

Add Constraint

Add a business rule that Network Optimization must respect — caps on lane flows, supplier diversity, budget limits, and similar.

When to use this

  • You want the optimizer to honour a real-world rule: a lane can ship at most 500 units, this location must source from at least two suppliers, total transport cost must not exceed €1M.
  • You want to test sensitivity by tightening or loosening a rule and re-running.

Place Add Constraint between Create Scenario (or Load Scenario) and Network Optimization. Chain several Add Constraint nodes for several rules.

What you need

  • Scenario data wired into the first input, from Create Scenario, Load Scenario, Set Objective or another Add Constraint.
  • Optionally: a table wired into the second input (Constraint Table) — one constraint per row instead of a single one typed into the panel.

Constraint types

Pick a type from the Constraint Type dropdown in the side panel. The form below it shows the parameters that type needs.

Type What it does Parameters
Lane Capacity Cap the flow on a specific lane Source, Target, Product (ALL = all products), Max Flow
Lane Minimum Floor the flow on a specific lane Source, Target, Product (ALL = all products), Min Flow
Fix Flow Force an exact flow on a lane Source, Target, Product (ALL = all products), Flow Value
Throughput Limit Min/max throughput at a location Location, Product (ALL = all products), Min Throughput, Max Throughput
Min Suppliers Require at least N distinct active suppliers (MIP) Minimum Supplier Count, Minimum Flow per Active Supplier, Product (ALL = all products)
Max Suppliers Cap the number of distinct active suppliers (MIP) Maximum Supplier Count, Product (ALL = all products)
Single Source Each target served by exactly one source (MIP) Target (optional, blank = all), Product (ALL = all products)
Budget Limit Cap total transport cost or total cost Max Transport Cost, Max Total Cost

Constraints marked MIP introduce binary variables. The solver handles them automatically, but solve times can grow on large networks.

There is no free-form constraint: the solver in this product runs no authored code, so a rule the table above cannot express is a request for a new type.

Min Suppliers — why Minimum Flow per Active Supplier matters

Min Suppliers counts a supplier as active only if its used quantity is at least the Minimum Flow per Active Supplier value. Without this floor, the solver could satisfy the count by activating extra suppliers with near-zero flow — meeting the rule on paper but defeating the diversification goal.

The flow value is in the same unit as your supply policy's capacity. If total demand is less than Minimum Supplier Count × Minimum Flow per Active Supplier, the problem is infeasible.

Settings

Setting What it is Default
Constraint type One of the eight types above. Required. none. The node is refused until one is picked
Constraint parameters The values the chosen type asks for, in the form under the dropdown. empty

Driving constraints from a table

Wire a table to the Constraint Table input (the second port) to generate one constraint per row. The constraint type stays on the node; each row supplies the parameter values, with column names matching the parameter names. Values typed into the panel are the defaults; a row's columns override them.

Constraint Type Required Columns Optional Columns
Lane Capacity source, target, product, max_flow
Lane Minimum source, target, product, min_flow
Fix Flow source, target, product, value
Throughput Limit location, product min, max
Min Suppliers min_count, min_flow, product
Max Suppliers max_count, product
Single Source product target
Budget Limit max_transport_cost, max_total_cost

product is a concrete product name, or ALL to apply the rule across every product (the sum of matching flows).

Workflow wiring

flowchart LR
    n1["Create Scenario"] --> n2["Add Constraint (into Scenario Data)"]
    n2 --> n3["Network Optimization"]
    n3 --> n4["Create Scenario"]

Chain two nodes for two rules — a lane cap and a supplier floor:

flowchart LR
    n1["Load Scenario"] --> n2["Add Constraint (into Scenario Data)"]
    n2 --> n3["Add Constraint (into Scenario Data)"]
    n3 --> n4["Network Optimization"]
    n4 --> n5["Create Scenario"]

To drive the rules from a file, wire the Import Data node carrying the table into the second port, Constraint Table, and the scenario into the first.

Common mistakes

  • Conflicting rules (a Min Flow greater than a Max Flow on the same lane) — the solver reports the run infeasible.
  • Forgetting Minimum Flow per Active Supplier on Min Suppliers — the solve is refused, because the count means nothing without it.
  • A lane rule whose source, target or product matches nothing in the scenario — the solve reports it as a constraint that matches no arcs rather than silently ignoring it.
  • Expecting a rule to change the baseline data — rules shape what the optimizer is allowed to do, not what the scenario already holds.
  • Heavy use of MIP rules (Min/Max Suppliers, Single Source) on very large networks — solve time can grow significantly.
  • Table column names that do not match the parameter names — check the table above.