hots.plugins.optimization.pyomo_model

Pyomo-based optimization plugin for HOTS (single concrete implementation).

class hots.plugins.optimization.pyomo_model.PyomoModel(params: dict, instance)[source]

Bases: OptimizationPlugin

Concrete optimization backend using Pyomo.

Add mustLink constraints for fixing solution.

Add mustLink constraints for fixing solution.

build(*, u_mat=None, w_mat=None, v_mat=None, dv_mat=None)[source]

Create and store a concrete Pyomo model instance for this pb_number.

build_constraints()[source]

Build all the constraints.

build_objective()[source]

Define objective function.

build_parameters()[source]

Build all Pyomo Params and Sets from data.

build_variables()[source]

Define decision variables for clustering (1) or business problem (2).

create_data()[source]

Build data dictionnary to instanciate abstract model and build ready-to-solve model.

fill_dual_values()[source]

Extract duals for the ‘must_link’ constraints after solve(). Returns a mapping from index (container tuple) to its dual value.

solve(*, solver: str | None = None)[source]

Solve the current concrete instance (labels optional for compatibility).

update_adjacency_constraints(matrix)[source]

Update constraints fixing u or v variables from new solution.

update_dv(dv)[source]

Update directly the dv param in instance from new dv matrix.

update_obj_place(dv)[source]

Update the objective for placement with new dv matrix.

update_size_model(dict_id_c, new_df_indiv=None, u_mat=None, w_mat=None, v_mat=None, dv_mat=None)[source]

Rebuild the abstract & concrete models when the set of containers changes (e.g. new/deleted containers).

update_sol_u(u)[source]

Update directly u variable from new adjacency matrix.

update_sol_v(v_matrix)[source]

Update directly v variable from new adjacency matrix.

update_w(w)[source]

Update directly the w param in instance from new w matrix.

write_infile(fname=None)[source]

Export optimization model in file.