Preload causing the assignment to forever reset line search

11 views
Skip to first unread message

seriangelo agriesti

unread,
Mar 25, 2026, 9:50:58 AM (9 days ago) Mar 25
to AequilibraE
Hello and thank you for managing the google group and supporting! 
I am reaching out with the following issue, I am trying to assign some private vehicles as background traffic through preload but, when I do (see attached code) the assignment results in a never ending printing of "Reset Line Search", which I understand means that BFW cannot define the size of the next step. I have tried different values for my background traffic load, but even very small values (which I expected would not impact convergence) cause this behavior. Switching to MSA prevent the "Reset Line Search" message, as expected, but the assignment runs indefinitely. Removing the preload lets the code revert to normal behavior. 

Am I implementing preload wrong? I already checked and the size of the preload dataframe, the direction of the edges (all unidirectional) and the flow values all seem to be correct (right length, format, etc.)

Please let me know if more information is needed, in the meantime thank you for your work and your time.
Best Regards,
Serio Agriesti


CODE:
from aequilibrae.paths import TrafficAssignment, TrafficClass

# Configuration
weight = "travel_time"
RGAP_TARGET = 1e-5
MAX_ITER = 5000
ALGORITHM = "bfw"
VDF = "BPR"
VDF_PARAMS = {"alpha""alpha""beta""beta"}

# WITHOUT PRELOAD
# Set up traffic class
traffic_class = TrafficClass(name=period_name, graph=ae_graph, matrix=ae_od_aem)

# Create assignment
assignment = TrafficAssignment()
assignment.set_classes([traffic_class])
assignment.set_vdf(VDF)
assignment.set_vdf_parameters(VDF_PARAMS)
assignment.set_capacity_field("capacity")
assignment.set_time_field(weight)

# Set algorithm parameters
assignment.set_algorithm(ALGORITHM)
assignment.max_iter = MAX_ITER
assignment.rgap_target = RGAP_TARGET

# Execute assignment
print(f"Executing {period_name} assignment...")
assignment.execute()

skims = traffic_class.results.skims
zone_ids = list(skims.index)
skim_df = pd.DataFrame(skims.matrix[weight], index=zone_ids, columns=zone_ids)
skim_df_sec = skim_df * 3600 # transform travel times from hours to seconds

network_df = env.model_transp.traffic_assignment["CAR"]["network"].copy()
res = assignment.results()
flows = network_df.merge(res, on="link_id", how="left")

# # WITH PRELOAD
print("WITH PRELOAD STARTING NOW...")
# Set up traffic class
traffic_class = TrafficClass(name=period_name, graph=ae_graph, matrix=ae_od_aem)

# Create assignment
assignment = TrafficAssignment()
assignment.set_classes([traffic_class])
assignment.set_vdf(VDF)
assignment.set_vdf_parameters(VDF_PARAMS)
assignment.set_capacity_field("capacity")
assignment.set_time_field(weight)


preload_df = pd.DataFrame({
   'link_id': ae_graph.graph.link_id.values,
   'direction': 1,
   'preload': flows["matrix_tot"]        # np.random.rand(len(ae_graph.graph)) * 35  # Example preload values, replace with actual data
})

# Add preload to the assignment
assignment.add_preload(preload_df, period_name)

# Set algorithm parameters
assignment.set_algorithm(ALGORITHM)
assignment.max_iter = MAX_ITER
assignment.rgap_target = RGAP_TARGET


assignment.assignment.preload
# Execute assignment
print(f"Executing {period_name} assignment...")
assignment.execute()

skims = traffic_class.results.skims
zone_ids = list(skims.index)
skim_df = pd.DataFrame(skims.matrix[weight], index=zone_ids, columns=zone_ids)
skim_df_sec_1 = skim_df * 3600 # transform travel times from hours to seconds

(skim_df_sec_1-skim_df_sec).sum().sum()

Pedro Camargo

unread,
Mar 25, 2026, 2:27:43 PM (9 days ago) Mar 25
to AequilibraE
Hi Serio,

Your code looks correct, so it could be a bug in the software.  Would you be able to share data sufficient for us to reproduce the error?

Cheers,
Pedro


--
You received this message because you are subscribed to the Google Groups "AequilibraE" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aequilibrae...@googlegroups.com.


Pedro Camargo

unread,
Apr 2, 2026, 12:13:21 AM (yesterday) Apr 2
to AequilibraE
Somebody fixed that issue, Serio. It will be included in the next release.



Cheers,
Pedro



From: Pedro Camargo <c...@margo.co>
To: "AequilibraE"<aequi...@googlegroups.com>
Date: Thu, 26 Mar 2026 04:27:32 +1000
Subject: Re:Preload causing the assignment to forever reset line search

Hi Serio,

Your code looks correct, so it could be a bug in the software.  Would you be able to share data sufficient for us to reproduce the error?

Cheers,
Pedro



From: seriangelo agriesti <seria...@gmail.com>
To: "AequilibraE"<aequi...@googlegroups.com>
Date: Wed, 25 Mar 2026 10:50:58 -0300
Subject: Preload causing the assignment to forever reset line search





--
You received this message because you are subscribed to the Google Groups "AequilibraE" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aequilibrae...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages