首页 > > 详细

辅导C#、Java辅导、辅导Java、Processing解析

#include "definition.h"
//
list ReturnListA_i(list, int); // int
list SortUnitLoadListDeparture(list); //
list GenerationIncomingsUnstrict(int, int, int); //
list RandomUnitLoadList(int, int); //
list GenerateUnitLoadList1(int, int, int, int);
list GenerateUnitLoadList2(int, int, int);
list GenerateBinList(int, int, int); //
list DeleteUnitLoads(list, list); // (,)
list ReturnLaterItems(list, int); // int
list ReSortUnitLoadList(list); //
int ReturnBlockingNumber(list);
Result ComparisonMethod(list, list);
Result ShortestTrvelAssignment(list, list); // STA
int SharedItem(list, UnitLoad); // listUnitLoad
Result ForwardGroupingMethod(list, list); // FG
Result BackwardGroupingMethod(list, list); // BG
int INCOMINGS[4][NumberOfPeriod];
//
int IncomingItems[NumberOfPeriod], OutgoingItems[NumberOfPeriod], StoredItems[NumberOfPeriod];
list ULList;
list::iterator ULiter;
list flowrack;
Result ComparionResult, STAResult, FGResult, BGResudeparture - 1]++;
for (int i = ULiter->arrival; i departure; i++)
StoredItems[i - 1]++;
}
STARTING = time(0);
ComparionResult = ComparisonMethod(ULList, flowrack);
NoAssignmentComparison = 0;
for (int i = 0; i < NumberOfBin; i++) {
NoAssignmentComparison += ComparionResult.assignment[i];
}
if (NoAssignmentComparison < NumberOfItem)
goto STARTEXPERIMENT;
FINISHING = time(0);
RunTimeComparion = difftime(FINISHING, STARTING);
STARTING = time(0);
STAResult = ShortestTrvelAssignment(ULList, flowrack);
NoAssignmentSTA = 0;
for (int i = 0; i < NumberOfBin; i++) {
NoAssignmentSTA += STAResult.assignment[i];
}
if (NoAssignmentSTA < NumberOfItem)
goto STARTEXPERIMENT;
FINISHING = time(0);
RunTimeSTA = difftime(FINISHING, STARTING);
STARTING = time(0);
FGResult = ForwardGroupingMethod(ULList, flowrack);
NoAssignmentFG = 0;
for (int i = 0; i < NumberOfBin; i++) {
NoAssignmentFG += FGResult.assignment[i];
}
if (NoAssignmentFG < NumberOfItem)
goto STARTEXPERIMENT;
FINISHING = time(0);
RunTimeFG = difftime(FINISHING, STARTING);
STARTING = time(0);
BGResult = BackwardGroupingMethod(ULList, flowrack);
NoAssignmentBG = 0;
for (int i = 0; i < NumberOfBin; i++) {
NoAssignmentBG += BGResult.assignment[i];
}
if (NoAssignmentBG < NumberOfItem)
goto STARTEXPERIMENT;
FINISHING = time(0);
RunTimeBG = difftime(FINISHING, STARTING);
record.open("stays.txt", std::ios::app);
for (int j = 0; j < NumberOfPeriod; j++) {
record << StoredItems[j] << "\t";
}
record << endl;
record.close();
record.open("ARPD.txt", std::ios::app);
minimal = ComparionResult.cost;
if (STAResult.cost < minimal)
minimal = STAResult.cost;
if (FGResult.cost < minimal)
minimal = FGResult.cost;
if (BGResult.cost < minimal)
minimal = BGResult.cost;
record << (ComparionResult.cost - minimal) / minimal * 100.0 << "\t"
<< (STAResult.cost - minimal) / minimal * 100.0 << "\t"
<< (FGResult.cost - minimal) / minimal * 100.0 << "\t"
<< (BGResult.cost - minimal) / minimal * 100.0 << endl;
record.close();
record.open("cost.txt", std::ios::app);
record << ComparionResult.cost << "\t" << (ComparionResult.cost - minimal) / minimal * 100.0 << "\t" << ComparionResult.blocking << "\t" << RunTimeComparion << "\t\t"
<< STAResult.cost << "\t" << (STAResult.cost - minimal) / minimal * 100.0 << "\t" << STAResult.blocking << "\t" << RunTimeSTA << "\t\t"
<< FGResult.cost << "\t" << (FGResult.cost - minimal) / minimal * 100.0 << "\t" << FGResult.blocking << "\t" << RunTimeFG << "\t\t"
<< BGResult.cost << "\t" << (BGResult.cost - minimal) / minimal * 100.0 << "\t" << BGResult.blocking << "\t" << RunTimeBG << endl;
record.close();

record.open("DistributionComparison.txt", std::ios::app);
for (int j = 0; j < NumberOfBin; j++) {
record << ComparionResult.assignment[j] << "\t";
}
record << endl;
record.close();
record.open("DistributionSTA.txt", std::ios::app);
for (int j = 0; j < NumberOfBin; j++) {
record << STAResult.assignment[j] << "\t";
}
record << endl;
record.close();
record.open("DistributionFG.txt", std::ios::app);
for (int j = 0; j < NumberOfBin; j++) {
record << FGResult.assignment[j] << "\t";
}
record << endl;
record.close();
record.open("DistributionBG.txt", std::ios::app);
for (int j = 0; j < NumberOfBin; j++) {
record << BGResult.assignment[j] << "\t";
}
record << endl;
record.close();
cout << "" << cycle + 1 << "(M = " << NumberOfLayer << ", T = " << NumberOfPeriod << ", Mode = ";
if (MODE == RANDOM)
cout << "RANDOM";
else if (MODE == CENTERHIGH)
cout << "CENTERHIGH";
else if (MODE == DECREASING)
cout << "DECREASING";
else cout << "INCREASING";
cout << ")..." << endl;
cycle++;
if (cycle < CYCLE)
goto STARTEXPERIMENT;
return 0;
}

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!