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()
-
Official comment
This post is more than two years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum, or try Gurobot, our chatbot interface offering instant, expert-level support. -
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
Post is closed for comments.
Comments
4 comments