Cuopt server get_optimized_routes_sync error

hello dear all.

i m testing cuopt server version method
“get_optimized_routes_sync”

i got some error :
AttributeError: ‘NoneType’ object has no attribute ‘cost_matrix’(cost_matrix_data.cost_matrix is not None)
at cuopt_amr_service.py : line 783, in get_optimized_routes_sync

so i check that python file in container

declear graph as

cost_waypoint_graph_data: Optional[UpdateWaypointGraphData] = None,
travel_time_waypoint_graph_data: Optional[UpdateWaypointGraphData] = None,
cost_matrix_data: Optional[UpdateCostMatrices] = None,

and check as like below

if (
    cost_waypoint_graph_data.waypoint_graph is not None
    and cost_matrix_data.cost_matrix is not None
):

when i send graph(only one catagory) ‘NoneType’ object has no attribute can happen always because i will send graph as one type

is that bug right?

It is a bug and being worked on, for now, you can send cost_matrix_data as None to avoid this issue.

thanks for reply.
How can i avoid in API version?
for example i send get_optimized_routes_sync AS below
opt_sync = {
“cost_waypoint_graph_data” : {
“waypoint_graph”: {
“0”: {
“offsets”: [0, 3, 5, 9, 11, 13, 15, 17, 18, 19, 20, 21],
“edges”: [1, 2, 9, 0, 7, 0, 3, 4, 10, 2, 4, 2, 5, 6, 9, 5, 8, 1, 6, 0, 5],
“weights”: [1, 1, 2, 1, 2, 1, 1, 1, 3, 2, 3, 2, 1, 2, 1, 3, 4, 2, 3, 1, 1]
}
}
},

"fleet_data" : {
    "vehicle_locations": [[0, 0], [1, 1], [0, 1], [1, 0], [0, 0]],
    "vehicle_ids" : ["a", "b", "c", "d", "e"],
    "capacities": [[10, 12, 15, 8, 10]],
    "vehicle_time_windows": [[0, 80], [1, 40], [3, 30], [5, 80], [20, 100]],
},


"task_data" : {
    "task_locations": [0, 1, 3, 4, 6, 8],
    "demand": [[0, 3, 4, 4, 3, 2]],
    "task_time_windows": [
        [0, 1000],
        [3, 20],
        [5, 30],
        [1, 20],
        [4, 40],
        [0, 30],
    ],
    "service_times": [0, 3, 1, 8, 4, 0],
},

"solver_config" : {
    "time_limit": 0.01, "number_of_climbers": 128
}

}
than NoneType object error happen. if i add
“cost_matrix_data”: None
or
“cost_matrix_data”: {
“cost_matrix”: {
“0”: [
[
0
]
],
},
“vehicle_type”: 0
},
also error shows up.

How about “cost_matrix_data”:{“cost_matrix”:None}

also error happen

: requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

it maybe happen format (“cost_matrix”:None) not allowed
only “cost_matrix”:{“0” : something"} format allowed

so, when i did like below
“cost_matrix_data”:{“cost_matrix”:{
“0”: None
}},
also error hanppen
SOLVER RESPONSE: {‘detail’: [{‘loc’: [‘body’, ‘cost_matrix_data’, ‘cost_matrix’, ‘0’], ‘msg’: ‘none is not an allowed value’, ‘type’: ‘type_error.none.not_allowed’}]}

I was able to do something like this

cost_matrix = {0: [[0, 1, 1], [1, 0, 1], [1, 1, 0]]}

routing_data = {
“cost_waypoint_graph_data” : {“waypoint_graph”:None},
“travel_time_waypoint_graph_data” : {“waypoint_graph”:None},
“cost_matrix_data”:{“cost_matrix”:cost_matrix},
“travel_time_matrix_data”:{“cost_matrix”:None},
“cost_matrix”: cost_matrix,
“task_data”: task_data,
“fleet_data” : fleet_data,
“solver_config” : solver_config,
}