From fa0e1c592b6f3ad8aa4cd2f2a47b548cd3f0a9a5 Mon Sep 17 00:00:00 2001
From: Peter-Paul
Date: Wed, 28 Aug 2024 12:11:29 +0200
Subject: [PATCH] UPPERMARG and LOWERMARG can be set by user
---
Makefile | 2 +-
src/Hitas.cpp | 69 +----------------------------
src/Hitas.h | 2 +-
src/Table.cpp | 106 ++++++++++++++++++++++-----------------------
src/Table.h | 6 +--
src/TauArgus.cpp | 12 ++---
src/Variable.h | 2 +-
src/Versioninfo.rc | 8 ++--
src/defines.h | 4 +-
9 files changed, 71 insertions(+), 140 deletions(-)
diff --git a/Makefile b/Makefile
index aeb369a..666a546 100644
--- a/Makefile
+++ b/Makefile
@@ -9,7 +9,7 @@ CP = cp -p
32BIT = true
#32BIT = false
-SWIGDIR = D:/Peter-Paul/Documents/Thuiswerk/Programmatuur/swigwin-4.0.1
+SWIGDIR = D:/Peter-Paul/Documents/Thuiswerk/Programmatuur/swigwin-4.0.2
ifeq ($(32BIT), false) # 64 bit assumed
BITS = -m64 -D_LP64
diff --git a/src/Hitas.cpp b/src/Hitas.cpp
index 765af8a..e042d0e 100644
--- a/src/Hitas.cpp
+++ b/src/Hitas.cpp
@@ -43,80 +43,15 @@ CHitas::~CHitas()
{
}
-/*
-[Frequency rule]
-MINCOUNT=3 ; Cell should contain at least (MINCOUNT + 1) contributants // SafeMinRec minus 1 in avdw's geval
-
-[Dominance rule] // !!! is vervallen !!!!
-DOMCOUNT=1 ; Largest DOMCOUNT should contribute less than
-DOMPRO=0.7 ; DOMPRO times cellvalue
-
-[Safety ranges]
-LOWERMARG=0.99 ; lowerbound in case of marginal cell // zo laten
-UPPERMARG=1.01 ; same for upperbound // zo laten
-
-[Costs]
-DISTANCE=0 ; 0 if cost specified in BTab.dat, 1 if distance is to be used // 0 geen afstandsfunctie, 1 Anco
-D1=1 3 5 9 17 ; costs var1 distance=1, 2, 3, 4, 5 (=max cost)
-D2=1 3 5 9 17 ; costs var2 distance=1, 2, 3, 4, 5 (=max cost)
-D3=1 3 5 17 17 ; costs var3 distance=1, 2, 3, 4, 5 (=max cost)
-
-[Misc]
-MINTABVAL=0 ; Each cell is non-negative // ondergrens
-MAXTABVAL=150000000 ; and less than MAXTABVAL // totaal generaal van Resp (Shadow? Anco)
-OUTDIR=c:/knb/hitas/test/ ; Will contain ouput-files (= TEMP-dir?) // werkdirectory
-*/
-
-
-bool CHitas::WriteParameterFile(FILE *fd, CTable& tab)
-{
- fprintf(fd, "[Frequency rule]\n");
- fprintf(fd, "MINCOUNT=%d\n\n", tab.SafeMinRec);
-
- /*
- fprintf(fd, "[Dominance rule]\n");
- fprintf(fd, "DOMCOUNT=%d\n", tab.DominanceNumber);
- fprintf(fd, "DOMPRO=0.%d\n\n", tab.DominancePerc);
- */
-
- fprintf(fd, "[Safety ranges]\n");
- fprintf(fd, "LOWERMARG=0.99\n");
- fprintf(fd, "UPPERMARG=1.01\n\n");
-
- fprintf(fd, "[Misc]\n");
- fprintf(fd, "MINTABVAL=0\n");
- fprintf(fd, "MAXTABVAL=%.0f\n\n", tab.GetCell(0L)->GetResp() * 1.5); // should be enough
-// MakeTempPath(); Wordt nu door TAU doorgegeven.
-// fprintf(fd, "OUTDIR=%s\n\n", (LPCTSTR) TempPath);
-
- fprintf(fd, "[Costs]\n");
- fprintf(fd, "DISTANCE=0\n");
-
- return true;
-}
-
-/*
-3 // aantal dimensies tabel
-c:\knb\hitas\test3\data\SBI3.txt // naam bestand met opspanvariabele 1
-c:\knb\hitas\test3\data\GK3.txt // naam bestand met opspanvariabele 2
-c:\knb\hitas\test3\data\Regio3.txt // naam bestand met opspanvariabele 3
-c:\knb\hitas\test3\data\BTab.dat // naam bestand met basistabel
-c:\knb\hitas\test\status3.dat // naam bestand met resultaat (alleen secundaire cellen)
-*/
-
bool CHitas::WriteFilesFile(FILE *fd, CTable &tab, CVariable *var)
{
int i;
-// string fname/*, varname*/;
- //char fname[MAX_PATH];
- //char varname[10];
string fname;
string varname;
- fprintf(fd, "%ld\n", tab.nDim); // dimensies
+ fprintf(fd, "%ld\n", tab.nDim); // number of dimensions
// name files with codelists
for (i = 0; i < tab.nDim; i++) {
- //sprintf(fname, "%shitasv%d.txt", TempPath.c_str(), i + 1);
fname = TempPath + "hitasv" + std::to_string(i+1) + ".txt";
varname = "Var_" + std::to_string(i+1);
fprintf(fd, "%s\n", fname.c_str());
@@ -124,14 +59,12 @@ bool CHitas::WriteFilesFile(FILE *fd, CTable &tab, CVariable *var)
}
// name file with table
- //sprintf(fname, "%s%s", TempPath.c_str(), NameTabFile.c_str());
fname = TempPath + NameTabFile;
fprintf(fd, "%s\n", fname.c_str());
// write cells
WriteCellFile(fname.c_str(), tab, var);
// name file for result with secondary cell dimensions
- //sprintf(fname, "%s%s", TempPath.c_str(), NameSecFile.c_str());
fname = TempPath + NameSecFile;
fprintf(fd, "%s\n", fname.c_str());
diff --git a/src/Hitas.h b/src/Hitas.h
index dfd392c..0a7b295 100644
--- a/src/Hitas.h
+++ b/src/Hitas.h
@@ -31,7 +31,7 @@ class CHitas
bool WriteCellDim(FILE *fd, CTable &tab, CVariable *var, long *dimsCell, long *dimsCodeList, int niv);
bool WriteCellFile(LPCTSTR FileName, CTable &tab, CVariable *var);
bool WriteFilesFile(FILE *fd, CTable& tab, CVariable *var);
- bool WriteParameterFile(FILE *fd, CTable& tab);
+ //bool WriteParameterFile(FILE *fd, CTable& tab);
std::string TempPath;
CHitas();
virtual ~CHitas();
diff --git a/src/Table.cpp b/src/Table.cpp
index 8334248..e6d17b5 100644
--- a/src/Table.cpp
+++ b/src/Table.cpp
@@ -128,7 +128,7 @@ void CTable:: operator = (CTable &table2)
ApplyPeeper = table2.ApplyPeeper;
ApplyZeroRule = table2.ApplyZeroRule;
EmptyCellsAsNSEmpty = table2.EmptyCellsAsNSEmpty;
-
+
HasRecode = table2.HasRecode ;
}
@@ -941,60 +941,58 @@ bool CTable::GetIndicesFromCellNr(long CellNr, long *Indices)
// cells that are secondary unsafe are reset to safe.
void CTable::UndoSecondarySuppress(long SortSuppress)
{
- long i;
- CDataCell *dc;
-// set realized upper and upper to initial values
- for (i = 0; i < nCell; i++) {
- dc = GetCell(i);
- dc->SetRealizedUpperValue(0);
- dc->SetRealizedLowerValue(0);
- dc->SetCTAValue(0);
- switch (SortSuppress) {
- case WITHOUT_SINGLETON:
- switch (dc->GetStatus()) {
- case CS_SECONDARY_UNSAFE:
- if (dc->GetFreq() == 0 ) {
- dc->SetStatus (CS_EMPTY_NONSTRUCTURAL);}
- else {
- dc->SetStatus(CS_SAFE);};
- break;
- case CS_SECONDARY_UNSAFE_MANUAL:
- dc->SetStatus(CS_SAFE_MANUAL);
- break;
- }
- break;
- case WITH_SINGLETON:
- switch (dc->GetStatus()) {
- case CS_UNSAFE_SINGLETON:
- dc->SetStatus(CS_SAFE);
- break;
- case CS_UNSAFE_SINGLETON_MANUAL:
- dc->SetStatus(CS_SAFE_MANUAL);
- break;
- }
- break;
-
- case BOTH:
- switch (dc->GetStatus()) {
- case CS_SECONDARY_UNSAFE:
- if (dc->GetFreq() == 0 ) {
- dc->SetStatus (CS_EMPTY_NONSTRUCTURAL);}
- else {
- dc->SetStatus(CS_SAFE);};
- break;
- case CS_SECONDARY_UNSAFE_MANUAL:
- dc->SetStatus(CS_SAFE_MANUAL);
- break;
- case CS_UNSAFE_SINGLETON:
- dc->SetStatus(CS_SAFE);
- break;
- case CS_UNSAFE_SINGLETON_MANUAL:
- dc->SetStatus(CS_SAFE_MANUAL);
- break;
- }
-
- }
+ long i;
+ CDataCell *dc;
+ // set realized lower and upper to initial values
+ for (i = 0; i < nCell; i++) {
+ dc = GetCell(i);
+ dc->SetRealizedUpperValue(0);
+ dc->SetRealizedLowerValue(0);
+ dc->SetCTAValue(0);
+ switch (SortSuppress){
+ case WITHOUT_SINGLETON:
+ switch (dc->GetStatus()) {
+ case CS_SECONDARY_UNSAFE:
+ if (dc->GetFreq() == 0 ) {
+ dc->SetStatus (CS_EMPTY_NONSTRUCTURAL);}
+ else {
+ dc->SetStatus(CS_SAFE);};
+ break;
+ case CS_SECONDARY_UNSAFE_MANUAL:
+ dc->SetStatus(CS_SAFE_MANUAL);
+ break;
}
+ break;
+ case WITH_SINGLETON:
+ switch (dc->GetStatus()) {
+ case CS_UNSAFE_SINGLETON:
+ dc->SetStatus(CS_SAFE);
+ break;
+ case CS_UNSAFE_SINGLETON_MANUAL:
+ dc->SetStatus(CS_SAFE_MANUAL);
+ break;
+ }
+ break;
+ case BOTH:
+ switch (dc->GetStatus()) {
+ case CS_SECONDARY_UNSAFE:
+ if (dc->GetFreq() == 0 ) {
+ dc->SetStatus (CS_EMPTY_NONSTRUCTURAL);}
+ else {
+ dc->SetStatus(CS_SAFE);};
+ break;
+ case CS_SECONDARY_UNSAFE_MANUAL:
+ dc->SetStatus(CS_SAFE_MANUAL);
+ break;
+ case CS_UNSAFE_SINGLETON:
+ dc->SetStatus(CS_SAFE);
+ break;
+ case CS_UNSAFE_SINGLETON_MANUAL:
+ dc->SetStatus(CS_SAFE_MANUAL);
+ break;
+ }
+ }
+ }
}
// Get Status and Cost per Explanatory variable
diff --git a/src/Table.h b/src/Table.h
index b9021c1..e2f1cb0 100644
--- a/src/Table.h
+++ b/src/Table.h
@@ -119,8 +119,8 @@ class CTable
long PeepMinFreqHold;
- int SafeMinRec; //Minimaal aantal bijdragers
- int SafeMinHoldings; // minimum aantal holdings
+ int SafeMinRec; // Minimum number of contributors
+ int SafeMinHoldings; // Minimum number of holdings
/// Safety Margins
long CellFreqSafetyPerc;
@@ -129,7 +129,7 @@ class CTable
long NSEmptySafetyRange;
long SingletonSafetyRangePerc;
double ZeroSafetyRange;
-
+
// Operations
// have to make the operator =
diff --git a/src/TauArgus.cpp b/src/TauArgus.cpp
index 7c8c440..967fb4d 100644
--- a/src/TauArgus.cpp
+++ b/src/TauArgus.cpp
@@ -362,8 +362,8 @@ bool TauArgus::DoRecode(long VarIndex, const char* RecodeString, long nMissing,
m_var[v].Recode.sCode.push_back(""); // for Total
// another time, now compute list of dest codes
- ParseRecodeString(v, RecodeString, ErrorType, ErrorLine, ErrorPos, DESTCODE);
- if (m_var[v].Recode.sCode.size() < 2){
+ ParseRecodeString(v, RecodeString, ErrorType, ErrorLine, ErrorPos, DESTCODE);
+ if (m_var[v].Recode.sCode.size() < 2){
*ErrorType = E_EMPTYSPEC;
*ErrorLine = 1;
*ErrorPos = 1;
@@ -377,8 +377,8 @@ bool TauArgus::DoRecode(long VarIndex, const char* RecodeString, long nMissing,
// m_var[v].Recode.nCode = m_var[v].Recode.sCode.GetSize();
// again, now compute dest codes and link between dest and src
- oke = ParseRecodeString(v, RecodeString, ErrorType, ErrorLine, ErrorPos, SRCCODE);
- if (!oke){
+ oke = ParseRecodeString(v, RecodeString, ErrorType, ErrorLine, ErrorPos, SRCCODE);
+ if (!oke){
return false; // missing to valid codes, a terrible shame
}
@@ -1627,7 +1627,7 @@ bool TauArgus::SetTableSafety(long Index, bool DominanceRule,
//Hitas for secondary supressions
bool TauArgus::PrepareHITAS(long TableIndex, const char* NameParameterFile, const char* NameFilesFile, const char* TauTemp)
{
- m_hitas.TempPath = TauTemp; // Temp doorgeven vanuit de TAU ipv zlf bepalen.
+ m_hitas.TempPath = TauTemp; // Use Temp directory passed by TAU
long t = TableIndex;
@@ -1648,7 +1648,7 @@ bool TauArgus::PrepareHITAS(long TableIndex, const char* NameParameterFile, cons
return false;
}
- if (!m_hitas.WriteParameterFile(fdParameter, m_tab[t]) ) goto error;
+ //if (!m_hitas.WriteParameterFile(fdParameter, m_tab[t]) ) goto error; // Is now taken care of in tau-argus GUI (Java)
if (!m_hitas.WriteFilesFile(fdFiles, m_tab[t], m_var) ) goto error;
fclose(fdParameter);
diff --git a/src/Variable.h b/src/Variable.h
index 11eeae7..d741e51 100644
--- a/src/Variable.h
+++ b/src/Variable.h
@@ -67,7 +67,7 @@ class CVariable
double MaxValue; // maximum in data file
- std::vector sCode; // For categorical variables: list of codes generated from microfile or from a file
+ std::vector sCode; // For categorical variables: list of codes generated from microfile or from a file
std::vector hLevel; // Levels hierarchical codelist, nCodes long
std::vector hLevelBasic; // Basic code hierarchical codelist, nCodes long
diff --git a/src/Versioninfo.rc b/src/Versioninfo.rc
index 191b94f..db83c21 100644
--- a/src/Versioninfo.rc
+++ b/src/Versioninfo.rc
@@ -2,8 +2,8 @@
/* Version number is also stated in defines.h. Needs to be adjusted manually. */
/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
1 VERSIONINFO
-FILEVERSION 1,1,4,11
-PRODUCTVERSION 1,1,4,11
+FILEVERSION 1,1,4,12
+PRODUCTVERSION 1,1,4,12
FILETYPE 2
BEGIN
BLOCK "StringFileInfo"
@@ -12,12 +12,12 @@ BEGIN
BEGIN
VALUE "CompanyName", ""
VALUE "FileDescription", "Data Engine TauArgus"
- VALUE "FileVersion", "1.1.4.11"
+ VALUE "FileVersion", "1.1.4.12"
VALUE "InternalName", ""
VALUE "LegalCopyright", ""
VALUE "OriginalFilename", "TauArgusJava.dll"
VALUE "ProductName", "TauArgusJava.dll"
- VALUE "ProductVersion", "1.1.4.11"
+ VALUE "ProductVersion", "1.1.4.12"
END
END
BLOCK "VarFileInfo"
diff --git a/src/defines.h b/src/defines.h
index d633220..ae2debe 100644
--- a/src/defines.h
+++ b/src/defines.h
@@ -19,12 +19,12 @@
#ifndef __TAUARGUSDEFINESH
#define __TAUARGUSDEFINESH
-#define VERSIONNUMBER "1.1.4.11"
+#define VERSIONNUMBER "1.1.4.12"
#define MAXCODEWIDTH 100
#define MAXRECORDLENGTH 32000
#define SEPARATOR "\r\n"
-#define MAXMEMORYUSE 50000000
+//#define MAXMEMORYUSE 50000000 // Not used????
#define FIREPROGRESS 1000
#define MAXDIM 10