You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@joshua.apache.org by mj...@apache.org on 2016/06/01 02:51:38 UTC
[43/94] [abbrv] [partial] incubator-joshua git commit: Pulled
JOSHUA-252 changes and Resolved Merge Conflicts
http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/ef91969a/ext/giza-pp/mkcls-v2/KategProblemKBC.h
----------------------------------------------------------------------
diff --git a/ext/giza-pp/mkcls-v2/KategProblemKBC.h b/ext/giza-pp/mkcls-v2/KategProblemKBC.h
deleted file mode 100644
index 4bac62a..0000000
--- a/ext/giza-pp/mkcls-v2/KategProblemKBC.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
-
-Copyright (C) 1997,1998,1999,2000,2001 Franz Josef Och
-
-mkcls - a program for making word classes .
-
-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 2
-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, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-USA.
-
-*/
-
-
-
-
-
-
-
-#ifndef KATEGPROBLEMKBC_H
-#define KATEGPROBLEMKBC_H
-
-typedef Array<FreqType> FreqArray;
-typedef Array<double> FreqArrayReal;
-
-
-double verfaelsche(int a,double b);
-double verfaelsche(double a,double b);
-
-class KategProblemKBC
-
-
-{
- friend class KategProblem;
-
- private:
- Array<FreqArray> _n;
- Array<FreqType> _n1;
-
- Array<FreqType> _n2;
-
-
- double sigmaVerfaelschung;
- short withVerfaelschung;
-
- Array<FreqArrayReal> _nverf;
- Array<double> _n1verf;
- Array<double> _n2verf;
- FreqType _nWords;
-
- protected:
- int eta0;
- int eta1;
- int c1_0;
- int c2_0;
- double _bigramVerfSum;
- double _unigramVerfSum1;
- double _unigramVerfSum2;
- double verfInit0;
-
- public:
- int nKats;
-
- KategProblemKBC(int nKats,double sv);
-
-
- double fullBewertung(int auswertung);
-
-
- FreqType n(int w1,int w2) { return _n[w1][w2]; };
-
-
- FreqType n1(int w) { return _n1[w];};
-
-
- FreqType n2(int w) { return _n2[w];};
-
-
- double bigramVerfSum();
- double unigramVerfSum1();
- double unigramVerfSum2();
-
- double nverf(int w1,int w2) { return _nverf[w1][w2]; }
-
- double n1verf(int w) { return _n1verf[w]; };
-
- double n2verf(int w) { return _n2verf[w]; };
-
- inline void addN(int w1,int w2, FreqType n);
-
-
- void setN(int w1,int w2, FreqType n);
-
-
- double myCriterionTerm();
-
-};
-
-inline void KategProblemKBC::addN(int w1,int w2, FreqType n)
-{
- if(n!=0)
- {
- FreqType &s= _n[w1][w2];
- if(s==0)
- eta0--;
- else if(s==1)
- eta1--;
- if(_n1[w1]==0)
- c1_0--;
- if(_n2[w2]==0)
- c2_0--;
-
- if(withVerfaelschung)
- {
- double verfOld=verfaelsche(s,sigmaVerfaelschung);
- double verfNew=verfaelsche(s+n,sigmaVerfaelschung);
- double verfOld1=verfaelsche(_n1[w1],sigmaVerfaelschung);
- assert(verfOld1==_n1verf[w1]);
- double verfNew1=verfaelsche(_n1[w1]+n,sigmaVerfaelschung);
- double verfOld2=verfaelsche(_n2[w2],sigmaVerfaelschung);
- assert(verfOld2==_n2verf[w2]);
- double verfNew2=verfaelsche(_n2[w2]+n,sigmaVerfaelschung);
- _n1verf[w1]=verfNew1;
- _unigramVerfSum1+=verfNew1-verfOld1;
- _n2verf[w2]=verfNew2;
- _unigramVerfSum2+=verfNew2-verfOld2;
- _nverf[w1][w2]=verfNew;
- _bigramVerfSum+=verfNew-verfOld;
- _nWords+=n;
- }
- s+=n;_n1[w1]+=n;_n2[w2]+=n;
-
- assert(_n[w1][w2]>=0);
- assert(_n1[w1]>=0);
- assert(_n2[w2]>=0);
-
- if(s==0)
- eta0++;
- else if(s==1)
- eta1++;
- if(_n1[w1]==0)
- c1_0++;
- if(_n2[w2]==0)
- c2_0++;
- }
-};
-#endif
http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/ef91969a/ext/giza-pp/mkcls-v2/KategProblemTest.cpp
----------------------------------------------------------------------
diff --git a/ext/giza-pp/mkcls-v2/KategProblemTest.cpp b/ext/giza-pp/mkcls-v2/KategProblemTest.cpp
deleted file mode 100644
index df88d18..0000000
--- a/ext/giza-pp/mkcls-v2/KategProblemTest.cpp
+++ /dev/null
@@ -1,695 +0,0 @@
-/*
-
-Copyright (C) 1997,1998,1999,2000,2001 Franz Josef Och
-
-mkcls - a program for making word classes .
-
-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 2
-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, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-USA.
-
-*/
-
-
-
-
-#include "KategProblemTest.h"
-
-#include "ProblemTest.h"
-#include "HCOptimization.h"
-#include "TAOptimization.h"
-#include "RRTOptimization.h"
-#include "GDAOptimization.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string>
-#include <sstream>
-
-typedef pair<string,string> PSS;
-
-#define NEW_SENTENCE_END "mkcls-mapped-dollar-symbol-$"
-
-#ifdef NeXT
-char *strdup(char *a)
-{
- char *p = (char *)malloc(strlen(a)+1);
- strcpy(p,a);
- return p;
-}
-
-#endif
-
-
-void writeClasses(Array<Kategory> &katOfWord,KategProblem &problem,ostream &to)
-{
- for(int i=0;i<katOfWord.size();i++)
- {
- if( strcmp(problem.getString(i),"$") ) {
- if( strcmp(problem.getString(i),"mkcls-mapped-dollar-symbol-$")==0 )
- to << "$" << "\t" << katOfWord[i] << endl;
- else
- to << problem.getString(i) << "\t" << katOfWord[i] << endl;
- }
- }
-}
-
-
-void mysplit(const string &s,string &s1,string &s2)
-{
- unsigned int i=0;
- for(;i<s.length();i++)if( s[i]==' ' || s[i]=='\t' || s[i]==' ')break;
- s1=s.substr(0,i);
- for(;i<s.length();i++)if( !(s[i]==' ' || s[i]=='\t' || s[i]==' ') )break;
- s2=s.substr(i,s.length()-i);
-
- iassert(s1.size());
- iassert(s2.size());
-}
-
-
-
-int fromCatFile(KategProblem *p,const char *fname,bool verb)
-{
- leda_h_array<string,int> translation(-1);
- int maxCat=2;
- ifstream in(fname);
- if(!in)
- {
- cerr << "Error: File '" << fname << "' cannot be opened.\n";
- exit(1);
- }
- for(int i=0;i<p->wordFreq.nWords;i++)
- (p->initLike)[i]= -1;
-
-
- translation["1"]=1;
- translation["0"]=0;
-
-
- string s;
- while( getline(in,s) )
- {
- string str,categ;
- mysplit(s,str,categ);
- int i=p->words->binary_locate(str);
- if(i>=0 && (*(p->words))[i]==str )
- {
-
- if( translation[categ]==-1 )
- translation[categ]=maxCat++;
- int cat=translation[categ];
- if( (p->initLike)[i]!= -1 )
- cerr << "Warning: Word '" << ((*(p->words))[i])<< "' is already in a category.\n";
- (p->initLike)[i]=cat;
- }
- else
- cerr << "Warning: Word '" << str << "' " << i << " is not in training corpus.\n";
- }
-
- if( verboseMode )
- cout << "We have " << maxCat << " read non-empty categories"
- " (with words from the corpus).\n";
-
- if(maxCat>p->katFreq.nKats)
- {
- cerr << "Error: Not enough categories reserved (only "
- << p->katFreq.nKats << ", but i need " << maxCat << ").\n";
- exit(1);
- }
-
-
- int i=p->words->binary_locate("$");
- if( i>=0 && (*(p->words))[i]=="$" )
- (p->initLike)[i]=0;
- else
- if( verboseMode )
- cerr << "Warning: No '$' in vocabulary!\n";
-
-
- int errors=0;
- for(i=0;i<p->wordFreq.nWords;i++)
- if((p->initLike)[i]== -1 )
- {
- if( verb ) cerr << "Error: I don't know the category of word " << i
- << " (" << (*(p->words))[i] << ") " << ".\n";
- errors=1;
- }
- return errors;
-}
-
-
-
-KategProblem *makeKategProblem(const leda_h_array<PSS,FreqType>&cTbl,const leda_set<string>&setVokabular, int maxClass,int initialisierung,
- int auswertung,int nachbarschaft,int minWordFrequency)
-{
-
- int nwrd=0;
- leda_array<string>&sVok = *new leda_array<string>(setVokabular.size());
- string s;
- unsigned int ctr=0;
- forall_set(leda_set<string>,s,setVokabular)
- {
- if( verboseMode>2 )
- cout << "mkcls:Wort " << ctr << " " << s << endl;
- sVok[ctr++]=s;
- }
- for(unsigned int z=0;z<ctr-1;z++)
- iassert( sVok[z]<sVok[z+1] );
- sVok.sort();
-
- if( verboseMode>2 )
- cout << "*****Vocabulary: " << sVok;
-
- unsigned int vokSize=sVok.size();
- massert(vokSize==ctr); massert(vokSize==setVokabular.size());
- if(verboseMode)
- {cout << "Size of vocabulary: " << vokSize << "\n";cout.flush();}
-
- KategProblem *k = new KategProblem(vokSize,maxClass,initialisierung,
- auswertung,nachbarschaft,minWordFrequency);
- KategProblemWBC &w=k->wordFreq;
- k->words=&sVok;
-
- Array<int> after(vokSize,0);
- Array<int> before(vokSize,0);
-
-
- nwrd=0;
- {
- PSS s;
- forall_defined_h2(PSS,FreqType,s,cTbl)
- {
- const string&ss1=s.first;
- const string&ss2=s.second;
- if( ss2.length()&&(ss1!="$" || ss2!="$") )
- {
- int i1=sVok.binary_search(ss1);
- int i2=sVok.binary_search(ss2);
- iassert( sVok[i1] == ss1 );iassert( sVok[i2] == ss2 );
- after[i1]++;
- before[i2]++;
- }
- if( verboseMode&&((nwrd++)%10000==0) )
- {cout<<"Statistiken-1 " << nwrd<< ". \r";cout.flush();}
- }
- }
-
- for(unsigned int i=0;i<vokSize;i++)
- {
- w.setAfterWords(i,after[i]);
- w.setBeforeWords(i,before[i]);
- }
-
-
- {
- nwrd=0;
- PSS s;
- forall_defined_h2(PSS,FreqType,s,cTbl)
- {
- const string&ss1=s.first;
- const string&ss2=s.second;
- FreqType p=cTbl[s];
- if( ss2.length()&&(ss1!="$" || ss2!="$") )
- {
- int i1=sVok.binary_search(ss1);
- int i2=sVok.binary_search(ss2);
- iassert( sVok[i1] == ss1 );iassert( sVok[i2] == ss2 );
- w.setFreq(i1,i2,p);
- if( verboseMode>2 )
- cout << "BIGRAMM-HAEUF: " << ss1 << ":" << i1 << " "
- << ss2 << ":" << i2 << " " << p << endl;
- }
- if( verboseMode&&((nwrd++)%10000==0) )
- {cout<<"Statistiken-2 " <<nwrd<< ". \r";cout.flush();}
- }
- }
-
- w.testFull();
- if(verboseMode){cout << "Datenintegritaet getestet.\n";cout.flush();}
- return k;
-}
-
-KategProblem *fromNgrFile(const char *str,int maxClass,int initialisierung,
- int auswertung,int nachbarschaft,int minWordFrequency)
-{
- ifstream file(str);
- if(!file)return 0;
- leda_set<string> setVokabular;
- leda_h_array<PSS,FreqType> cTbl;
- double c=0;
- if( verboseMode )cout << "NGRFILE: " << str << endl;
- string s1,s2;
- while(file >> c >> s1 >> s2)
- {
- if( s1.length()==0||s2.length()==0 )
- {
- cerr << "ERROR: strings are zero: " << s1.length() <<" " << s1 <<" " << s2.length()<<" " << s2 << endl;
- return 0;
- }
- if( c==0 )
- {
- cerr << "Count ist 0 " << s1 << " " << s2 << endl;
- return 0;
- }
- cTbl[pair<string,string>(s1,s2)]=(FreqType)c;
- setVokabular.insert(s1);
- setVokabular.insert(s2);
- if( verboseMode>1 )
- cout << "R: " << s1 << " " << s2 << " " << c << endl;
- c=0;
- }
-
- return makeKategProblem(cTbl,setVokabular,maxClass,initialisierung,auswertung,nachbarschaft,minWordFrequency);
-}
-
-
-
-
-
-
-
-
-KategProblem *fromKModel(const char *str,int maxClass,int initialisierung,
- int auswertung,int nachbarschaft,int minWordFrequency)
-{
- string oldText,text,line;
- ifstream f(str);
- if( !f )
- {
- cerr << "ERROR: can not open file " << str << ".\n";
- return 0;
- }
-
- leda_set<string> setVokabular;
- leda_h_array<PSS,FreqType> cTbl(0);
- oldText="$";
- while(1)
- {
- getline(f,line);
- if(f.fail() && !f.bad() && !f.eof())
- {
- cerr << "WARNING: strange characters in stream (getline) " << endl;f.clear();
- }
- if(!f)break;
-
- istringstream f2(line);
- while( 1 )
- {
- f2 >> text;
- if(f2.fail() && !f2.bad() && !f2.eof())
- {
- cerr << "WARNING: strange characters in stream (>>) !\n";
- f2.clear(ios::failbit);
- }
- if(!f2){break;}
- if( text == "$" )
- text = "mkcls-mapped-dollar-symbol-$";
- if( !setVokabular.member(text) )setVokabular.insert(text);
- cTbl[pair<string,string>(oldText,text)]++;
- oldText=text;
- }
- text="$";
- if( !setVokabular.member(text) )setVokabular.insert(text);
- cTbl[pair<string,string>(oldText,text)]++;
- oldText=text;
- }
- return makeKategProblem(cTbl,setVokabular,maxClass,initialisierung,auswertung,nachbarschaft,minWordFrequency);
-}
-
-
-
-
-
-void KategProblemSetParameters(KategProblem &p)
-{
- if( p.katwahl()==K_BEST )
- {
- TAOptimization::defaultAnnRate=0.7;
- RRTOptimization::defaultAnnRate=0.95;
- GDAOptimization::defaultAlpha=0.05;
- if( verboseMode )
- cout << "Parameter-setting like W-DET-BEST\n";
- }
- else
- {
- TAOptimization::defaultAnnRate=0.4;
- RRTOptimization::defaultAnnRate=0.6;
- GDAOptimization::defaultAlpha=0.0125;
- if( verboseMode )
- cout << "Parameter-setting like W-DET-DET\n";
- }
-}
-
-
-
-
-KategProblem &makRandom(int ANZ_WORD,int ANZ_CLS,int initValue,
- int auswertung,int nachbarschaft,float relInit)
-{
- KategProblem &k=
- *new KategProblem(ANZ_WORD,ANZ_CLS,initValue,auswertung,nachbarschaft);
- KategProblemWBC &w=k.wordFreq;
- Array<int> after(ANZ_WORD,0);
- Array<int> before(ANZ_WORD,0);
- Array<FreqArray> twoD(ANZ_WORD);
- int i;
- for(i=0;i<ANZ_WORD;i++) twoD[i].init(ANZ_WORD,0);
-
- for(i=0;i<ANZ_WORD;i++)
- {
- massert(after[i]==0);
- massert(before[i]==0);
- for(int j=0;j<ANZ_WORD;j++)
- {
- massert(twoD[i][j]==0);
- }
- }
- for(i=0;i<ANZ_WORD*ANZ_WORD*relInit;i++)
- {
- int x=randomInt(ANZ_WORD);
- int y=randomInt(ANZ_WORD);
- if(twoD[x][y]==0)
- {
- after[x]++;
- before[y]++;
- }
- twoD[x][y]+=randomInt(10)+1;
- }
- for(i=0;i<ANZ_WORD;i++)
- {
- w.setAfterWords(i,after[i]);
- w.setBeforeWords(i,before[i]);
- }
-
- for(i=0;i<ANZ_WORD;i++)
- {
- for(int j=0;j<ANZ_WORD;j++)
- if( twoD[i][j] )
- w.setFreq(i,j,twoD[i][j]);
- }
- w.testFull();
- return k;
-}
-
-
-
-
-char *makeTitle(KategProblem &problem,int verfahren)
-{
- char x[1024];
- switch(verfahren)
- {
- case HC_OPT:
- strcpy(x,"HC ");
- break;
- case SA_OPT:
- strcpy(x,"SA ");
- break;
- case TA_OPT:
- strcpy(x,"TA ");
- break;
- case GDA_OPT:
- strcpy(x,"GDA ");
- break;
- case RRT_OPT:
- strcpy(x,"RRT ");
- break;
- }
- problem.makeTitle(x+strlen(x));
- return strdup(x);
-}
-
-
-
-
-#define MAX_MULTIPLE 10
-
-Array<KategProblem *> &_izrOptimization(Array<KategProblem *> &probs,
-int anzprob,double timeForOneRed,double maxClock,Array<Kategory> &katOfWord,
-int anzIter,int verfahren)
-{
- massert(anzprob>1);
- massert(probs[0]->wordFreq.mindestAnzahl<=1);
- KategProblem *p0=probs[0];
-
- int nWords=p0->wordFreq.nWords;
- int nKats=p0->katFreq.nKats;
- int minimumNumberOfWords = max(1,int(nWords*0.95));
-
- int indexOfDurchschnitt;
- Array<int> newWords(nWords);
- int useAnzprob=anzprob;
- do
- {
- int w,k;
- indexOfDurchschnitt=0;
- for(w=0;w<nWords;w++)
- newWords[w]=-1;
- for(k=0;k<useAnzprob;k++)
- {
- massert(probs[k]->wordFreq.nWords==nWords);
- probs[k]->makeKats();
- }
-
- for(w=0;w<nWords;w++)
- {
- if( newWords[w]==-1 )
- {
-
-
-
- leda_set<int> durchschnitt=(*p0->kats)[p0->katOfWord(w)];
- for(k=1;k<useAnzprob;k++)
- durchschnitt = durchschnitt & (*probs[k]->kats)[probs[k]->katOfWord(w)];
-
-
- int _anzInDurchschnitt=0;
- int nr=0;
- forall_set(leda_set<int>,nr,durchschnitt)
- {
- _anzInDurchschnitt++;
- newWords[nr]=indexOfDurchschnitt;
- }
- if( verboseMode && _anzInDurchschnitt>1 && anzIter==0 )
- {
- cout << "- (";
- forall_set(leda_set<int>,nr,durchschnitt)
- {
- cout << p0->getString(nr);
- if( p0->wordFreq.n1(nr)==1 )
- cout << "* ";
- else
- cout << " ";
- }
- cout << ")\n";
- }
-
-
-
-
- for(k=0;k<useAnzprob;k++)
- {
- durchschnitt = durchschnitt - (*probs[k]->kats)[probs[k]->katOfWord(w)];
- }
- indexOfDurchschnitt++;
- }
- }
-
- if(indexOfDurchschnitt>=minimumNumberOfWords)
- {
- if(useAnzprob==1)
- {
- cout << "useAnzProb==1 => mysterious.\n";
- break;
- }
- useAnzprob--;
- }
- }
- while(indexOfDurchschnitt>=minimumNumberOfWords);
-
-
- Array<KategProblem *> &neu=*new Array<KategProblem *>(MAX_MULTIPLE*anzprob,(KategProblem *)0);
- qsort(probs.getPointerToData(),useAnzprob,sizeof(KategProblem *),compareProblem);
- massert(useAnzprob<=probs.size());
- double startTime=clockSec();
- int i, numberOfNew;
- for(numberOfNew=0; (clockSec()-startTime<timeForOneRed)
- || (numberOfNew < anzprob) ; numberOfNew++)
- {
- int w;
- if( numberOfNew==anzprob*MAX_MULTIPLE-1 )
- break;
- KategProblem *p
- = neu[numberOfNew]
- = new KategProblem(indexOfDurchschnitt,nKats-2,
- p0->initialisierung,p0->auswertung,p0->nachbarschaft);
-
- for(w=0;w<indexOfDurchschnitt;w++)
- {
- p->wordFreq.setAfterWords(w,5);
- p->wordFreq.setBeforeWords(w,5);
- }
- for(w=0;w<nWords;w++)
- {
- Array<OneFreq> &after=p0->wordFreq.after[w];
- int size=after.size();
- for(i=0;i<size;i++)
- p->wordFreq.addFreq(newWords[w],newWords[after[i].w],after[i].n);
- }
- p->wordFreq.testFull(1);
-
-
-
-
-
-
- p->wordFreq.set_h_of_words(p0->wordFreq.get_h_of_words());
- double w1=0.0,w2=0.0;
- if(numberOfNew<useAnzprob)
- {
-
- for(i=0;i<nWords;i++)
- (p->initLike)[newWords[i]]=probs[numberOfNew]->katOfWord(i);
- p->_initialize(5);
- HCOptimization hc(*p,-1);
- if(verboseMode)
- {
- w1=p->nicevalue();
- cout << "from old category system:" << w1 << endl;
- }
- hc.minimize(-1);
- if(verboseMode)
- {
- w2=p->nicevalue();
- if(w2<w1)
- cout << "improvement: " << w1-w2 << endl;
- }
- }
- else
- {
- p->_initialize(1);
- double mean;
- StatVar end,laufzeit,start;
- solveProblem(0,*p,1,-1,verfahren,mean,end,laufzeit,start);
- w2=p->value();
- if(verboseMode)
- cout << "new category system: " << w2 << " (" << p->nicevalue()
- << ") Zeit: " << clockSec() << "\n";
- }
- }
- int p;
- for(p=0;p<probs.size();p++)
- {
- if( probs[p] )
- delete probs[p];
- }
- qsort(neu.getPointerToData(),numberOfNew,sizeof(Problem *),compareProblem);
- massert(numberOfNew<=neu.size());
- if( verboseMode )
- cout << "Iterierte Zustandsraum-Reduktion: " << indexOfDurchschnitt
- << " words. costs: " << neu[0]->value() << " "
- << neu[0]->nicevalue() << " (" << numberOfNew-anzprob << ")" << "time: "
- << clockSec() << endl;
- if( indexOfDurchschnitt<=nKats
- || (clockSec()>maxClock&&maxClock) )
- {
- if( clockSec()>maxClock&&maxClock )
- cout << "STOP (time limit: " << (clockSec()-maxClock) << " s)\n";
- for(i=0;i<nWords;i++)
- katOfWord[i]=neu[0]->katOfWord(newWords[i]);
- return neu;
- }
- else
- {
- Array<Kategory> &newKatOfWord=
- *(new Array<Kategory>(neu[0]->wordFreq.nWords,-1));
- Array<KategProblem *> &erg=_izrOptimization(neu,anzprob,timeForOneRed,
- maxClock,newKatOfWord,
- anzIter+1,verfahren);
- for(i=0;i<nWords;i++)
- katOfWord[i]=newKatOfWord[newWords[i]];
- return erg;
- }
-}
-
-
-
-
-KategProblem *izrOptimization(KategProblem &p,int minN,int firstN,
- double clockForOneRed,double maxClock,int verfahren)
-{
- Array<Kategory> katOfWord(p.wordFreq.nWords,-1);
- int startN;
- if( clockForOneRed<=0 )
- startN=firstN;
- else
- startN=1000;
- Array<KategProblem *> probs(startN);
- double val1=0.0,val2=0.0;
- double endTime=-1;
-
- double startTime=clockSec();
- int i;
- for(i=0;i<startN;i++)
- {
- StatVar end,laufzeit,start;
- double mean;
- probs[i] = (KategProblem *)((KategProblem *)p.makeEqualProblem());
- solveProblem(0,*(probs[i]),1,-1,verfahren,mean,end,laufzeit,start);
- if( i==minN-1 )
- endTime = clockSec();
- if( i>=firstN-1 && (startTime+clockForOneRed>clockSec() || i==999) )
- break;
- }
- if( endTime<0 )
- endTime=clockSec();
- massert(i>=firstN);
-
- qsort(probs.getPointerToData(),i,sizeof(KategProblem *),compareProblem);
- massert(i<=probs.size());
- if( clockForOneRed<=0 )
- {
- clockForOneRed=endTime-startTime;
- if( verboseMode )
- cout << "time for one reduction: " << clockForOneRed << endl;
- }
- _izrOptimization(probs,minN,clockForOneRed,maxClock,katOfWord,0,verfahren);
-
- KategProblem *n=(KategProblem *)(p.makeEqualProblem());
- n->initLike= katOfWord;
- n->_initialize(5);
- if( verboseMode )
- val1=n->value();
- HCOptimization hc(*n,-1);
- hc.minimize(-1);
- val2=n->value();
- if( verboseMode )
- cout << "last improvement: " << val2-val1 << "\n";
- cout << "final costs: " << val2 << " " << n->nicevalue() << endl;
- if(PrintBestTo)
- n->dumpOn(*PrintBestTo);
- return n;
-}
-
-
-
-
-
-
-
-
-
-
-
http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/ef91969a/ext/giza-pp/mkcls-v2/KategProblemTest.h
----------------------------------------------------------------------
diff --git a/ext/giza-pp/mkcls-v2/KategProblemTest.h b/ext/giza-pp/mkcls-v2/KategProblemTest.h
deleted file mode 100644
index 7767b7d..0000000
--- a/ext/giza-pp/mkcls-v2/KategProblemTest.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
-
-Copyright (C) 1997,1998,1999,2000,2001 Franz Josef Och
-
-mkcls - a program for making word classes .
-
-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 2
-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, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-USA.
-
-*/
-
-
-
-
-
-
-
-#include "KategProblem.h"
-
-
-KategProblem &makRandom(int ANZ_WORD,int ANZ_CLS,int initialisierung,
- int auswertung,int nachbarschaft,float relInit=0.1);
-
-
-
-KategProblem *fromKModel(const char *str,int maxClass,int initialisierung,
- int auswertung,int nachbarschaft,int minWordFrequency);
-
-
-KategProblem *fromNgrFile(const char *str,int maxClass,int initialisierung,
- int auswertung,int nachbarschaft,int minWordFrequency);
-
-void writeClasses(Array<Kategory> &katOfWord,KategProblem &problem,ostream &to);
-
-
-
-int fromCatFile(KategProblem *p,const char *s,bool verb=1);
-
-
-
-KategProblem *izrOptimization(KategProblem &p,int minN,int firstN,
-double clockForOneRed,double maxClock,int verfahren);
-
-
-
-void KategProblemSetParameters(KategProblem &p);
-
-
http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/ef91969a/ext/giza-pp/mkcls-v2/KategProblemWBC.cpp
----------------------------------------------------------------------
diff --git a/ext/giza-pp/mkcls-v2/KategProblemWBC.cpp b/ext/giza-pp/mkcls-v2/KategProblemWBC.cpp
deleted file mode 100644
index 1a0d439..0000000
--- a/ext/giza-pp/mkcls-v2/KategProblemWBC.cpp
+++ /dev/null
@@ -1,344 +0,0 @@
-/*
-
-Copyright (C) 1997,1998,1999,2000,2001 Franz Josef Och
-
-mkcls - a program for making word classes .
-
-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 2
-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, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-USA.
-
-*/
-
-
-
-
-#include <stdlib.h>
-#include "KategProblem.h"
-
-static int oneFreqCompareSteigend(const void *p,const void *j)
-{
-#ifdef FREQTYPE_DOUBLE
- if( (((OneFreq *)p)->n < ((OneFreq *)j)->n) )
- return -1;
- if( (((OneFreq *)p)->n > ((OneFreq *)j)->n) )
- return +1;
- else
- return 0;
-#else
- return ((OneFreq *)p)->n - ((OneFreq *)j)->n;
-#endif
-}
-static int oneFreqCompareFallend(const void *p,const void *j)
-{
-#ifdef FREQTYPE_DOUBLE
- if( (((OneFreq *)p)->n > ((OneFreq *)j)->n) )
- return -1;
- if( (((OneFreq *)p)->n < ((OneFreq *)j)->n) )
- return +1;
- else
- return 0;
-#else
- return -((OneFreq *)p)->n + ((OneFreq *)j)->n;
-#endif
-}
-
-
-KategProblemWBC::KategProblemWBC(int n,int minw)
-: _n1(n,0),_n2(n,0),with_h_of_words(0),afterFilled(n,0),beforeFilled(n,0),filled(0),fixedWord(n,-1),absteigend(0),nWords(n),nTranspWords(0),
- mindestAnzahl(minw),after(n),before(n),minIndex(n,-1),maxIndex(n,-1)
-
-{
-}
-
-KategProblemWBC::~KategProblemWBC()
-
-{
- massert( after.size()==nWords);
- if( absteigend )
- delete absteigend;
-}
-
-void KategProblemWBC::init(int specialFixedWord)
-{
-
- nTranspWords=0;
- int i;
- for(i=0;i<_n1.size();i++)
- {
- if( (_n1[i]<mindestAnzahl && _n2[i]<mindestAnzahl && minIndex[i]<=1) ||i==specialFixedWord )
- {
-
- if(!( fixedWord[i]==1 || fixedWord[i]== -1))
- cerr << "mkcls:KategProblemWBC::init::ERROR: " << i << " " << fixedWord[i] << endl;
- fixedWord[i]=1;
- }
- else if(fixedWord[i]<0)
- nTranspWords++;
- }
- if( absteigend==0 )
- absteigend= &(getSortedList(0));
-
-
-
-
-
- if(verboseMode && nTranspWords!=_n1.size()-1 )
- cout << "Es sind: " <<nTranspWords<<" transportierbar.\n";
-}
-
-void KategProblemWBC::set_h_of_words(double s)
-
-{
- with_h_of_words=1;
- h_of_words = -s;
-}
-
-double KategProblemWBC::get_h_of_words()
-
-{
- if( with_h_of_words )
- return -h_of_words;
- else
- {
- h_of_words=0;
- for(int i=0;i<nWords;i++)
- h_of_words+=0.5*(kat_h(_n2[i])+kat_h(_n1[i]));
- with_h_of_words=1;
- return -h_of_words;
- }
-}
-
-
-void KategProblemWBC::setAfterWords(int w,int anzahl)
-
-{
- OneFreq o;
- o.w=-1;
- o.n=0;
- afterFilled[w]=0;
- after[w].init(anzahl,o,1);
-}
-void KategProblemWBC::setBeforeWords(int w,int anzahl)
-
-{
- OneFreq o;
- o.w=-1;
- o.n=0;
- beforeFilled[w]=0;
- before[w].init(anzahl,o,1);
-}
-
-
-void KategProblemWBC::setFreq(int w1,int w2,FreqType anzahl)
-
-{
- OneFreq o;
- o.n=anzahl;
-
- o.w=w2;
- after[w1][afterFilled[w1]++]=o;
- _n1[w1]+=anzahl;
- o.w=w1;
- before[w2][beforeFilled[w2]++]=o;
- _n2[w2]+=anzahl;
-}
-
-void KategProblemWBC::addFreq(int w1,int w2,FreqType anzahl)
-
-{
- OneFreq o;
- o.n=anzahl;
- int pos=-1,i;
- for(i=0;i<afterFilled[w1];i++)
- if(after[w1][i].w==w2)
- pos=i;
-
- if(pos==-1)
- {
- o.w=w2;
- after[w1][afterFilled[w1]++]=o;
- }
- else
- after[w1][pos].n+=anzahl;
- _n1[w1]+=anzahl;
-
- pos=-1;
- for(i=0;i<beforeFilled[w2];i++)
- if(before[w2][i].w==w1)
- pos=i;
- if(pos==-1)
- {
- o.w=w1;
- before[w2][beforeFilled[w2]++]=o;
- }
- else
- before[w2][pos].n+=anzahl;
- _n2[w2]+=anzahl;
-}
-
-
-short KategProblemWBC::testFull(int doIt)
-
-{
- int enaNom=0;
- int afterFilledSum=0,beforeFilledSum=0;
- int ret=1,i;
- for(i=0;i<nWords;i++)
- {
- if( n1(i)==1 && n2(i)==1 )
- enaNom++;
- afterFilledSum+=afterFilled[i];
- beforeFilledSum+=beforeFilled[i];
- if(afterFilled[i]!=after[i].size())
- {
- ret=0;
- if( doIt )
- after[i].resize(afterFilled[i]);
- }
- if(beforeFilled[i]!=before[i].size())
- {
- ret=0;
- if( doIt )
- before[i].resize(beforeFilled[i]);
- }
-
- }
- if( ret==0 && !doIt )
- {
- cerr << "Error: Unfilled word bigram statistics.\n";
- exit(1);
- }
- else
- filled=1;
- if( verboseMode>1 )
- {
- cout << "MEAN(|L(w)|+|R(w)|)=" << (beforeFilledSum/(float)nWords)
- +(afterFilledSum/(float)nWords) << endl;
- cout << "Hapaslegomena: " << enaNom << endl;
- }
- int symmetrisch=1;
- for(i=0;i<nWords;i++)
- {
- int j;
- massert(before[i].size()==beforeFilled[i]);
- massert( after[i].size()== afterFilled[i]);
- FreqType sum=0;
- for(j=0;j<after[i].size();j++)
- sum+=after[i][j].n;
- massert( sum==_n1[i] );
- sum=0;
- for(j=0;j<before[i].size();j++)
- sum+=before[i][j].n;
- massert(sum==_n2[i]);
- if(_n1[i]!=_n2[i])
- {
- symmetrisch=0;
- if( verboseMode>1 )
- cout << "Asymmetrie: " << i << " " << _n1[i] << " " << _n2[i] << endl;
- }
-
- }
- if(verboseMode && symmetrisch==0)
- cout << "Warning: word bigram statistic is not symmetric "
- "(this is possibly an error)\n";
- return ret;
-}
-
-Array<Word> &KategProblemWBC::getSortedList(int steigend)
-
-{
- int siz=_n2.size(),i;
- massert(filled);
- Array<Word> &sortedList =*new Array<Word>(siz);
- Array<OneFreq> list(siz);
- int pos=0;
- for(i=0;i<siz;i++)
- {
- if( fixedWord[i]<0 )
- {
- list[pos].w=i;
- list[pos].n=_n1[i];
- pos++;
- }
- }
- int anzFree=pos;
- for(i=0;i<siz;i++)
- {
- if( fixedWord[i]>=0 )
- {
- list[pos].w=i;
- list[pos].n=_n1[i];
- pos++;
- }
- }
- massert(pos==siz);
- if(steigend )
- qsort(list.getPointerToData(),anzFree,sizeof(OneFreq),oneFreqCompareSteigend);
- else
- qsort(list.getPointerToData(),anzFree,sizeof(OneFreq),oneFreqCompareFallend);
- massert( anzFree<=list.size() );
-
- for(i=0;i<siz;i++)
- {
- sortedList[i]=list[i].w;
- massert(steigend || i==0 || i>=anzFree || list[i-1].n>=list[i].n );
- massert((!steigend) || i==0 || i>=anzFree || list[i-1].n<=list[i].n );
- }
- return sortedList;
-}
-
-FreqType KategProblemWBC::numberOfWords()
-
-{
- FreqType n1=0,n2=0;
- for(int i=0;i<_n1.size();i++)
- {
- n1+=_n1[i];
- n2+=_n2[i];
- }
- #ifndef FREQTYPE_DOUBLE
- massert(n1==n2);
- #endif
- return n1;
-}
-
-void KategProblemWBC::setDollar(int n)
-
-{
- if( fixedWord[n]<0 )
- nTranspWords--;
- fixedWord[n]=0;
-}
-
-void KategProblemWBC::initializeIndex(const leda_array<string>&words,char firstChar,int unten,int oben,bool noHapas)
-{
- int n=0;
- int i;
- massert(-1<unten);massert(unten<oben);
- if( verboseMode )
- cout << "InitializeIndex: " << firstChar << " u:" << unten << " o:" << oben << " " << noHapas << endl;
- over_array(words,i)
- {
- if( words[i][0]==firstChar && (noHapas || ((short)(n1(i)+0.0001))>=mindestAnzahl || ((short)(n2(i)+0.0001))>=mindestAnzahl) )
- {
- minIndex[i]=unten;
- maxIndex[i]=oben;
- n++;
- }
- }
- if( verboseMode )
- cout << "InitializeIndex gefunden fuer " << n << " Woerter.\n";
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/ef91969a/ext/giza-pp/mkcls-v2/KategProblemWBC.h
----------------------------------------------------------------------
diff --git a/ext/giza-pp/mkcls-v2/KategProblemWBC.h b/ext/giza-pp/mkcls-v2/KategProblemWBC.h
deleted file mode 100644
index 8a399e5..0000000
--- a/ext/giza-pp/mkcls-v2/KategProblemWBC.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
-
-Copyright (C) 1997,1998,1999,2000,2001 Franz Josef Och
-
-mkcls - a program for making word classes .
-
-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 2
-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, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-USA.
-
-*/
-
-
-
-
-
-
-
-#ifndef KATEGPROBLEMWBC_H
-#define KATEGPROBLEMWBC_H
-
-struct OneFreq
-{
- int w;
- FreqType n;
-};
-
-typedef Array<OneFreq> ManyFreq;
-
-class KategProblemWBC
-
-{
-
- friend class KategProblem;
-
- private:
- Array<FreqType> _n1;
-
- Array<FreqType> _n2;
-
-
- double h_of_words;
-
-
- short with_h_of_words;
-
- Array<int> afterFilled;
- Array<int> beforeFilled;
-
- Array<int> &getSortedList(int steigend);
-
-
- protected:
- KategProblemWBC(int n,int minw);
-
-
- ~KategProblemWBC();
-
-
- short filled;
-
- Array<int> fixedWord;
- Array<int> *absteigend;
-
- void init(int specialFixedWord=-1);
-
-
- public:
- int nWords;
- int nTranspWords;
- short mindestAnzahl;
- Array<ManyFreq> after;
- Array<ManyFreq> before;
- Array<int> minIndex;
- Array<int> maxIndex;
-
-
-
- void setAfterWords(int w,int anzahl);
-
-
- void setBeforeWords(int w,int anzahl);
-
-
- void setFreq(int w1,int w2, FreqType anzahl);
-
-
- void addFreq(int w1,int w2,FreqType anzahl);
-
-
- void setDollar(int n);
-
-
- int fixed(int w)
- {
- return fixedWord[w];
- }
-
- FreqType n1(int w) { return _n1[w];};
-
-
- FreqType n2(int w) { return _n2[w];};
-
-
- FreqType numberOfWords();
-
-
- short testFull(int doIt=0);
-
-
- double get_h_of_words();
-
-
- void set_h_of_words(double s);
-
-
- void initializeIndex(const leda_array<string>&words,char firstChar,int min,int max,bool noHapas);
-};
-
-#endif
http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/ef91969a/ext/giza-pp/mkcls-v2/LICENSE
----------------------------------------------------------------------
diff --git a/ext/giza-pp/mkcls-v2/LICENSE b/ext/giza-pp/mkcls-v2/LICENSE
deleted file mode 100644
index 5b2225e..0000000
--- a/ext/giza-pp/mkcls-v2/LICENSE
+++ /dev/null
@@ -1,282 +0,0 @@
-
-
-Preamble
-
-The licenses for most software are designed to take away your freedom
-to share and change it. By contrast, the GNU General Public License is
-intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
-When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
-To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the
-rights. These restrictions translate to certain responsibilities for
-you if you distribute copies of the software, or if you modify it.
-
-For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
-We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
-Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on,
-we want its recipients to know that what they have is not the
-original, so that any problems introduced by others will not reflect
-on the original authors' reputations.
-
-Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at
-all.
-
-The precise terms and conditions for copying, distribution and
-modification follow.
-
-
-TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-0. This License applies to any program or other work which contains a
-notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the Program
-(independent of having been made by running the Program). Whether that
-is true depends on what the Program does.
-
-1. You may copy and distribute verbatim copies of the Program's source
-code as you receive it, in any medium, provided that you conspicuously
-and appropriately publish on each copy an appropriate copyright notice
-and disclaimer of warranty; keep intact all the notices that refer to
-this License and to the absence of any warranty; and give any other
-recipients of the Program a copy of this License along with the
-Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a
-fee.
-
-2. You may modify your copy or copies of the Program or any portion of
-it, thus forming a work based on the Program, and copy and distribute
-such modifications or work under the terms of Section 1 above,
-provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that
- in whole or in part contains or is derived from the Program or
- any part thereof, to be licensed as a whole at no charge to all
- third parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you
- provide a warranty) and that users may redistribute the program
- under these conditions, and telling the user how to view a copy
- of this License. (Exception: if the Program itself is interactive
- but does not normally print such an announcement, your work based
- on the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
-3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of
- Sections 1 and 2 above on a medium customarily used for software
- interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt otherwise
-to copy, modify, sublicense or distribute the Program is void, and
-will automatically terminate your rights under this License. However,
-parties who have received copies, or rights, from you under this
-License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
-5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
-6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted
-herein. You are not responsible for enforcing compliance by third
-parties to this License.
-
-
-7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
-9. The Free Software Foundation may publish revised and/or new
-versions of the General Public License from time to time. Such new
-versions will be similar in spirit to the present version, but may
-differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation. If the Program does not specify a
-version number of this License, you may choose any version ever
-published by the Free Software Foundation.
-
-10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the
-author to ask for permission. For software which is copyrighted by the
-Free Software Foundation, write to the Free Software Foundation; we
-sometimes make exceptions for this. Our decision will be guided by the
-two goals of preserving the free status of all derivatives of our free
-software and of promoting the sharing and reuse of software generally.
-
-NO WARRANTY
-
-11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE
-LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS
-AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF
-ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-
-12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
-END OF TERMS AND CONDITIONS
http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/ef91969a/ext/giza-pp/mkcls-v2/MSBOptimization.cpp
----------------------------------------------------------------------
diff --git a/ext/giza-pp/mkcls-v2/MSBOptimization.cpp b/ext/giza-pp/mkcls-v2/MSBOptimization.cpp
deleted file mode 100644
index 9478826..0000000
--- a/ext/giza-pp/mkcls-v2/MSBOptimization.cpp
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
-
-Copyright (C) 1997,1998,1999,2000,2001 Franz Josef Och
-
-mkcls - a program for making word classes .
-
-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 2
-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, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-USA.
-
-*/
-
-
-
-
-#include "MSBOptimization.h"
-#include <stdlib.h>
-#include "ProblemTest.h"
-
-#ifdef __GNUC__
-template class Array<double>;
-template class Array<ProbAndOpt>;
-#endif
-
-struct doubleInt { double a; int i; };
-static int doubleintcompare(const void *p,const void *j)
-{
- if(((struct doubleInt *)p)->a < ((doubleInt *)j)->a)
- return -1;
- else if(((struct doubleInt *)p)->a == ((doubleInt *)j)->a)
- return 0;
- else
- return 1;
-}
-
-
-MSBOptimization::MSBOptimization(Problem &p,int verf,int anz,Array<double> &pos,Array<double> &por)
-: PopOptimization(p,verf,anz),
-percentOfSteps(pos),percentOfRun(por),nachMinimierung(0)
-{
-}
-
-
-void MSBOptimization::zInitialize()
-{
- PopOptimization::zInitialize();
-
- int iterationsschritte;
- double mean;
- StatVar end,laufzeit,start;
- zufallSeed();
-
-
-
-
- solveProblem(ProblemTestVerboseMode,*originalProblem,2,-1,verfahren,mean,
- end,laufzeit,start,0,&iterationsschritte);
- expectedSteps=(int)(iterationsschritte);
-
- if(verboseMode)
- cout << "MSB:mean number of steps for one run: " << expectedSteps << endl;
-}
-
-
-double MSBOptimization::minimize(int)
-{
- if( initialisiert==0 )
- zInitialize();
-
- int i;
- int anz=size();
- int numproblems=anz;
-
- if( verboseMode )
- {
- double usedSteps=0;
- for(i=0;i<percentOfSteps.size();i++)
- {
- usedSteps+=expectedSteps*(percentOfSteps[i]-
- (i==0?0:percentOfSteps[i-1]))*numproblems;
- numproblems=(int)(ceil(anz*(1.0-percentOfRun[i])));
- if( numproblems<1 )numproblems=1;
- }
- usedSteps+=expectedSteps*
- (1.0-percentOfSteps[percentOfSteps.size()-1])*numproblems;
- cout << "MSB: speed factor: "
- << (double)usedSteps/(expectedSteps*size()) << endl;
- numproblems=anz=size();
- }
-
- for(i=0;i<percentOfSteps.size();i++)
- {
-
- int steps=(int)(expectedSteps*(percentOfSteps[i]-
- (i==0?0:percentOfSteps[i-1])));
-
-
- for(int a=0;a<numproblems;a++)
- {
-
- double v;
- v= optimization(a)->minimize(steps);
- if(verboseMode)cout << "MSB:" << i << " " << a << ":" << v << endl;
- }
-
- sort();
-
- if(verboseMode)
- cout << "MSB: best:" << problem(0)->value()
- << " worst:" << problem(numproblems-1)->value() << endl;
-
-
- numproblems=(int)(anz*(1.0-percentOfRun[i]));
- if( numproblems<1 )
- numproblems=1;
- if(verboseMode)
- cout << "MSB: now i have : " << numproblems << " Problem's." << endl;
- if(numproblems==1)
- break;
- }
- assert( numproblems>0 );
-
-
- for(int a=0;a<numproblems;a++)
- optimization(a)->minimize(-1);
- sort();
-
- double ergebnisWert = problem(0)->value();
- cout << "MSB: value:" << ergebnisWert << " (nicevalue:"
- << problem(0)->nicevalue() << ")\n";
- nachMinimierung=1;
- return ergebnisWert;
-}
-
-
-
-void MSBOptimization::optimizeValues(Problem &p,int verfahren)
-{
- int i;
- struct doubleInt ri[20];
- double mean;
- StatVar end,laufzeit,start;
- solveProblem(ProblemTestVerboseMode,p,5,-1,verfahren,mean,end,laufzeit,start);
- double fivePercentSteps=(int)(laufzeit.getMean()/20.0);
- double qualitaet[20][20];
- for(i=0;i<20;i++)
- {
- Optimization *o=(Optimization *)genIterOptimizer(verfahren,p,-1);
- for(int a=0;a<20;a++)
- {
- qualitaet[i][a]=o->minimize((int)fivePercentSteps);
- cout << qualitaet[i][a] << " ";
- }
- ri[i].a=o->minimize(-1);
- ri[i].i=i;
- cout << ri[i].a << endl;
- delete o;
- }
- qsort(ri,20,sizeof(struct doubleInt),doubleintcompare);
-
- cout << "#Beschneidungsmatrix, welche die drei besten Laeufe erhaelt: ";
- for(i=0;i<20;i++)
- {
- int a;
- struct doubleInt v[20];
- for(a=0;a<20;a++)
- { v[a].i=a;v[a].a=qualitaet[a][i];}
- qsort(v,20,sizeof(struct doubleInt),doubleintcompare);
- int nr=0;
- for(a=0;a<20;a++)
- if( v[a].i==ri[0].i || v[a].i==ri[1].i || v[a].i==ri[2].i )
- nr=a;
- float percent=(1.0-nr/20.0)*100.0;
- if(nr==2)
- percent=100.0;
- cout << "# " << i << " " << (i/20.0)*100 << "% " << percent << "%\n";
- }
- cout << "#Beschneidungsmatrix, welche die zwei besten Laeufe erhaelt: ";
- for(i=0;i<20;i++)
- {
- int a;
- struct doubleInt v[20];
- for(a=0;a<20;a++)
- { v[a].i=a;v[a].a=qualitaet[a][i];}
- qsort(v,20,sizeof(struct doubleInt),doubleintcompare);
- int nr=0;
- for(a=0;a<20;a++)
- if( v[a].i==ri[0].i || v[a].i==ri[1].i )
- nr=a;
- float percent=(1.0-nr/20.0)*100.0;
- if(nr==1)
- percent=100.0;
- cout << "# " << i << " " << (i/20.0)*100 << "% " << percent << "%\n";
- }
- cout << "#Beschneidungsmatrix, welche den besten Lauf erhaelt: ";
- for(i=0;i<20;i++)
- {int a;
- struct doubleInt v[20];
- for(a=0;a<20;a++)
- { v[a].i=a;v[a].a=qualitaet[a][i];}
- qsort(v,20,sizeof(struct doubleInt),doubleintcompare);
- int nr=0;
- for(a=0;a<20;a++)
- if( v[a].i==ri[0].i )
- nr=a;
- float percent=(1.0-nr/20.0)*100.0;
- if(nr==0)
- percent=100.0;
- cout << "# " << i << " " << (i/20.0)*100 << "% " << percent << "%\n";
- }
-}
-
-
-Problem& MSBOptimization::bestProblem()
-{
- assert(nachMinimierung==1);
- return *(problem(0));
-}
http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/ef91969a/ext/giza-pp/mkcls-v2/MSBOptimization.h
----------------------------------------------------------------------
diff --git a/ext/giza-pp/mkcls-v2/MSBOptimization.h b/ext/giza-pp/mkcls-v2/MSBOptimization.h
deleted file mode 100644
index ab30c98..0000000
--- a/ext/giza-pp/mkcls-v2/MSBOptimization.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
-
-Copyright (C) 1997,1998,1999,2000,2001 Franz Josef Och
-
-mkcls - a program for making word classes .
-
-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 2
-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, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-USA.
-
-*/
-
-
-
-
-
-
-
-#ifndef MSBOPTIMIZATION
-#define MSBOPTIMIZATION
-
-#include "PopOptimization.h"
-
-class MSBOptimization : public PopOptimization
- {
-
- protected:
-
- Array<double> percentOfSteps;
- Array<double> percentOfRun;
-
- int expectedSteps;
- short nachMinimierung;
-
- virtual void zInitialize();
-
-
- public:
- MSBOptimization(Problem &s,int verf,int anz,Array<double> &pos,
- Array<double> &por);
-
-
- virtual ~MSBOptimization(){}
-
- virtual double minimize(int steps=-1);
-
-
- static void optimizeValues(Problem &p,int verfahren);
-
-
- Problem& bestProblem();
-
-
-};
-#endif
-
-
-
-
-
-
-
-
-
-
-
http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/ef91969a/ext/giza-pp/mkcls-v2/MYOptimization.cpp
----------------------------------------------------------------------
diff --git a/ext/giza-pp/mkcls-v2/MYOptimization.cpp b/ext/giza-pp/mkcls-v2/MYOptimization.cpp
deleted file mode 100644
index ced9d31..0000000
--- a/ext/giza-pp/mkcls-v2/MYOptimization.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
-
-Copyright (C) 1997,1998,1999,2000,2001 Franz Josef Och
-
-mkcls - a program for making word classes .
-
-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 2
-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, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-USA.
-
-*/
-
-
-
-
-#include "MYOptimization.h"
-
-MYOptimization::MYOptimization(Problem &p,int m)
-: IterOptimization(p,m),acceptFlagsNumber(0),acceptions(0),total(0)
-{
-}
-MYOptimization::MYOptimization(MYOptimization &o)
-: IterOptimization(o),acceptFlagsNumber(0),acceptions(0),total(0)
-{
-}
-short MYOptimization::accept(double delta)
- {
- int doIt;
- int verbesserung = delta<0;
- if( delta < 0 )
- doIt=1;
- else
- {
- if(total>=NUMBER_OF_ACCEPTIONS)
- {
- double prob = acceptions/(float)(NUMBER_OF_ACCEPTIONS);
- double zuf = zufall01();
-
- doIt=zuf<prob;
- }
- else
- doIt=0;
- }
- if( total>=NUMBER_OF_ACCEPTIONS )
- {
- if( acceptFlags[acceptFlagsNumber] )
- acceptions--;
- }
- acceptFlags[acceptFlagsNumber]=verbesserung;
- if( verbesserung )
- acceptions++;
- total++;
- acceptFlagsNumber++;
- if(acceptFlagsNumber>=NUMBER_OF_ACCEPTIONS)
- acceptFlagsNumber=0;
- return doIt;
- }
-
-short MYOptimization::end()
- {
- return endFlag>0 && total>NUMBER_OF_ACCEPTIONS && acceptions==0;
- }
-void MYOptimization::abkuehlen()
- {
- }
-
-
-
-void MYOptimization::makeGraphOutput()
-{
- IterOptimization::makeGraphOutput();
- *GraphOutput << acceptions;
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/ef91969a/ext/giza-pp/mkcls-v2/MYOptimization.h
----------------------------------------------------------------------
diff --git a/ext/giza-pp/mkcls-v2/MYOptimization.h b/ext/giza-pp/mkcls-v2/MYOptimization.h
deleted file mode 100644
index a6ca70c..0000000
--- a/ext/giza-pp/mkcls-v2/MYOptimization.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
-
-Copyright (C) 1997,1998,1999,2000,2001 Franz Josef Och
-
-mkcls - a program for making word classes .
-
-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 2
-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, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-USA.
-
-*/
-
-
-
-
-
-
-#ifndef MYOPTIMIZATION
-#define MYOPTIMIZATION
-#include "IterOptimization.h"
-
-#define NUMBER_OF_ACCEPTIONS 100
-
-class MYOptimization: public IterOptimization {
-
- protected:
- virtual short accept(double delta);
-
-
- virtual void abkuehlen();
-
-
- virtual short end();
-
-
- public:
- MYOptimization(Problem &p,int maxIter=-1);
-
-
- MYOptimization(MYOptimization &o);
-
-
- int acceptFlags[NUMBER_OF_ACCEPTIONS],acceptFlagsNumber;
- int acceptions,total;
-
- void makeGraphOutput();
-
-};
-
-#endif
http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/ef91969a/ext/giza-pp/mkcls-v2/Makefile
----------------------------------------------------------------------
diff --git a/ext/giza-pp/mkcls-v2/Makefile b/ext/giza-pp/mkcls-v2/Makefile
deleted file mode 100644
index cec1673..0000000
--- a/ext/giza-pp/mkcls-v2/Makefile
+++ /dev/null
@@ -1,23 +0,0 @@
-OBJS = GDAOptimization.o HCOptimization.o Problem.o \
- IterOptimization.o ProblemTest.o RRTOptimization.o \
- MYOptimization.o SAOptimization.o TAOptimization.o \
- Optimization.o KategProblemTest.o KategProblemKBC.o \
- KategProblemWBC.o KategProblem.o StatVar.o general.o \
- mkcls.o
-
-CFLAGS = $(CFLAGS_GLOBAL) -Wall -W -DNDEBUG -O3 -funroll-loops -std=c++11
-
-.cpp.o:
- $(CXX) $(CFLAGS) -c $< -o $@
-
-LDFLAGS =
-
-mkcls: $(OBJS)
- $(CXX) $(CFLAGS) -o mkcls $(OBJS) $(LDFLAGS)
-
-remove clean:
- -rm -f *.o mkcls
-
-
-
-
http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/ef91969a/ext/giza-pp/mkcls-v2/Optimization.cpp
----------------------------------------------------------------------
diff --git a/ext/giza-pp/mkcls-v2/Optimization.cpp b/ext/giza-pp/mkcls-v2/Optimization.cpp
deleted file mode 100644
index 03e06df..0000000
--- a/ext/giza-pp/mkcls-v2/Optimization.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
-
-Copyright (C) 1997,1998,1999,2000,2001 Franz Josef Och
-
-mkcls - a program for making word classes .
-
-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 2
-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, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-USA.
-
-*/
-
-
-
-
-#include "Optimization.h"
-
-Optimization::~Optimization() {}
-
http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/ef91969a/ext/giza-pp/mkcls-v2/Optimization.h
----------------------------------------------------------------------
diff --git a/ext/giza-pp/mkcls-v2/Optimization.h b/ext/giza-pp/mkcls-v2/Optimization.h
deleted file mode 100644
index 4c43427..0000000
--- a/ext/giza-pp/mkcls-v2/Optimization.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-
-Copyright (C) 1997,1998,1999,2000,2001 Franz Josef Och
-
-mkcls - a program for making word classes .
-
-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 2
-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, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-USA.
-
-*/
-
-
-
-
-
-
-
-#ifndef OPTIMIZATION
-#define OPTIMIZATION
-
-#include "Problem.h"
-#include "general.h"
-
-class Optimization
-{
-
-public:
-
- virtual double minimize(int steps)=0;
- virtual ~Optimization();
-
-};
-#endif
-
-
-
-
http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/ef91969a/ext/giza-pp/mkcls-v2/PopOptimization.cpp
----------------------------------------------------------------------
diff --git a/ext/giza-pp/mkcls-v2/PopOptimization.cpp b/ext/giza-pp/mkcls-v2/PopOptimization.cpp
deleted file mode 100644
index 2e65a2c..0000000
--- a/ext/giza-pp/mkcls-v2/PopOptimization.cpp
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
-
-Copyright (C) 1997,1998,1999,2000,2001 Franz Josef Och
-
-mkcls - a program for making word classes .
-
-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 2
-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, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-USA.
-
-*/
-
-
-
-
-#include "PopOptimization.h"
-#include "ProblemTest.h"
-
-
-int compareProbAndOpt(const void *p,const void *j)
-{
- double a=((ProbAndOpt *)p)->prob->value();
- double b=((ProbAndOpt *)j)->prob->value();
- if(a==b)
- return 0;
- if(a<b)
- return -1;
- else
- return +1;
-}
-bool operator<(const ProbAndOpt&a, const ProbAndOpt&b)
- {
- return a.prob->value()<b.prob->value();
- }
-bool operator==(const ProbAndOpt&a, const ProbAndOpt&b)
- {
- return a.prob->value()==b.prob->value();
- }
-
-ostream& operator<<(ostream&o , const ProbAndOpt&){return o;}
-istream& operator>>(istream&i , ProbAndOpt&){return i;}
-
-
-
-PopOptimization::PopOptimization(Problem &p,int verf,int anz)
-: probandopt(anz),initialisiert(0),verfahren(verf)
-{
- originalProblem = &p;
-}
-
-
-int PopOptimization::size()
-{
- return probandopt.size();
-}
-
-Problem *PopOptimization::problem(int i)
-{
- assert(initialisiert);
- return probandopt[i].prob;
-}
-
-Optimization *PopOptimization::optimization(int i)
-{
- assert(initialisiert);
- return probandopt[i].opt;
-}
-
-void PopOptimization::zInitialize()
-{
- int i;
- zufallSeed();
- for(i=0;i<size();i++)
- {
- probandopt[i].prob=originalProblem->makeEqualProblem();
- probandopt[i].prob->initialize();
- }
-
- zufallSeed();
- for(i=0;i<size();i++)
- probandopt[i].opt=(Optimization *)genIterOptimizer(verfahren,
- *(probandopt[i].prob),-1);
-
- initialisiert=1;
-}
-
-
-void PopOptimization::sort()
-{
- assert(initialisiert);
-
- probandopt.sort(size());
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/ef91969a/ext/giza-pp/mkcls-v2/PopOptimization.h
----------------------------------------------------------------------
diff --git a/ext/giza-pp/mkcls-v2/PopOptimization.h b/ext/giza-pp/mkcls-v2/PopOptimization.h
deleted file mode 100644
index 3ae5ff3..0000000
--- a/ext/giza-pp/mkcls-v2/PopOptimization.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
-
-Copyright (C) 1997,1998,1999,2000,2001 Franz Josef Och
-
-mkcls - a program for making word classes .
-
-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 2
-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, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-USA.
-
-*/
-
-
-
-
-
-
-
-#ifndef POPULATIONOPTIMIZATION
-#define POPULATIONOPTIMIZATION
-
-#include "Optimization.h"
-
-typedef struct
-{
- Optimization *opt;
- Problem *prob;
-} ProbAndOpt;
-
-bool operator<(const ProbAndOpt&a, const ProbAndOpt&b);
-bool operator==(const ProbAndOpt&a, const ProbAndOpt&b);
-ostream& operator<<(ostream& , const ProbAndOpt&b);
-istream& operator>>(istream& , ProbAndOpt&b);
-
-inline DEFINE_STANDARD_COMPARE(ProbAndOpt)
-
-int compareProbAndOpt(const void *p,const void *j);
-
-class PopOptimization : public Optimization {
-
-
- private:
- Array<ProbAndOpt> probandopt;
-
- protected:
- int initialisiert;
- Problem *originalProblem;
-
-
- int verfahren;
-
-
- virtual void zInitialize();
-
-
- public:
- PopOptimization(Problem &s,int verf,int anz);
-
-
- virtual ~PopOptimization() {}
-
- int size();
-
-
- void sort();
-
-
- virtual Problem& bestProblem()=0;
-
-
- Problem *problem(int i);
-
-
- Optimization *optimization(int i);
-
-
-};
-#endif
http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/ef91969a/ext/giza-pp/mkcls-v2/Problem.cpp
----------------------------------------------------------------------
diff --git a/ext/giza-pp/mkcls-v2/Problem.cpp b/ext/giza-pp/mkcls-v2/Problem.cpp
deleted file mode 100644
index 6e126c8..0000000
--- a/ext/giza-pp/mkcls-v2/Problem.cpp
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
-
-Copyright (C) 1997,1998,1999,2000,2001 Franz Josef Och
-
-mkcls - a program for making word classes .
-
-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 2
-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, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-USA.
-
-*/
-
-
-
-#include "Problem.h"
-#include "Optimization.h"
-
-Problem::~Problem() {}
-
-Problem::Problem(int max,int anz,int _initialisierung,int _auswertung,
- int _nachbarschaft)
-: initialized(0),curCompVal(0),curCompChange(0),maxCompVal(max),maxComp(anz),curComp(0),
- initialisierung(_initialisierung),auswertung(_auswertung),nachbarschaft(_nachbarschaft),
- numberOfFullEvaluations(0),numberOfPartEvaluations(0),numberOfDoChange(0)
-{
- if( verboseMode>1 )
- cout << "Initialization of Problem: " << maxComp << " " << maxCompVal
- << endl;
-}
-
-void Problem::initialize(int i)
-{
- curComp=curCompVal=curCompChange=0;
- numberOfFullEvaluations=numberOfPartEvaluations=numberOfDoChange=0;
- initialized=1;
- if( i== -23 )
- _initialize(initialisierung);
- else
- _initialize(i);
- maxComp=maxDimension();
- maxCompVal=maxDimensionVal();
-}
-
-void Problem::doChange(ProblemChange &c)
-{
- assert (initialized);
- curCompChange=1;
- _doChange(c);
- numberOfDoChange++;
-}
-
-void Problem::incrementDirection()
-{
- if( maxCompVal==curCompVal )
- curCompVal=0;
- curCompChange=0;
- curComp=(curComp+1)%maxComp;
-}
-
-ProblemChange& Problem::change()
-{
- assert( initialized );
- assert( maxCompVal>=curCompVal);
-
- if( curCompChange||maxCompVal==curCompVal )
- incrementDirection();
-
- ProblemChange *p;
- int changeFound=_change(&p);
- curCompVal++;
- if( changeFound==0 )
- return change();
- else
- return *p;
-}
-double Problem::value()
-{
- numberOfFullEvaluations++;
- if( !initialized )
- initialize();
- return _value();
-}
-
-double Problem::valueChange(ProblemChange &x)
-{
- numberOfPartEvaluations++;
- assert( initialized );
- double currentValue=value();
- _doChange(x);numberOfDoChange++;
- double newValue=value();
- _undoChange(x);numberOfDoChange++;
- assert( currentValue==value() );
- return newValue-currentValue;
-}
-
-void Problem::dumpOn(ostream &strm)
-{
- assert( initialized );
- strm << "Problem(" << initialisierung << "," << auswertung << ","
- << nachbarschaft << ")\n";
- strm << " #value: " << numberOfFullEvaluations << endl;
- strm << "#valueChange: " << numberOfPartEvaluations << endl;
- strm << " #doChange: " << numberOfDoChange << endl;
-}
-
-StatVar& Problem::deviationStatVar(Optimization &s,int anz)
-{
- assert( initialized );
- StatVar &v=*new StatVar;
- double cur=value();
- int howOften=0;
- while( v.getNum()<anz )
- {
- if( howOften++>50000 )
- break;
- double neuer=s.minimize(1);
- if( neuer>cur )
- v.addValue(neuer-cur);
- cur=neuer;
- vassert(NULLFLOAT(cur-value()));
- }
- return v;
-}
-
-void Problem::dumpInfos(ostream &strm)
-{
- strm << "Problem: " << endl;
- assert( initialized );
-}
-
-
-double Problem::nicevalue(double)
-{
- return value();
-}
-
-int Problem::maxDimensionVal(void) {return -1;}
-int Problem::maxDimension(void) {return -1;}
-
-ProblemChange::~ProblemChange()
- {
- }
-
-ProblemChange::ProblemChange()
- {
- }
-
-void Problem::setValuesFrom(Problem *p)
-{
- numberOfFullEvaluations=p->numberOfFullEvaluations;
- numberOfPartEvaluations=p->numberOfPartEvaluations;
- numberOfDoChange=p->numberOfDoChange;
- initialized=p->initialized;
-}
http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/ef91969a/ext/giza-pp/mkcls-v2/Problem.h
----------------------------------------------------------------------
diff --git a/ext/giza-pp/mkcls-v2/Problem.h b/ext/giza-pp/mkcls-v2/Problem.h
deleted file mode 100644
index 337390e..0000000
--- a/ext/giza-pp/mkcls-v2/Problem.h
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
-
-Copyright (C) 1997,1998,1999,2000,2001 Franz Josef Och
-
-mkcls - a program for making word classes .
-
-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 2
-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, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-USA.
-
-*/
-
-
-
-
-
-
-
-#ifndef PROBLEMCHANGE
-#define PROBLEMCHANGE
-#include <iostream>
-#include "general.h"
-#include "StatVar.h"
-
-class Optimization;
-
-class ProblemChange
-
-{
- public:
- virtual ~ProblemChange();
- ProblemChange();
-};
-
-class Problem {
-
- private:
- short initialized;
- int curCompVal;
- short curCompChange;
- int maxCompVal;
- int maxComp;
-
-
- protected:
- int curComp;
-
- void setValuesFrom(Problem *p);
-
- virtual int maxDimensionVal(void) ;
-
-
- virtual int maxDimension(void) ;
-
-
- inline int curDimension(void) { assert(maxComp!=-1);return curComp;}
-
-
- inline int curDimensionVal(void) { assert(maxComp!=-1);return curCompVal;}
-
-
-
- virtual void _doChange(ProblemChange &c)=0;
-
-
- virtual int _change(ProblemChange **p)=0;
-
-
- virtual void _undoChange(ProblemChange &c)=0;
-
-
- virtual void _initialize(int initialisierung)=0;
-
-
- virtual double _value()=0;
-
-
- public:
- Problem(int maxCompVal=-1,int maxComp=-1,int _initialisierung=0,
- int _auswertung=0,int _nachbarschaft=0);
-
- virtual ~Problem();
-
-
- void doChange(ProblemChange &c);
-
-
- ProblemChange& change();
-
-
- virtual double value();
-
-
- virtual double valueChange(ProblemChange &c);
-
-
- virtual void initialize(int a= -23);
-
-
- inline virtual short endCriterion();
-
-
- virtual int maxNonBetterIterations()=0;
-
-
- virtual int expectedNumberOfIterations()=0;
-
-
- virtual void dumpOn(ostream &strm);
-
-
- virtual void dumpInfos(ostream &strm);
-
-
- virtual Problem *makeEqualProblem()=0;
-
-
- virtual double nicevalue(double vorher=1e100);
-
-
- virtual StatVar& deviationStatVar(Optimization &s,int anz);
-
-
- virtual void incrementDirection();
-
-
-
-
-
- int initialisierung;
- int auswertung;
- int nachbarschaft;
-
- int numberOfFullEvaluations;
- int numberOfPartEvaluations;
- int numberOfDoChange;
-
-
-
-};
-
-inline short Problem::endCriterion()
-{
- return 0;
-};
-
-#endif
-
http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/ef91969a/ext/giza-pp/mkcls-v2/ProblemTest.cpp
----------------------------------------------------------------------
diff --git a/ext/giza-pp/mkcls-v2/ProblemTest.cpp b/ext/giza-pp/mkcls-v2/ProblemTest.cpp
deleted file mode 100644
index 60ca39d..0000000
--- a/ext/giza-pp/mkcls-v2/ProblemTest.cpp
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
-
-Copyright (C) 1997,1998,1999,2000,2001 Franz Josef Och
-
-mkcls - a program for making word classes .
-
-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 2
-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, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-USA.
-
-*/
-
-
-
-
-#include "ProblemTest.h"
-#include "HCOptimization.h"
-#include "RRTOptimization.h"
-#include "SAOptimization.h"
-#include "TAOptimization.h"
-#include "GDAOptimization.h"
-#include "MYOptimization.h"
-#include <stdio.h>
-#include "general.h"
-#include <stdlib.h>
-
-short ProblemTestVerboseMode=1;
-ofstream *PrintBestTo=0,*PrintBestTo2=0;
-
-
-int compareProblem(const void *p,const void *j)
-{
- double a=(*(Problem **)p)->value();
- double b=(*(Problem **)j)->value();
- if(a==b)
- return 0;
- if(a<b)
- return -1;
- else
- return +1;
-}
-
-
-IterOptimization *genIterOptimizer(int verfahren,Problem &problem,int maxIter)
-{
- IterOptimization *opt;
- switch(verfahren)
- {
- case HC_OPT:
- opt = new HCOptimization(problem,maxIter);
- break;
- case GDA_OPT:
- opt = new GDAOptimization(problem,maxIter);
- break;
- case SA_OPT:
- opt = new SAOptimization(problem,maxIter);
- break;
- case TA_OPT:
- opt = new TAOptimization(problem,maxIter);
- break;
- case RRT_OPT:
- opt = new RRTOptimization(problem,maxIter);
- break;
- case MY_OPT:
- opt = new MYOptimization(problem,maxIter);
- break;
- default:
- return 0;
- }
- problem.initialize();
- return opt;
-}
-
-
-double solveProblem(int verbose,Problem &problem,int versuche,
- int optimierungsschritte,int verfahren,double &mean,
- StatVar &endNice,StatVar &auswertungen,StatVar &startNice,
- double maxClock,int *iterationsschritte)
-{
- double smallestV=1e100;
- Problem *bestP=0;
- StatVar start,end;
- StatVar dauer;
- StatVar iterschritte;
-
- for(int i=0;i<versuche;i++)
- {
- if(verbose>2)
- {
- cout << " " << i << " of " << versuche << ".\n";
- cout.flush();
- }
- double vorher=clockSec();
-
- IterOptimization *opt=genIterOptimizer(verfahren,problem,
- optimierungsschritte);
- problem.numberOfPartEvaluations=0;
-
- startNice.addValue(problem.nicevalue());
- start.addValue(problem.value());
-
- double v=opt->minimize(optimierungsschritte);
-
- if( problem.numberOfPartEvaluations==0)
- auswertungen.addValue(opt->getCurStep());
- else
- auswertungen.addValue(problem.numberOfPartEvaluations);
- iterschritte.addValue(opt->getCurStep());
-
- endNice.addValue(problem.nicevalue());
- end.addValue(problem.value());
- dauer.addValue(clockSec()-vorher);
- if( verbose>2 )
- {
- cout << i << ". " << v << ": ";
- problem.dumpOn(cout);
- }
- delete opt;
- if( v<smallestV && verbose>1 )
- {
- bestP=problem.makeEqualProblem();
- smallestV=v;
- }
- if( verbose>2 )
- cout << " time: " << clockSec() << " best:" << endNice.quantil(0)
- << " this:" << problem.nicevalue() << endl;
- if( maxClock && clockSec()>maxClock )
- {
- if(verbose)
- cout << "Stop because of time limit ( " << (clockSec()-maxClock)
- << " Sekunden)\n";
- break;
- }
- }
-
- if(verbose)
- {
- cout << "\n***** " << start.getNum() << " runs. (algorithm:";
- switch(verfahren)
- {
- case HC_OPT:
- cout << "HC";
- break;
- case RRT_OPT:
- cout << "RRT";
- break;
- case GDA_OPT:
- cout << "GDA";
- break;
- case TA_OPT:
- cout << "TA";
- break;
- case SA_OPT:
- cout << "SA";
- break;
- case MY_OPT:
- cout << "MY";
- break;
- default:
- cout << "!unknown!";
- }
- cout << ")*****\n";
- problem.dumpInfos(cout);
- cout << endl;
- cout << "start-costs: "; start.dumpOn(cout); cout << endl;
- cout << " end-costs: "; end.dumpOn(cout); cout << endl;
- cout << " start-pp: "; startNice.dumpOn(cout); cout << endl;
- cout << " end-pp: "; endNice.dumpOn(cout); cout << endl;
- cout << " iterations: "; auswertungen.dumpOn(cout); cout << endl;
- cout << " time: "; dauer.dumpOn(cout);
- cout << endl;
- }
- if( bestP )
- {
- if(PrintBestTo)
- bestP->dumpOn(*PrintBestTo);
- else
- bestP->dumpOn(cout);
- delete bestP;
- }
- mean = end.getMean();
- if( iterationsschritte )
- *iterationsschritte=(int)(iterschritte.getMean());
- return end.getSmallest();
-}
-
-
-
-void multiSolveProblem(Problem &problem,int versuche,int maxSeconds)
-{
- int i;
- double rDummy;
- StatVar end[MAX_OPT_NR],auswertungen[MAX_OPT_NR],start[MAX_OPT_NR];
- double maxClock=clockSec()+maxSeconds;
- if(maxSeconds<=0)maxClock=0;
- solveProblem(ProblemTestVerboseMode,problem,versuche,-1,HC_OPT,rDummy,
- end[HC_OPT],auswertungen[HC_OPT],start[HC_OPT],maxClock);
- //int maxLaeufe=(int)(auswertungen[HC_OPT].getMean()*5);
- for(i=0;i<MAX_OPT_NR;i++)
- {
- if( i==HC_OPT )
- continue;
- double maxClock=clockSec()+maxSeconds;
- if(maxSeconds<=0)maxClock=0;
- solveProblem(ProblemTestVerboseMode,problem,versuche, -1,i,rDummy,end[i],
- auswertungen[i],start[i],maxClock);
- }
- end[HC_OPT].title = " HC";
- end[SA_OPT].title = " SA";
- end[GDA_OPT].title = " GDA";
- end[RRT_OPT].title = " RRT";
- end[TA_OPT].title = " TA";
- end[MY_OPT].title = " MY";
-
- for(i=0;i<MAX_OPT_NR;i++)
- end[i].quantil(0.5);
-
- cout << "mean: \n";
- compareStatVarQuantil=-1;
- qsort(end,MAX_OPT_NR,sizeof(StatVar),compareStatVar);
- for(i=0;i<MAX_OPT_NR;i++)
- cout << end[i].title << " " << end[i].getMean() << endl;
-
- cout << "\nbest: \n";
- compareStatVarQuantil=0;
- qsort(end,MAX_OPT_NR,sizeof(StatVar),compareStatVar);
- for(i=0;i<MAX_OPT_NR;i++)
- cout << end[i].title << " " << end[i].quantil(compareStatVarQuantil)
- << endl;
-
- cout << "\n20%-quantil: \n";
- compareStatVarQuantil=0.2;
- qsort(end,MAX_OPT_NR,sizeof(StatVar),compareStatVar);
- for(i=0;i<MAX_OPT_NR;i++)
- cout << end[i].title << " " << end[i].quantil(compareStatVarQuantil)
- << endl;
-}
-
-
-void metaOptimization(Problem &tp,int nLaeufe,int nPars)
-{
- double bestPar,bestValue;
-
- bestPar=IterOptimizationOptimizeParameter(tp,TAOptimization::defaultAnnRate,0.0,1.0,nLaeufe,nPars,TA_OPT,bestValue);
- cout << "#TA(defaultAnnRate) BEST-PAR: " << bestPar << " BEST-VAL: " << bestValue << endl;
- bestPar=IterOptimizationOptimizeParameter(tp,RRTOptimization::defaultAnnRate,0.0,1.0,nLaeufe,nPars,RRT_OPT,bestValue);
- cout << "#RRT(defaultAnnRate) BEST-PAR: " << bestPar << " BEST-VAL: " << bestValue << endl;
- bestPar=IterOptimizationOptimizeParameter(tp,GDAOptimization::defaultAlpha,0.0,0.01,nLaeufe,nPars,GDA_OPT,bestValue);
- cout << "#GDA(defaultAlpha) BEST-PAR: " << bestPar << " BEST-VAL: " << bestValue << endl;
- bestPar=IterOptimizationOptimizeParameter(tp,SAOptimization::defaultEndAnnRate,0.0,1.0,nLaeufe,nPars,SA_OPT,bestValue);
- cout << "#SA(defaultEndAnnRate) BEST-PAR: " << bestPar << " BEST-VAL: " << bestValue << endl;
-}
http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/ef91969a/ext/giza-pp/mkcls-v2/ProblemTest.h
----------------------------------------------------------------------
diff --git a/ext/giza-pp/mkcls-v2/ProblemTest.h b/ext/giza-pp/mkcls-v2/ProblemTest.h
deleted file mode 100644
index fde4db7..0000000
--- a/ext/giza-pp/mkcls-v2/ProblemTest.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
-
-Copyright (C) 1997,1998,1999,2000,2001 Franz Josef Och
-
-mkcls - a program for making word classes .
-
-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 2
-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, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-USA.
-
-*/
-
-
-
-
-
-
-
-#ifndef PROBLEMTEST_H
-#define PROBLEMTEST_H
-
-#include "Problem.h"
-#include "StatVar.h"
-#include <fstream>
-
-
-enum {TA_OPT, HC_OPT, SA_OPT,RRT_OPT,GDA_OPT,MY_OPT,MAX_OPT_NR };
-
-class IterOptimization;
-
-extern short ProblemTestVerboseMode;
-
-extern ofstream *PrintBestTo,*PrintBestTo2;
-
-double solveProblem(int verbose,Problem &problem,int versuche,
-int optimierungsschritte,int verfahren,double &mean,StatVar &endValue,
-StatVar &laufzeit,StatVar &initValue,double maxSec= 0,int *iterationsschritte=0);
-
-
-
-int compareProblem(const void *p,const void *j);
-
-
-
-void multiSolveProblem(Problem &problem,int versuche,int maxSeconds);
-
-
-
-IterOptimization *genIterOptimizer(int verfahren,Problem &problem,int maxIter);
-
-
-void metaOptimization(Problem &p,int nLaeufe,int nPars);
-
-#endif