Skip to content

Commit d65788c

Browse files
authored
Development (#4)
* V0.4 - Lazy Constraint Callback * Updated README.md * V0.5 - Added arguments support and writing results to a text file\nCan now be massively launched from a command line interface, all results will be printed to Results.txt * V0.6 - Added support for time/distance solving * V0.7 - Now exports results to a CSV file * V1.0 - Final working build
1 parent 9c1ff29 commit d65788c

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,3 +362,8 @@ MigrationBackup/
362362
# Fody - auto-generated XML schema
363363
FodyWeavers.xsd
364364
/TIPEcppTest1/model.lp
365+
/TIPEcppTest1/Model.lp
366+
/TIPEcppTest1/Results.txt
367+
/TIPEcppTest1/Results.txt
368+
/TIPEcppTest1/Results_X.csv
369+
/TIPEcppTest1/Results.txt

TIPEcppTest1/TIPEcppTest1.cpp

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -439,15 +439,28 @@ int main(int argc, char** argv)
439439
file << "|\tSetup elapsed time(ms): " << ElapsedSetup.count() << endl;
440440
file << "|\tSolving elapsed time(ms): " << ElapsedSolving.count() << endl;
441441
file << "Solution (" << cplex.getStatus() << ") with objective " << objective << endl;
442-
int i = 0;
443-
file << i << "" << G[i];
442+
}
443+
file.close();
444+
ofstream file_X;
445+
file_X.open("Results_X.csv", std::ios::out);
446+
if (file_X.is_open())
447+
{
448+
int i = 1;
449+
for (pair<int, int> i0 : G)
450+
{
451+
i = i0.first;
452+
break;
453+
}
454+
file_X << i << "," << G[i];
455+
int beginning = i;
444456
i = G[i];
445-
while (i != 0)
457+
while (i != beginning)
446458
{
447459
i = G[i];
448-
file << "" << i;
460+
file_X << "," << i;
449461
}
450462
}
463+
file_X.close();
451464
}
452465
else
453466
{

0 commit comments

Comments
 (0)