Exemplo n.º 1
0
int GLPKPrintFromSolver(int lpcount) {
	if (GLPKModel == NULL) {
		FErrorFile() << "Cannot print problem because problem does not exist." << endl;
		FlushErrorFile();
		return FAIL;
	}

	string Filename = CheckFilename(FOutputFilepath()+GetParameter("LP filename"));
	int Status = glp_write_lp(GLPKModel,NULL,ConvertStringToCString(Filename));

	if (Status) {
		FErrorFile() << "Unable to write problem to file due to error in writing function." << endl;
		FlushErrorFile();
		return FAIL;
	}

	Filename = CheckFilename(FOutputFilepath()+GetParameter("LP filename")+itoa(lpcount));
	Status = glp_write_lp(GLPKModel,NULL,ConvertStringToCString(Filename));

	if (Status) {
		FErrorFile() << "Unable to write problem to file due to error in writing function." << endl;
		FlushErrorFile();
		return FAIL;
	}

	return SUCCESS;
}
Exemplo n.º 2
0
int CPLEXPrintFromSolver() {
	int Status = 0;
	if (CPLEXenv == NULL) {
		FErrorFile() << "Cannot print problem to file because CPLEX environment is not open." << endl;
		FlushErrorFile();
		return FAIL;
	}

	if (CPLEXModel == NULL) {
		FErrorFile() << "Cannot print problem to file because no CPLEX model exists." << endl;
		FlushErrorFile();
		return FAIL;
	}
	
	string Filename = CheckFilename(FOutputFilepath()+GetParameter("LP filename"));
	Status = CPXwriteprob (CPLEXenv, CPLEXModel,Filename.data(), "LP");

	if (Status) {
		FErrorFile() << "Cannot print problem to file for unknown reason." << endl;
		FlushErrorFile();
		return FAIL;
	}

	return SUCCESS;
}
Exemplo n.º 3
0
	CFileList *List(const char *mask, unsigned flags, CFileList *list)
	{
		FSLog->Printf("list: %s\n", mask);
		CheckFilename(mask);
		if (!list) list = new CFileList;
		CFileSystem::List(Name1, flags, list);
		if (Name2[0])
			CFileSystem::List(Name2, flags, list);
		return list;
	}
Exemplo n.º 4
0
    void excelreader::SaveAsFile(const std::wstring& filename)
    {
        if (!CheckFilename(filename))
        {
            throw ExcelException("save error");
        }

        _variant_t file(filename.c_str());
        AutoWrap(DISPATCH_METHOD, NULL, pXlSheet, L"SaveAs", 1, file);
    }
Exemplo n.º 5
0
	// overloaded virtual functions
	// will check GameDir, then BASEDIRNAME (if GameDir!=BASEDIRNAME)
	bool FileExists(const char *filename, unsigned flags)
	{
		CheckFilename(filename);
		// check
		bool chk = CFileSystem::FileExists(Name1, flags);
		if (!chk && Name2[0])
			chk = CFileSystem::FileExists(Name2, flags);
		// log
		static const char boolStr[] = {'-', '+'};
		FSLog->Printf("chk: %s %c\n", filename, boolStr[chk]);
		return chk;
	}
Exemplo n.º 6
0
	CFile *OpenFile(const char *filename, unsigned flags)
	{
		FSLog->Printf("open: %s ", filename);
		CheckFilename(filename);
		// open
		CFile *file = CFileSystem::OpenFile(Name1, flags);
		if (!file && Name2[0])
			file = CFileSystem::OpenFile(Name2, flags);
		// log
		if (file)
			FSLog->Printf("(%s)\n", file->Owner->name);
		else
			FSLog->Printf("(failed)\n");
		return file;
	}