Re: fmincon



Hi Alexander,

I think you could use the area of intersection as a measure of whether two
rectangles intersect. Given two rectangles with x-coordinates L, R and
y-coordinates B, T, (I think - you'll need to check!) the following code
calculates the area of intersection of the rectangles if they intersect and
returns a negative A if they do not.

L = max(L1, L2);
R = min(R1, R2);
B = max(B1, B2);
T = min(T1, T2);

A = (R-L)*(T-B);
if R-L < 0 && T-B < 0
A = -A;
end

However, this code still suffers from the issue that John raised. That is,
this code will return zero if the two rectangles intersect at a point or
line - an optimization routine would consider this to be a feasible
solution.

Hope this helps

Best regards,

Paul

"Alexander Blumin" <bluminalex@xxxxxxxxx> wrote in message
news:gd85nn$2gq$1@xxxxxxxxxxxxxxxxxxxxx
Yes,you're right but could be some way you think about to require disjoint
rectangles?

According to case you mention its to require all the rectangle bellow left
x-bound of second one or entire rectangle right after the right bound of
it. The same with y axis. Again i'am with some OR conditions.

Thanks,
Alex

"John D'Errico" <woodchips@xxxxxxxxxxxxxxxx> wrote in message
<gd841b$6qm$1@xxxxxxxxxxxxxxxxxx>...
"Alexander Blumin" <bluminalex@xxxxxxxxx> wrote in message
<gd823h$836$1@xxxxxxxxxxxxxxxxxx>...
Hi guys,

I'm working with fmincon on the following optimization problem:

Given a set of rectangles and bivariate normal distribution
i'd like to find the 'best' rectangles position and size.
'Best' here it means the resulted rectangle's union grasp more
probability.(My objective function is actually a double integral over
union of these recntangles).

Now finally the problem: At this stage i'd like to require a disjoint
rectangles in my constraints enequalities.
I don't find a way to do it. Simple way to say rectnagles does not
intersect is to say no vertex of one is inside another one. Now to say
point outside of rectangle is to require point.x outside the x range of
recntangle OR point.y outside the y range of recntangle. I don't know
how to implement this OR. This is logical and isn't continuous
constraint,isn't it?

Any help or thoughts are highly appriciated.

Worse, two rectangles can intersect even
if no point from either of the rects is
inside the other.

John


.



Relevant Pages

  • Re: Spritecollision detection
    ... I would suggest reading the alpha channel of each sprite when you load it, ... portions of the mask where the rectangles intersect to determine the actual ... reflect the official views of the Microsoft Corporation. ...
    (microsoft.public.win32.programmer.directx.managed)
  • Re: Object separation under perspective projection
    ... convex 3D-objects O. ... Sought is a decomposition of O into a minimal number of disjoint sets D_i ... algorithm for determining which of the bounding rectangles intersect. ...
    (comp.graphics.algorithms)
  • Re: math -- boolean combinations of rectangles
    ... does not intersect the boundary of the other rectangles in R. ... complement of the union of the boundaries of its rectangles. ... is only in semi-general position, ...
    (sci.math)
  • Re: scale transformation
    ... Note that these rectangles MAY VERY WELL BE ... suppose I want to apply a scale ... >transformation to the two-dimensional space. ... of having a large scaling factor applied, they still intersect. ...
    (sci.math)
  • fmincon
    ... I'm working with fmincon on the following optimization problem: ... Given a set of rectangles and bivariate normal distribution ... i'd like to find the 'best' rectangles position and size. ... 'Best' here it means the resulted rectangle's union grasp more probability.. ...
    (comp.soft-sys.matlab)