Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mgiza.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'mgizapp/src/mkcls/Problem.cpp')
-rw-r--r--mgizapp/src/mkcls/Problem.cpp81
1 files changed, 44 insertions, 37 deletions
diff --git a/mgizapp/src/mkcls/Problem.cpp b/mgizapp/src/mkcls/Problem.cpp
index 6e126c8..d57af3f 100644
--- a/mgizapp/src/mkcls/Problem.cpp
+++ b/mgizapp/src/mkcls/Problem.cpp
@@ -9,14 +9,14 @@ 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,
+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,
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA.
*/
@@ -29,14 +29,14 @@ USA.
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)
-{
+ 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;
+ cout << "Initialization of Problem: " << maxComp << " " << maxCompVal
+ << endl;
}
void Problem::initialize(int i)
@@ -57,7 +57,7 @@ void Problem::doChange(ProblemChange &c)
assert (initialized);
curCompChange=1;
_doChange(c);
- numberOfDoChange++;
+ numberOfDoChange++;
}
void Problem::incrementDirection()
@@ -77,10 +77,10 @@ ProblemChange& Problem::change()
incrementDirection();
ProblemChange *p;
- int changeFound=_change(&p);
+ int changeFound=_change(&p);
curCompVal++;
if( changeFound==0 )
- return change();
+ return change();
else
return *p;
}
@@ -97,9 +97,11 @@ double Problem::valueChange(ProblemChange &x)
numberOfPartEvaluations++;
assert( initialized );
double currentValue=value();
- _doChange(x);numberOfDoChange++;
+ _doChange(x);
+ numberOfDoChange++;
double newValue=value();
- _undoChange(x);numberOfDoChange++;
+ _undoChange(x);
+ numberOfDoChange++;
assert( currentValue==value() );
return newValue-currentValue;
}
@@ -107,8 +109,8 @@ double Problem::valueChange(ProblemChange &x)
void Problem::dumpOn(ostream &strm)
{
assert( initialized );
- strm << "Problem(" << initialisierung << "," << auswertung << ","
- << nachbarschaft << ")\n";
+ strm << "Problem(" << initialisierung << "," << auswertung << ","
+ << nachbarschaft << ")\n";
strm << " #value: " << numberOfFullEvaluations << endl;
strm << "#valueChange: " << numberOfPartEvaluations << endl;
strm << " #doChange: " << numberOfDoChange << endl;
@@ -120,41 +122,46 @@ StatVar& Problem::deviationStatVar(Optimization &s,int anz)
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()));
- }
+ 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;
+ strm << "Problem: " << endl;
assert( initialized );
}
-double Problem::nicevalue(double)
-{
- return value();
+double Problem::nicevalue(double)
+{
+ return value();
}
-int Problem::maxDimensionVal(void) {return -1;}
-int Problem::maxDimension(void) {return -1;}
+int Problem::maxDimensionVal(void)
+{
+ return -1;
+}
+int Problem::maxDimension(void)
+{
+ return -1;
+}
ProblemChange::~ProblemChange()
- {
- }
-
+{
+}
+
ProblemChange::ProblemChange()
- {
- }
+{
+}
void Problem::setValuesFrom(Problem *p)
{