|
"Liana" wrote in message <img42n$kbr$1@fred.mathworks.com>...
> Hello All,
>
> I'm interested in how the BIP problem can be formulated for the following case. Let's say there is Delaunay Triangulation model of the 2D space. I'd like to find a shortest channel of triangles from the initial position to the goal position. I need to codify the following type of inequality constraints, where xi is the i-th triangle (0 - not selected; 1 - selected) and sum(xij) is the sum of adjacent triangles:
>
> x1 + sum(x1j) <= 3
>
> The problem is that sometimes xij can be equal to NaN meaning that the ith triangle has only 2 adjacent triangles instead of 3. I'm trying to use 'isnan' function to check if x is equal to NaN:
>
> A = [x(1,1) + x(~isnan(neighbors(handles.dt, 1)),1)]
>
> But it does not work. Please give me some advice on how to formulate such kind of constraints.
>
> Thanks a lot.
I see that ~isnan() returns 0 or 1, therefore x(~isnan(...)) does not work correctly. Let me give one example:
x =
9 16 NaN
12 10 11
Now I need to change this code (A = [x(1,1) + x(~isnan(neighbors(handles.dt, 1)),1)]) in such a way that NaN cell is simply skipped.
|