Skip to content Skip to sidebar Skip to footer

Cplex Quadratic Objective Cplex Error 1017: Not Available For Mixed-integer Problems

I'm trying to solve the following linear program using cplex: def generate_linear_program(self): problem = cplex.Cplex() problem.objective.set_sense(problem.objective.sense

Solution 1:

It's easy to miss the following note in the documentation for Cplex.variables.add:

If types is specified, the problem type will be a MIP, even if all variables are specified to be continuous.

If you remove the optional types argument from your calls to Cplex.variables.add, the problem should go away. For example, instead of:

problem.variables.add(names = ['c' + str(tokens[1])], ub = [1.0], types = ['C'])

use:

problem.variables.add(names = ['c' + str(tokens[1])], ub = [1.0])

The reason it works when you have a linear objective is that it's being passed into CPXmipopt, as a convenience, after failing CPXlpopt with a CPXERR_NOT_FOR_MIP (error 1017). Whereas, when we call CPXqpopt, this logic is not applied.

Post a Comment for "Cplex Quadratic Objective Cplex Error 1017: Not Available For Mixed-integer Problems"