简体   繁体   中英

Nonlinear constraints with fmincon in matlab

I am using fmincon to minimize overlap between circles over a map region. This is working for the rectangle/square region however I would like to have the constraint that the centers of the circles are on land (the continental US). Is there a way to specify this constraint in fmincon using inpolygon?

No, because that would introduce non-smoothness in your optimization problem. Deciding if a point is in a polygon is a yes/no decision.

However, you can always rewrite the polygon constraint, with x the vector of optimization variables as Ax<=b . A 2D example, with x=[x1;x2] and assuming a square region, the values would be

A = [1 0; -1 0; 0 1; 0 -1];
b = [1; 0; 1; 0];

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