简体   繁体   中英

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?

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM