| 2406 | |
| 2407 | |
| 2408 | int solve(INPUT_FILE PROBLEM, INPUT_FILE GROEBNER) |
| 2409 | { |
| 2410 | |
| 2411 | char format_string[128]; |
| 2412 | int problem_variables; |
| 2413 | int elimination_variables; |
| 2414 | int weighted_variables; |
| 2415 | char elimination_refinement[128]; |
| 2416 | char weighted_refinement[128]; |
| 2417 | char algorithm[128]; |
| 2418 | long size; |
| 2419 | long instances; |
| 2420 | |
| 2421 | ifstream problem(PROBLEM); |
| 2422 | ifstream groebner(GROEBNER); |
| 2423 | |
| 2424 | // verfifie existence of files |
| 2425 | |
| 2426 | if(!problem) |
| 2427 | { |
| 2428 | cerr<<"ERROR: int solve(INPUT_FILE, INPUT_FILE):\n" |
| 2429 | "cannot read from first input file "<< PROBLEM <<", possibly not found"<<endl; |
| 2430 | return 0; |
| 2431 | } |
| 2432 | |
| 2433 | if(!groebner) |
| 2434 | { |
| 2435 | cerr<<"ERROR: int solve(INPUT_FILE, INPUT_FILE):\n" |
| 2436 | "cannot read from second input file "<< GROEBNER <<", possibly not found"<<endl; |
| 2437 | return 0; |
| 2438 | } |
| 2439 | |
| 2440 | // read GROEBNER file |
| 2441 | |
| 2442 | // read format specification |
| 2443 | |
| 2444 | groebner>>format_string; |
| 2445 | |
| 2446 | if(!groebner) |
| 2447 | { |
| 2448 | cerr<<"ERROR: int solve(INPUT_FILE, INPUT_FILE):\n" |
| 2449 | "input failure when reading format specification of second input file,\n" |
| 2450 | "input format not accepted"<<endl; |
| 2451 | return 0; |
| 2452 | } |
| 2453 | |
| 2454 | if(strcmp(format_string,"GROEBNER")) |
| 2455 | cerr<<"WARNING: int solve(INPUT_FILE, INPUT_FILE):\n" |
| 2456 | "second input file has suspicious format"<<endl; |
| 2457 | |
| 2458 | // read algorithm |
| 2459 | |
| 2460 | groebner>>format_string; |
| 2461 | |
| 2462 | if(!groebner) |
| 2463 | { |
| 2464 | cerr<<"ERROR: int solve(INPUT_FILE, INPUT_FILE):\n" |
| 2465 | "input failure before reading algorithm from second input file,\n" |
no test coverage detected