Je ne peux malheureusement pas mettre de pièces jointes actuellement. Je mets la partie du script concernée, lignes 406 à 504. * Call after each simulation, compute criteria for last simulation * @param context plan context * @param lastSimulation storage used for next simulation * @return true if we must do next simulation, false to stop plan * @throws Exception */ public boolean afterSimulation(AnalysePlanContext context, SimulationStorage lastSimulation) throws Exception { boolean doNext = true; log.info("after simulation"); int number = lastSimulation.getParameter().getAnalysePlanNumber(); ResultStorage result = lastSimulation.getResultStorage(); /////*** Simulated catches can be cumulated over months(0), strategies(1), metiers(2), groups(3), and area(4). MatrixND L2 = result.getMatrix(param_Population, ResultName.MATRIX_CATCH_WEIGHT_PER_STRATEGY_MET_PER_ZONE_POP); log.info("dim de L2" + " " + Arrays.toString(L2.getDim())); System.out.println("matriceObs :"+ matrixDebarquement); System.out.println("matriceSimule :"+ L2); // log.info("dim de L2" + " " + Arrays.toString(L2.getDim())); /////*** If some strategies, metiers or areas must not be included in the cumulated catches see below else put "//" at the beginning of line 388 and replace "L2" by "L" at line 377 /////*** the strategies or so to exclude must be at the begining or end of the list you enter in the parameters interface /////*** fill the line MatrixND L = L2.getSubMatrix(a,b,c).copy(); as follow : /////*** a = 1 if you want to exclude strategies, 2 if metiers and 4 if areas /////*** b = indice of the first object considered /////*** c = number of object to keep after b, b included /*ArrayList<Integer> strate = new ArrayList<Integer>(); strate.add(0); strate.add(20); */ List<Strategy> listStrat = (List<Strategy>)L2.getSemantic(1); int[] indexStratagarder = new int[2]; for(Strategy s : listStrat){ if(s.getName().equals("PRO_Occasionnel")) indexStratagarder [0] = listStrat.indexOf(s); else if(s.getName().equals("PRO_Regulier")) indexStratagarder [1] = listStrat.indexOf(s); } log.info("indexStratagarder :"+ indexStratagarder); /*List<Metier> listmet = L2.getSemantic(2); int[] indexMetagarder = new int[2]; for(Metier m : listmet){ if(m.getName().equals("PRO_Ligne_GranNou_Recif")) indexMetagarder [1] = listmet.indexOf(m); else if(m.getName().equals("PRO_Ligne_CorneSud_Recif")) indexMetagarder [2] = listmet.indexOf(m); } log.info("indexStratagarder" + " " + indexMetagarder); */ MatrixND L = L2.getSubMatrix(1, indexStratagarder).copy(); // La c'est pas clair pour savoir quelle metiers ont ete conserves dans les donnees simulees. log.info("sous matrice extraite"); log.info("matriceSimule Strategies PRO :"+ L); L = L.sumOverDim(1);// sum over strategies //L = L.sumOverDim(2);// sum over metiers L = L.sumOverDim(4);// sum over zones /////*** if observations are cumulated by groups else put "//" at the beginning of the following line L = L.sumOverDim(3); ////*** if observations are cumulated over quarter put 3, over year 12, else put "//" at the beginning of the following line //L = L.sumOverDim(0, 12); log.info("sommes sur les strategies, zones et groupes faites"); ///log.info("matriceSimule L :"+ L); L = L.reduce(); //log.info("matriceSimule L reduce:"+ L); log.info("dim de obs" + " " + Arrays.toString(matrixDebarquement.getDim())); log.info("dim de L Reduce" + " " + Arrays.toString(L.getDim())); log.info("matriceObs :"+ matrixDebarquement); log.info("matriceSimule Reduce:" + L); ///////////////////Calcul du critere////////////////// log.info("calcul du critere"); double crit = 0; for (MatrixIterator g = L.iterator(); g.hasNext();) { g.next(); //boucle sur les trimestres et les classes d age int[] dim = g.getCoordinates(); double obs = matrixDebarquement.getValue(dim); double simules = g.getValue(); log.info("obs = " + obs); log.info("simule = " + simules); crit += Math.pow(obs - simules, 2); // crit = crit + (obs-simules)^2 }// fin du for log.info("critere " + number + " = " + crit); //ajoute le critere dans la table experiences experiences.getExperience(number).criteria = crit; //ecriture de la table historic exportHisto += experiences.getExperience(number).q1 + ";" + experiences.getExperience(number).q2 + ";" + experiences.getExperience(number).criteria + "\n"; org.nuiton.util.FileUtil.writeString(exportHistoric, exportHisto); return doNext; }// fin du after simulation On Thu, 24 Nov 2011 14:13:19 +0100 Eric Chatellier <chatellier@codelutin.com> wrote:
Le 24/11/2011 14:09, bastien preuss a écrit :
Mais je ne sais pas d'où vient cet élément [0,8].
12 c'est le nombre de mois, et 8 le nombre de métiers parmis les 2 stratégies que je conserve grace aux lignes de code discutées dans les précédents mails.
la ligne 483 correspond au calcul de la capture observée: double obs = matrixDebarquement.getValue(dim); Oui, mais il me faut plus de code. A quoi correspond "dim" ?
-- Éric Chatellier <chatellier@codelutin.com> Tel: 02.40.50.29.28 http://www.codelutin.com
_______________________________________________ Isis-fish-users mailing list Isis-fish-users@list.isis-fish.org http://list.isis-fish.org/cgi-bin/mailman/listinfo/isis-fish-users