from
MATLAB Contest - Wiring
by The MATLAB Contest Team
All the files needed to develop and score an entry for the MATLABĀ® Programming Contest.
|
| example.m |
% Copyright 2008 The MathWorks, Inc.
%%
% Let's set a problem
B = [30 0 0 0 0 50 70 90 0 100
0 0 40 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 30
0 60 0 30 0 30 0 0 0 40
60 50 0 40 40 0 0 0 0 0
0 60 0 30 0 0 0 0 0 0
100 0 0 0 0 30 30 30 0 0];
%%
% Let's give a wiring solution (bad one)
W = [7 6 7 7
7 7 7 8
4 1 5 1
4 1 4 2
5 1 6 1
6 1 6 2
7 1 7 2
7 2 7 3
7 3 7 4
7 4 7 5
6 5 7 5
6 5 6 6
6 6 6 7
6 7 6 8
5 8 6 8
4 8 5 8
3 8 4 8
2 8 3 8
2 8 2 9
2 9 2 10
1 10 2 10
7 8 7 9
6 9 7 9
5 9 6 9
4 9 5 9
3 9 4 9
3 9 3 10
5 4 5 5
5 2 5 3
4 3 5 3
3 3 4 3
3 2 3 3
2 2 3 2
1 2 2 2
1 2 1 3
1 3 1 4
1 4 1 5
1 5 1 6
4 5 5 5
3 5 4 5
2 3 2 4
6 6 7 6
5 6 6 6
4 6 5 6
6 6 6 6
4 4 4 5
4 5 4 6
4 5 4 5
2 4 2 5
2 5 3 5];
%%
visualize(B)
title('Problem without wires')
%%
visualize(B,W)
title('Problem after wiring')
%%
wiringGUI(B,W)
|
|
Contact us at files@mathworks.com