...
 
Commits (6)
makeで実行ファイルsolverができます.
MAKEFILE
g++ -o solve solver.cpp main.cpp io.c router/router.cpp -std=c++11
./solver < QUESTIONFILEで実行され解答のみを出力します.
必要ヘッダ
<limits.h>
<stdio.h>
<vector>
<algorithm>
"solver.h"
"io.h"
"router/router.hpp"
\ No newline at end of file
# 2019/08/26 追記
配線失敗時にボードを出力しないように変更しました
# 実行方法
```
cd nszw-solver
make
./solve < QUESTIONFILE
```
or
```
cd nszw-solver
g++ -o solve solver.cpp main.cpp io.c router/router.cpp -std=c++11
./solve < QUESTIONFILE
```
# 必要ヘッダ
* limits.h
* stdio.h
* vector
* algorithm
* "solver.h"
* "io.h"
* "router/router.hpp"
# 必要ファイル
* router/router.cpp
* io.c
* main.cpp
* solver.cpp
# 制約
* ブロックの横総数が72より小さい
* ブロックの縦総数が72より小さい
# アルゴリズム
* ブロックを縦,横に写像
* 写像をもとに配置,配線
* 配線に沿って縮小
* 空白を埋めるように縮小
* 解答
......@@ -6,8 +6,12 @@
int main(void){
read_problem();
solver();
if(solver()){
printf("success!");
print_answer();
}else{
printf("failed...");
}
return 0;
}
......
......@@ -73,7 +73,7 @@ int router(short int size_x, short int size_y, short int line_num, short int boa
lfsr_random_init(seed);
// Step 1
cout << "1st routing ..." << endl;
//cout << "1st routing ..." << endl;
for(i = 0; i < line_num; i++) {
if(adjacents[i]) continue;
#ifdef PRINT_SEARCH
......@@ -90,7 +90,7 @@ int router(short int size_x, short int size_y, short int line_num, short int boa
ap_uint<1> overlap_checks[MAX_CELLS];
// Step 2
cout << "rip-up routing ..." << endl;
//cout << "rip-up routing ..." << endl;
short int last_target = -1;
ap_uint<16> round;
for(round = 1; round <= ROUND_LIMIT; round++) {
......
......@@ -12,7 +12,7 @@
using namespace std;
#define ROUND_LIMIT 8192//4096//32768 // Max=65534(=2^16-2)
#define PRINT_BOARD
//#define PRINT_BOARD
//#define PRINT_SEARCH // for router debug
#define MAX_LINES 256
......
No preview for this file type
This diff is collapsed.
......@@ -5,6 +5,6 @@
#define MAXSIZE 128
void solver(void);
int solver(void);
#endif // _SOLVER_H_