1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
| #include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <windows.h>
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
#include "stdafx.h"
#include "layout.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/* Seed the random-number generator with current time so that
* the numbers will be different every time we run.
*/
//srand( (unsigned)time( NULL ) );
//srand((unsigned)time(NULL));
/////// My classes
//variables
CString Fname;
// Two dimentional dynamic Vectors
//typedef std::vector<double> DoubleV;
//typedef std::vector<DoubleV> DoubleVV; // 2D "array" of doubles
int loc_horizontal;
int loc_vertical;
int no_locations;
int no_mac_types;
int no_products;
int locations[50];
int Demand[50];
int Mac_dups[50];
int Mac_capacity[50];
int pro_seq[50][50];
int Dist[50][50];
int flow [20][20][20];
int layout[50][50];
int temp[50];
int Time_pro_mac[50][50];
///// My Functions
void getfile();
void getinpf();
void Showinp();
void Cal_flow();
void print_error(CString msg,int type);
void random_layout();
int GetRandomMachine();
bool CheckIfValid(int);
// The one and only application object
CWinApp theApp;
//using namespace std;
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int nRetCode = 0;
// initialize MFC and print and error on failure
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
// TODO: change error code to suit your needs
_tprintf(_T("Fatal Error: MFC initialization failed\n"));
nRetCode = 1;
}
else
{
// TODO: code your application's behavior here.
getfile();
nRetCode=0;
}
return nRetCode;
}
void getfile()
{
CString m_file_name;
AfxMessageBox("Format of Input File : \n1)Location\n2)products \n3)machine types \n4)other details");
AfxMessageBox("Select the input file ");
CFileDialog Fdlg( true, NULL, NULL,OFN_FILEMUSTEXIST , NULL, NULL );
Fdlg.DoModal();
Fname = Fdlg.GetFileName();
getinpf();
AfxMessageBox("End Of Simulation : \n\nTry with a different set of tasks ");
return;
} |