RosenV1.java [src/java/m/example/simpleservice] Revision: default Date:
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package m.example.simpleservice;
import csip.ModelDataService;
import javax.ws.rs.Path;
import csip.annotations.*;
@Name("Rosenbrock ")
@VersionInfo("$Id$")
@Path("m/rosen/1.0")
public class RosenV1 extends ModelDataService {
@Override
protected void doProcess() throws Exception {
double x0 = parameter().getDouble("x0");
double x1 = parameter().getDouble("x1");
results().put("rb", f(x0, x1));
}
double f(double x0, double x1) {
double ex = Math.pow(x0, 2);
double a = Math.pow(1 - x0, 2);
double b = Math.pow(x1 - ex, 2);
return a + (100 * b);
}
}