/*
 * Copyright (C) 2015 smahevas
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as
 * published by the Free Software Foundation, either version 3 of the 
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public 
 * License along with this program.  If not, see
 * <http://www.gnu.org/licenses/gpl-3.0.html>.
 */

package scripts;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import fr.ifremer.isisfish.util.Doc;
import fr.ifremer.isisfish.entities.*;
import org.nuiton.math.matrix.*;

/**
 * ObjectiveFunctionDynPop.java
 *
 * Created: 27 mai 2015
 *
 * @author smahevas <user.name@vcs.hostName>
 * @version $Revision: 0 $
 *
 * Last update: $Date: 27 mai 2015 $
 * by : $Author: smahevas $
 */
public class ObjectiveFunctionDynPop extends ObjectiveFunction {

    /** to use log facility, just put in your code: log.info("..."); */
    private static Log log = LogFactory.getLog(ObjectiveFunctionDynPop.class);

	
	protected double Syearplusun, M, Syear;
	//S peut etre une abondance moyenne ou SSB moyenne
	
	public ObjectiveFunctionDynPop(double Syearplusun, double M, double Syear) { // step ??
		this.Syearplusun = Syearplusun;
		this.M = M;
		this.Syear = Syear;
	}

	public double compute(double xx) {	
		double ff = Math.pow((Syearplusun - ((1-Math.exp(-(xx+M)))/(xx+M)*Syear)),2);
		return ff;  
	}
}
