Estimation of states and unknown inputs simultaneously can be done by Proportional-Integral-Observer (PIO). This observer is used in nonlinear and robust control. It has additional integral feedback loop in comparison with the usual Luenberger observer. Increasing the gain of this observer the performance would be increased, however due to this high gain the performance is influenced by measurement noise. Advanced PI-Observer (API) algorithm is a method which is used for scheduling the optimal gain of PI-Observer based on the cost function and by using a bank of PI-Observer. In this contribution the proposed method obtains relative optimal gain by using a given cost function. Afterwards the absolute optimal gain is computed by changing the design parameters at each step based on the desired performance criteria. The absolute optimal gain is found instead of relative optimal gain in comparison with the API-Observer. Simulation results estimating contact forces acting to a vibrating elastic beam based on indirect measurements illustrate the improvement of the proposed method.