Package uk.ac.soton.itinnovation.pes.data.model

Examples of uk.ac.soton.itinnovation.pes.data.model.ModelExecutionResult


    @Override
  public double[] evaluate (Map <String, Set<Resource>> resources) throws Exception
  {
    ObjectiveFunctionExecutionResult cachedResult = null;
    double[] tmp = null;
    ModelExecutionResult modelExecRes = null;
    Double reliability, infrastructureCost, customerCost;
    Set<AttributeType> outputs = null;

    // check execution cache
        if (!optUtil.disableDBCaching)
View Full Code Here


   */
    @Override
    public ObjectiveFunctionExecutionResult getExecutionResult(Map<String, Set<Resource>> resources, String outputDir) throws Exception
    {
        ObjectiveFunctionExecutionResult objFuncRes = null;
    ModelExecutionResult modelExecRes = null;
    Double reliability, infrastructureCost, customerCost;
    Set<AttributeType> outputs = null;

        // check execution cache
        if (!optUtil.disableDBCaching)
View Full Code Here

    AttributeType reliability = null;

        if (!optUtil.disableDBCaching) // will not check for cached execution results
        {
            System.out.println("         checking for cached execution result in the DB");
            ModelExecutionResult res = super.checkExecutionResult(model, daoFactory, optUtil.convertResourceMapToSet(inputs), null, null);
            if (res != null)
            {
                System.out.println("         found a model execution result, which is returned");
                return res;
            }
            System.out.println("         did not find a matching existing execution result in the DB");
        }
        System.out.println("         executing " + model.getName());

        // Add some sleep time to simulate some wait time if a model had been executed
        Thread.sleep(executionTime);

        // This would be a point at which an application model would be executed,
        // which could be done with the ModelExecuter class in pes-common.
        // Since we do not provide an excutable application model, this sample
        // wrapper calculates a reliability (probability of achieving some QoS
        // constraints) based on a simple hard coded formula that has been invented
        // for this simple test.
        output = optUtil.roundDouble(getReliability(inputs), 3);
        System.out.println("         reliability calculated as " + output);

        // create an output set for the ModelExecutionResult object
        outputs = new HashSet<AttributeType>();
    reliability = new AttributeType();
    reliability.setName("reliability");
    reliability.setType(BasicType.convert("double"));
    reliability.addAValue(new ValueType(String.valueOf(output), MetricType.DEFAULT));
    outputs.add(reliability);

        if (!optUtil.disableDBCaching)
            return super.saveExecutionResult(model, daoFactory, optUtil.convertResourceMapToSet(inputs), null, null, outputs, null);
        else
            return new ModelExecutionResult(model, optUtil.convertResourceMapToSet(inputs), outputs);
    }
View Full Code Here

TOP

Related Classes of uk.ac.soton.itinnovation.pes.data.model.ModelExecutionResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.