| 3362 | |
| 3363 | |
| 3364 | int change_cost(INPUT_FILE GROEBNER, INPUT_FILE NEW_COST, |
| 3365 | const int& version, |
| 3366 | const int& S_pair_criteria, |
| 3367 | const float& interred_percentage, |
| 3368 | const BOOLEAN& verbose) |
| 3369 | { |
| 3370 | |
| 3371 | char format_string[128]; |
| 3372 | int elimination_variables; |
| 3373 | int weighted_variables; |
| 3374 | char elimination_refinement[128]; |
| 3375 | char weighted_refinement[128]; |
| 3376 | int new_variables; |
| 3377 | char algorithm[128]; |
| 3378 | long old_size; |
| 3379 | |
| 3380 | ifstream old(GROEBNER); |
| 3381 | ifstream _new(NEW_COST); |
| 3382 | |
| 3383 | // verify existence of files |
| 3384 | |
| 3385 | if(!old) |
| 3386 | { |
| 3387 | cerr<<"ERROR: int change_cost(INPUT_FILE, INPUT_FILE):\n" |
| 3388 | "cannot read from first input file, possibly not found"<<endl; |
| 3389 | return 0; |
| 3390 | } |
| 3391 | |
| 3392 | if(!_new) |
| 3393 | { |
| 3394 | cerr<<"ERROR: int change_cost(INPUT_FILE, INPUT_FILE):\n" |
| 3395 | "cannot read from second input file, possibly not found"<<endl; |
| 3396 | return 0; |
| 3397 | } |
| 3398 | |
| 3399 | |
| 3400 | // read first part of GROEBNER file (until term ordering reached) |
| 3401 | |
| 3402 | // read format specification |
| 3403 | |
| 3404 | old>>format_string; |
| 3405 | |
| 3406 | if(!old) |
| 3407 | { |
| 3408 | cerr<<"ERROR: int change_cost(INPUT_FILE, INPUT_FILE):\n" |
| 3409 | "input failure when reading format specification of first input file,\n" |
| 3410 | "input format not accepted"<<endl; |
| 3411 | return 0; |
| 3412 | } |
| 3413 | |
| 3414 | if(strcmp(format_string,"GROEBNER")) |
| 3415 | { |
| 3416 | cerr<<"WARNING: int change_cost(INPUT_FILE, INPUT_FILE):\n" |
| 3417 | "first input file has suspicious format"<<endl; |
| 3418 | } |
| 3419 | |
| 3420 | // read algorithm |
| 3421 |
no test coverage detected