0

I've read this SO thread which doesn't answer my question. So I have a cost function to minimize: enter image description here where R is the given outline of a rectangle, and R* is the actual one. Why is it raising to the power of 2 for this option? For example for S (area), it's calculating the first degree.

  • 1
    If R>R, then (R-R)<0. Then to minimize C, simply drive R to negative infinity. The squaring makes sure that you can't do that (as in makes sure the global minimum isn't negative infinity). Continuing, squaring makes the term differentiable compared to taking the absolute value. This makes the math and computations simpler. I could raise it to the fourth power, and everything would work out as well. – Spencer Kraisler Oct 25 '19 at 04:18
  • @SpencerKraisler thanks for the answer. Why couldn't one take the absolute value instead of squaring? Also, why would I need to differentiate the term (for example)? – user3132457 Mar 07 '20 at 11:29
  • 1
    great question. So you absolutely can take the absolute value. You can also take an even power or you use the $\max(R,R^*)$ function as well, and each of those alternatives come with their own useful quirks. The reason why squaring is the common choice is 1) squaring makes the function differentiable (unlike $\max$ or taking the absolute value) and 2) computers can square numbers faster than they can max two numbers, or take absolute values (since those require if statements). – Spencer Kraisler Mar 07 '20 at 22:00
  • in my cost function, what need is (or can be) there to differentiate? – user3132457 Mar 08 '20 at 07:02
  • If you take the derivative of C with respect to R*. If you square it, then the function is differentiable. If you take the absolute value, then the function won't be differentiable at a point. @bb8 – Spencer Kraisler Mar 08 '20 at 20:04
  • I got it but I'm asking why would I need to differentiate it? Usually that's done for finding minimum of function. But since my cost function contains other terms too (aS + bW), I don't see how would differentiation work in this case. – user3132457 Mar 09 '20 at 04:41
  • If you are going to optimize the cost function, you need to differentiate it, no? – Spencer Kraisler Mar 09 '20 at 20:06
  • yes but in this case, how do I differentiate the first and second terms? – user3132457 Mar 10 '20 at 05:00
  • I don't know what $\alpha, \beta$ are. If they depend on $R^$, then just carry on normal differentiation with respect to $R^$. If they don't depend on $R^*$, then they're constants. I never seen this cost function before, and maybe there's a whole side to this I'm not seeing. – Spencer Kraisler Mar 10 '20 at 06:30
  • it is from here: http://cc.ee.ntu.edu.tw/~ywchang/Courses/PD_Source/EDA_floorplanning.pdf, page 42 – user3132457 Mar 10 '20 at 06:45
  • α,β signify how important are minimization of area and wire-length, respectively. and 1-α-β signifies how important it is to have rectangle with given outline. I still don't see why I would need to differentiate the function – user3132457 May 01 '20 at 07:36

0 Answers0