Modelbuilder HiGHS hint causes no output from the solver

26 views
Skip to first unread message

Li Mike

unread,
May 6, 2026, 9:56:17 PM (6 days ago) May 6
to or-tools-discuss
I tested the following model: if I remove the statement model.add_hint(x[0][1], 30.0), the model solves normally.
However, when I add this statement, the solver returns no output. What is the reason for this?

I tested in ortools 9.14, 9.15 and newest main branch.

from ortools.linear_solver.python import model_builder
def solve_transportation_problem():
   
    costs = [
        [8, 6, 10, 9],  
        [9, 12, 13, 7],
        [14, 9, 16, 5]  
    ]
    supply = [90, 100, 150]  
    demand = [20, 30, 80, 40]

    num_suppliers = len(supply)
    num_customers = len(demand)

 
    model = model_builder.Model()


    x = []
    for i in range(num_suppliers):
        row = []
        for j in range(num_customers):
           
            var = model.new_num_var(0.0, float(max(supply)), f'x_{i}_{j}')
            row.append(var)
        x.append(row)

    for i in range(num_suppliers):
        model.add(sum(x[i][j] for j in range(num_customers)) <= supply[i])


    for j in range(num_customers):
        model.add(sum(x[i][j] for i in range(num_suppliers)) >= demand[j])


    objective_terms = []
    for i in range(num_suppliers):
        for j in range(num_customers):
            objective_terms.append(x[i][j] * costs[i][j])
   
    model.minimize(sum(objective_terms))


    ############
    # hint
    ############
    model.add_hint(x[0][1], 30.0)

   
    solver = model_builder.Solver('highs')
    solver.enable_output(True)
    status = solver.solve(model)    
   
    print(f'Total Cost = {solver.objective_value}')
 

if __name__ == '__main__':
    solve_transportation_problem()

Laurent Perron

unread,
May 6, 2026, 11:34:36 PM (6 days ago) May 6
to or-tools-discuss
Hints in highs are not implemented in 9.15 I believe.

--Laurent


--
You received this message because you are subscribed to the Google Groups "or-tools-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to or-tools-discu...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/or-tools-discuss/16791dec-888b-4c34-9db0-0f2ea3e0cd82n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages