Maximizing convex function
AnsweredHi!
I believe convex optimization means to find the minimum of a convex function or the maximum of a concave function ( maximum of a concave function == minimum of -concave function, -concave function==convex function).
I tried to find the maximum of a convex function, and it solved it. Does that mean gurobipy replaces the objective function with a piecewise linear function?
#
import gurobipy as gp
from gurobipy import GRB
m=gp.Model()
x=m.addVar(vtype='C',lb=0,ub=1)
m.setObjective(x**2-0.6*x, GRB.MAXIMIZE)
m.optimize()
-
Hi,
Does that mean gurobipy replaces the objective function with a piecewise linear function?
No, Gurobi only uses piecewise-linear approximations if you use the addGenConstr methods.
For nonconvex models, Gurobi uses the spatial B&B approach.
In your particular case, the model is so easy, that Gurobi is able to solve it in its presolve step.
Best regards,
Jaromił1 -
Thank you so much! Jaromił Najman
I am working on a large-scale problem and wanted to know if all constraints are linear or convex with a nonconvex objective function that gurobipy can solve it in affordable computing time.
Best,
Hussein
0 -
Hi Hussein,
I am working on a large-scale problem and wanted to know if all constraints are linear or convex with a nonconvex objective function that gurobipy can solve it in affordable computing time.
This cannot be stated a priori. The only way to find out is to actually construct the model and try to solve it.
Best regards,
Jaromił1
Please sign in to leave a comment.
Comments
3 comments