Search code examples
pythonpyomo

Defining a dummy Objective in Pyomo


So I'm trying to structure an MCP for Pyomo (with Python 3) where there's only one solution which fits all the complementary conditions, making the objective function redundant. Do I need to define an objective at all, or is there any way to define a dummy objective?


Solution

  • It depends on the solver that you are using. Some solvers will complain without the presence of an objective. My favorite ways to add a dummy include:

    • model.dummy = Objective(expr=1)
    • model.dummy_var = Var(bounds=(0, 1)) with model.dummy = Objective(expr=model.dummy_var)