I would like some help writing the following linear (integer? quadratic?) programming problem in matrix form including the application of the constraints.
I am drawing a dashed line around the perimeter of a rounded rectangle (this is a calculation for a user interface I am building, not homework!). However, the length of the dashes, and the size of the rectangle can only take certain values and look good. Let's look at an example of what I mean,

The top image shows the geometry of the rounded rect and the bottom image is an example of an arbitrary dashed line drawn round the perimeter. It doesn't look particularly pleasing, so I am trying to setup and solve a linear programming problem to make the line look good.
The problem.
I want to maximise the area $A=y_1(n)y_2(m)$ of the inner rectangle by finding the odd integers ${m,n}$, subject to a number of constraints.
The constraints.
The length of the sides $y_1$ and $y_2$ must be an odd integer number of dashes, no larger than a maximum width $w$ and height $h$, and non negative,
$$ y_1 = nd\\ y_2 = md\\ y_1 \leq w \\ y_2 \leq h \\ y_1 > 0 \\ y_2 > 0 $$
where $m$ and $n$ are odd integers numbers and $d$ is the dash length (we specify this number). These constraints ensure that the length of the sides finish on dash.
Finally we specify that the dash length is a quarter of the circumference of each corner circle,
$$ d = \frac{1}{4}C \\ C = 2\pi r $$
Writing as a linear system
Substituting $d$ into the above we can write two separate equations for the length of the sides,
$$ \pmatrix{ y_1 \\ y_2 } = \pmatrix{ c & 0 \\ 0 & c } \pmatrix{ n \\ m} $$
where $c=\frac{1}{2}\pi r$.
How to continue?
However, I'm not sure how to,
- include the constraint into this linear system, so that it can find the integers $m$ and $n$,
- specify that the integers should be odd.
- maximize the product $A=y_1(n)y_2(m)$.
Once I have written this problem in matrix for it will be trivial to solve either numerically or symbolically. Any advice is welcome!