//package fsegaoppmodel; ////import agents.bayesianopponentmodel.*; //import java.util.ArrayList; // //import genius.core.issue.Issue; //import genius.core.utility.UtilitySpace; //import genius.core.Bid; //import genius.core.BidIterator; // // //public class MyBayesianOpponentModelScalable extends OpponentModel { // // // private UtilitySpace fUS; // private ArrayList> fWeightHyps; // private ArrayList> fEvaluatorHyps; //// private ArrayList fEvalHyps; //// public ArrayList fBiddingHistory; // previous bids of the opponent, not our bids. //// private ArrayList fUSHyps; // private double fPreviousBidUtility; // ArrayList issues; // private double[] fExpectedWeights; // double minUtility, maxUtility; // // public MyBayesianOpponentModelScalable(UtilitySpace pUtilitySpace) { // // // // fPreviousBidUtility = 1; // fDomain = pUtilitySpace.getDomain(); // issues=(ArrayList) fDomain.getIssues(); // fUS = pUtilitySpace; // fBiddingHistory = new ArrayList(); // fExpectedWeights = new double[pUtilitySpace.getDomain().getIssues().size()]; // fWeightHyps = new ArrayList>(); // // initWeightHyps(); // // //generate all possible hyps of evaluation functions // fEvaluatorHyps = new ArrayList> (); // int lTotalTriangularFns = 4; // for(int i =0; i<(() fUS).getNrOfEvaluators();i++) { //// switch(fUS.getEvaluator(issues.get(i).getNumber()).getType()) { //// case PRICE: // ArrayList lEvalHyps = new ArrayList(); // fEvaluatorHyps.add(lEvalHyps); //// //EvaluatorReal lEval = (EvaluatorReal)(fUS.getEvaluator(i)); //// IssueReal lIssuePrice = (IssueReal)(fDomain.getIssue(i)); //// //uphill //// EvaluatorReal lHypEval = new EvaluatorReal(); //// lHypEval.setUpperBound(lIssuePrice.getUpperBound()); //// lHypEval.setLowerBound(lIssuePrice.getLowerBound()); //// lHypEval.setType(EVALFUNCTYPE.LINEAR); //// lHypEval.addParam(1, (double)1/(lHypEval.getUpperBound()-lHypEval.getLowerBound())); //// lHypEval.addParam(0, -lHypEval.getLowerBound()/(lHypEval.getUpperBound()-lHypEval.getLowerBound())); //// EvaluatorHypothesis lEvaluatorHypothesis = new EvaluatorHypothesis (lHypEval, "uphill"); //// lEvalHyps.add(lEvaluatorHypothesis); //// //downhill //// lHypEval = new EvaluatorReal(); //// lHypEval.setUpperBound(lIssuePrice.getUpperBound()); //// lHypEval.setLowerBound(lIssuePrice.getLowerBound()); //// lHypEval.setType(EVALFUNCTYPE.LINEAR); //// lHypEval.addParam(1, -(double)1/(lHypEval.getUpperBound()-lHypEval.getLowerBound())); //// lHypEval.addParam(0, (double)1+lHypEval.getLowerBound()/(lHypEval.getUpperBound()-lHypEval.getLowerBound())); //// lEvaluatorHypothesis = new EvaluatorHypothesis (lHypEval, "downhill"); //// lEvalHyps.add(lEvaluatorHypothesis); //// for(int k=1;k<=lTotalTriangularFns;k++) { //// //triangular //// lHypEval = new EvaluatorReal(); //// lHypEval.setUpperBound(lIssuePrice.getUpperBound()); //// lHypEval.setLowerBound(lIssuePrice.getLowerBound()); //// lHypEval.setType(EVALFUNCTYPE.TRIANGULAR); //// lHypEval.addParam(0, lHypEval.getLowerBound()); //// lHypEval.addParam(1, lHypEval.getUpperBound()); //// double lMaxPoint = lHypEval.getLowerBound()+(double)k*(lHypEval.getUpperBound()-lHypEval.getLowerBound())/(lTotalTriangularFns+1); //// lHypEval.addParam(2, lMaxPoint); //// lEvaluatorHypothesis = new EvaluatorHypothesis (lHypEval, "triangular " + String.valueOf(lMaxPoint)); //// lEvalHyps.add(lEvaluatorHypothesis); //// } //// for(int k=0;k(); //// fEvaluatorHyps.add(lEvalHyps); //// //EvaluatorReal lEval = (EvaluatorReal)(fUS.getEvaluator(i)); //// IssueReal lIssue = (IssueReal)(fDomain.getIssue(i)); //// //uphill //// lHypEval = new EvaluatorReal(); //// lHypEval.setUpperBound(lIssue.getUpperBound()); //// lHypEval.setLowerBound(lIssue.getLowerBound()); //// lHypEval.setType(EVALFUNCTYPE.LINEAR); //// lHypEval.addParam(1, (double)1/(lHypEval.getUpperBound()-lHypEval.getLowerBound())); //// lHypEval.addParam(0, -lHypEval.getLowerBound()/(lHypEval.getUpperBound()-lHypEval.getLowerBound())); //// lEvaluatorHypothesis = new EvaluatorHypothesis (lHypEval, "uphill"); //// lEvalHyps.add(lEvaluatorHypothesis); //// //downhill //// lHypEval = new EvaluatorReal(); //// lHypEval.setUpperBound(lIssue.getUpperBound()); //// lHypEval.setLowerBound(lIssue.getLowerBound()); //// lHypEval.setType(EVALFUNCTYPE.LINEAR); //// lHypEval.addParam(1, -(double)1/(lHypEval.getUpperBound()-lHypEval.getLowerBound())); //// lHypEval.addParam(0, (double)1+ lHypEval.getLowerBound()/(lHypEval.getUpperBound()-lHypEval.getLowerBound())); //// lEvaluatorHypothesis = new EvaluatorHypothesis (lHypEval, "downhill"); //// lEvalHyps.add(lEvaluatorHypothesis); //// for(int k=1;k<=lTotalTriangularFns;k++) { //// //triangular //// lHypEval = new EvaluatorReal(); //// lHypEval.setUpperBound(lIssue.getUpperBound()); //// lHypEval.setLowerBound(lIssue.getLowerBound()); //// lHypEval.setType(EVALFUNCTYPE.TRIANGULAR); //// lHypEval.addParam(0, lHypEval.getLowerBound()); //// lHypEval.addParam(1, lHypEval.getUpperBound()); //// double lMaxPoint = lHypEval.getLowerBound()+(double)k*(lHypEval.getUpperBound()-lHypEval.getLowerBound())/(lTotalTriangularFns+1); //// lHypEval.addParam(2, lMaxPoint); //// lEvaluatorHypothesis = new EvaluatorHypothesis (lHypEval, "triangular " + String.format("%1.2f", lMaxPoint)); //// lEvalHyps.add(lEvaluatorHypothesis); //// } //// for(int k=0;k(); // fEvaluatorHyps.add(lEvalHyps); // //EvaluatorReal lEval = (EvaluatorReal)(fUS.getEvaluator(i)); // IssueDiscrete lDiscIssue = (IssueDiscrete)(fDomain.getIssue(i)); // //uphill // EvaluatorDiscrete lDiscreteEval = new EvaluatorDiscrete(); // for(int j=0;j2) { // lTotalTriangularFns = lDiscIssue.getNumberOfValues()-1; // for(int k=1;k lWeightHyps = new ArrayList(); // for(int j=0;j> lWeightHyps = new ArrayList>(); // //make new hyps array // for(int i=0;i lTmp = new ArrayList(); // for(int j=0;j> lEvaluatorHyps = new ArrayList>(); // for(int i=0;i lTmp = new ArrayList(); // for(int j=0;j1) { // // //update the weights // updateWeights(); // //update evaluation functions // updateEvaluationFns(); // } else { // //do not update the weights // //update evaluation functions // updateEvaluationFns(); // } //if // //// System.out.println(getMaxHyp().toString()); // //calculate utility of the next partner's bid according to the concession functions // fPreviousBidUtility = fPreviousBidUtility-0.003; // for(int i=0;ilMaxWeightProb) { // lMaxWeightProb = fWeightHyps.get(i).get(j).getProbability(); // lBestWeights[i] = fWeightHyps.get(i).get(j).getWeight(); // } // } // //find best evaluation fn // double lMaxEvalProb = -1; // for(int j=0;jlMaxEvalProb ) { // lMaxEvalProb = fEvaluatorHyps.get(i).get(j).getProbability(); // lBestEvals[i] = fEvaluatorHyps.get(i).get(j); // } // } // // } ///* //print all weights // for(int i=0;iu) minUtility=u; // if (maxUtility