Generated on Thu Mar 7 2013 10:21:14 for Gecode by doxygen 1.8.3.1
radiotherapy.cpp
Go to the documentation of this file.
1 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2 /*
3  * Main authors:
4  * Guido Tack <tack@gecode.org>
5  *
6  * Contributing authors:
7  * Mikael Lagerkvist <lagerkvist@gecode.org>
8  *
9  * Copyright:
10  * Guido Tack, 2009
11  * Mikael Lagerkvist, 2009
12  *
13  * Last modified:
14  * $Date: 2011-05-11 20:44:17 +1000 (Wed, 11 May 2011) $ by $Author: tack $
15  * $Revision: 12001 $
16  *
17  * This file is part of Gecode, the generic constraint
18  * development environment:
19  * http://www.gecode.org
20  *
21  * Permission is hereby granted, free of charge, to any person obtaining
22  * a copy of this software and associated documentation files (the
23  * "Software"), to deal in the Software without restriction, including
24  * without limitation the rights to use, copy, modify, merge, publish,
25  * distribute, sublicense, and/or sell copies of the Software, and to
26  * permit persons to whom the Software is furnished to do so, subject to
27  * the following conditions:
28  *
29  * The above copyright notice and this permission notice shall be
30  * included in all copies or substantial portions of the Software.
31  *
32  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
33  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
34  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
35  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
36  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
37  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
38  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
39  *
40  */
41 
42 #include <gecode/driver.hh>
43 #include <gecode/int.hh>
44 #include <gecode/minimodel.hh>
45 
46 using namespace Gecode;
47 
50 private:
52  int incr_sum(int row) {
53  int sum = intensity[row*n];
54  for (int i=1; i<n; i++)
55  sum += std::max(intensity[row*n+i]-intensity[row*n+i-1],0);
56  return sum;
57  }
58 public:
59  const int m;
60  const int n;
61  const int* intensity;
62 
63  int btMin;
64  int btMax;
65  int intsSum;
66 
68  RadiotherapyData(int m0, int n0, const int* intensity0)
69  : m(m0), n(n0), intensity(intensity0) {
70  btMax = 0;
71  intsSum = 0;
72  for (int i=0; i<m*n; i++) {
73  btMax = std::max(btMax, intensity[i]);
74  intsSum += intensity[i];
75  }
76 
77  btMin = 0;
78  for (int i=0; i<m; i++)
79  btMin = std::max(btMin, incr_sum(i));
80  }
81 };
82 
83 namespace {
84  extern RadiotherapyData rds[];
85  extern const unsigned int rds_n;
86 }
87 
102 class Radiotherapy : public MinimizeScript {
103 private:
105  const RadiotherapyData rd;
106 
108  IntVar beamtime;
110  IntVar K;
112  IntVarArray N;
114  IntVarArray q;
115 
117  IntVar _cost;
118 
119 public:
122  : rd(rds[opt.size()]) {
123 
124  // Initialize variables
125  beamtime = IntVar(*this, rd.btMin, rd.intsSum);
126  K = IntVar(*this, 0, rd.m*rd.n);
127  N = IntVarArray(*this, rd.btMax, 0, rd.m*rd.n);
128  q = IntVarArray(*this, rd.m*rd.n*rd.btMax, 0, rd.m*rd.n);
129 
130  IntArgs coeffs(rd.btMax);
131  for (int i=0; i<rd.btMax; i++)
132  coeffs[i] = i+1;
133  linear(*this, coeffs, N, IRT_EQ, beamtime);
134  linear(*this, N, IRT_EQ, K);
135 
136  for (int i=0; i<rd.m; i++) {
137  for (int j=0; j<rd.n; j++) {
138  IntVarArgs qs(rd.btMax);
139  for (int b=0; b<rd.btMax; b++)
140  qs[b] = q[i*rd.n*rd.btMax+j*rd.btMax+b];
141  linear(*this, coeffs, qs, IRT_EQ, rd.intensity[i*rd.n+j], ICL_DOM);
142  }
143  }
144 
145  for (int i=0; i<rd.m; i++) {
146  for (int b=0; b<rd.btMax; b++) {
147  IntVarArgs qs(rd.n);
148  for (int j=0; j<rd.n; j++)
149  qs[j] = q[i*rd.n*rd.btMax+j*rd.btMax+b];
150  incr_sum(N[b], qs, rd.m*rd.n);
151  }
152  }
153 
154  _cost = IntVar(*this, 0, (rd.m*rd.n+1)*(rd.intsSum+1));
155  rel(*this, _cost == beamtime*(rd.m*rd.n+1)+K);
156 
157  // First branch over beamtime and N
158  IntVarArgs ba(1); ba[0] = beamtime;
159  branch(*this, ba, INT_VAR_NONE, INT_VAL_MIN);
161 
162  // Then perform a nested search over q
163  NestedSearch::post(*this);
164 
165  }
166 
168  void incr_sum(IntVar& x, IntVarArgs& y, int mn) {
169  IntVarArgs s(*this, y.size()-1, 0, mn);
170  IntVarArgs t(y.size());
171  t[0] = y[0];
172  for (int i=1; i<y.size(); i++) {
173  rel(*this, s[i-1] >= y[i]-y[i-1]);
174  t[i] = s[i-1];
175  }
176  linear(*this, t, IRT_LQ, x);
177  }
178 
180  Radiotherapy(bool share, Radiotherapy& s)
181  : MinimizeScript(share,s), rd(s.rd) {
182  beamtime.update(*this, share, s.beamtime);
183  N.update(*this, share, s.N);
184  K.update(*this, share, s.K);
185  _cost.update(*this, share, s._cost);
186  q.update(*this, share, s.q);
187  }
188 
190  virtual Space*
191  copy(bool share) {
192  return new Radiotherapy(share,*this);
193  }
194 
196  virtual IntVar
197  cost(void) const { return _cost; }
198 
200  virtual void
201  print(std::ostream& os) const {
202  os << std::endl
203  << "B / K = " << beamtime << " / " << K << ",\nN = " << N << std::endl;
204  }
205 
207  class NestedSearch : public Brancher {
208  private:
210  bool done;
212  struct Idx {
213  int idx;
214  int weight;
215 
216  bool operator<(const Idx& rhs) const { return weight > rhs.weight; }
217  };
219  SharedArray<Idx> index;
221  class Choice : public Gecode::Choice {
222  public:
224  bool fail;
226  Choice(const Brancher& b, bool fail0)
227  : Gecode::Choice(b,1), fail(fail0) {}
229  virtual size_t size(void) const {
230  return sizeof(Choice);
231  }
233  virtual void archive(Archive& e) const {
235  e.put(fail);
236  }
237  };
239  NestedSearch(Space& home) : Brancher(home), done(false) {
240  Radiotherapy& rt = static_cast<Radiotherapy&>(home);
241  // Set up ordering of rows. As a heuristic, pre-order the rows
242  // with the potentially cheapest ones first.
243  index.init(rt.rd.m+1);
244  for (int i = rt.rd.m; i--; ) {
245  index[i].idx = i;
246  index[i].weight = 0;
247  for (int j = rt.rd.n; j--; )
248  index[i].weight += rt.rd.intensity[i*rt.rd.n + j] == 0;
249  }
250  Support::quicksort(&(index[0]), rt.rd.m);
251  for (int i = rt.rd.m; i--; )
252  index[i].weight = 0;
253  index[rt.rd.m].idx = 10;
254  // A shared object must be disposed properly
255  home.notice(*this, AP_DISPOSE);
256  }
258  NestedSearch(Space& home, bool share, NestedSearch& b)
259  : Brancher(home, share, b), done(b.done) {
260  index.update(home, share, b.index);
261  }
262  public:
263  virtual bool status(const Space&) const {
264  return !done;
265  }
266 
268  IntVarArgs ri(row->rd.n*row->rd.btMax);
269  for (int j=0; j<row->rd.n; j++) {
270  for (int b=0; b<row->rd.btMax; b++) {
271  ri[j*row->rd.btMax+b] =
272  row->q[i*row->rd.n*row->rd.btMax+j*row->rd.btMax+b];
273  }
274  }
275  return ri;
276  }
277 
278  virtual Gecode::Choice* choice(Space& home) {
279  done = true;
280  Radiotherapy& rt = static_cast<Radiotherapy&>(home);
281 
282  std::cout << "*";
283 
284  // Perform nested search for each row
285  bool fail = false;
286  for (int i=0; i<rt.rd.m; i++) {
287  // Create fresh clone for row i
288  Radiotherapy* row = static_cast<Radiotherapy*>(rt.clone());
289 
290  // Branch over row i
291  branch(*row, getRow(row, index[i].idx),
293  Search::Options o; o.clone = false;
294  if ( Radiotherapy* newSol = dfs(row, o) ) {
295  // Found a solution for row i, so try to find one for i+1
296  delete newSol;
297  std::cerr << index[i].idx;
298  } else {
299  // Found no solution for row i, so back to search the N variables
300  fail = true;
301  index[i].weight += 1;
302  if (i && index[i] < index[i-1])
303  std::swap(index[i], index[i-1]);
304  break;
305  }
306  }
307 
308  return new Choice(*this, fail);
309  }
310  virtual Choice* choice(const Space&, Archive& e) {
311  bool fail; e >> fail;
312  return new Choice(*this, fail);
313  }
314  virtual ExecStatus commit(Space&, const Gecode::Choice& _c, unsigned int) {
315  return static_cast<const Choice&>(_c).fail ? ES_FAILED : ES_OK;
316  }
318  virtual Actor* copy(Space& home, bool share) {
319  return new (home) NestedSearch(home, share, *this);
320  }
322  static void post(Home home) {
323  (void) new (home) NestedSearch(home);
324  }
326  size_t dispose(Space& home) {
327  home.ignore(*this,AP_DISPOSE);
328  // Periodic scaling of weights
329  if (!--index[index.size()-1].idx) {
330  index[index.size()-1].idx = 10;
331  for (int i = index.size()-1; i--; )
332  index[i].weight *= 0.9;
333  }
334  (void) Brancher::dispose(home);
335  (void) index.~SharedArray<Idx>();
336  return sizeof(*this);
337  }
338  };
339 
340 };
341 
345 int
346 main(int argc, char* argv[]) {
347  SizeOptions opt("Radiotherapy");
348  opt.solutions(0);
349  opt.size(0);
350  opt.parse(argc,argv);
351 
352  if (opt.size() >= rds_n) {
353  std::cerr << "Error: size must be between 0 and "
354  << rds_n-1 << std::endl;
355  return 1;
356  }
357 
358  MinimizeScript::run<Radiotherapy,BAB,SizeOptions>(opt);
359  return 0;
360 }
361 
362 namespace {
368 
369  // Small instance
370  static const int intensity0[] = {
371  7, 2, 14, 8, 9,
372  13, 4, 1, 2, 9,
373  5, 12, 2, 11, 9,
374  10, 2, 4, 9, 7,
375  10, 2, 8, 11, 1
376  };
377  RadiotherapyData rd0(5,5,intensity0);
378 
379  // Larger instance
380  static const int intensity1[] = {
381  6, 10, 6, 8, 10, 0, 4, 10, 0, 6, 2, 8, 0, 2, 0 ,
382  1, 8, 3, 1, 0, 8, 0, 3, 6, 10, 9, 8, 9, 6, 9 ,
383  8, 5, 6, 7, 7, 0, 6, 8, 2, 7, 5, 2, 0, 9, 2 ,
384  9, 2, 10, 5, 7, 1, 3, 7, 5, 1, 8, 2, 3, 10, 4 ,
385  8, 7, 4, 1, 6, 3, 0, 1, 2, 6, 4, 4, 0, 5, 0 ,
386  9, 0, 7, 4, 9, 7, 4, 1, 4, 1, 1, 9, 2, 9, 9 ,
387  3, 6, 10, 0, 6, 6, 10, 10, 7, 0, 10, 2, 10, 2, 4 ,
388  8, 9, 5, 2, 6, 1, 9, 0, 4, 2, 4, 1, 5, 1, 4 ,
389  6, 10, 0, 0, 7, 0, 0, 5, 8, 5, 10, 3, 2, 2, 10 ,
390  4, 3, 0, 6, 10, 7, 2, 7, 2, 9, 2, 8, 9, 7, 9 ,
391  10, 2, 0, 5, 5, 1, 3, 7, 1, 6, 5, 4, 2, 8, 1 ,
392  3, 6, 4, 3, 7, 10, 6, 7, 7, 6, 5, 9, 10, 8, 3 ,
393  9, 9, 5, 2, 4, 2, 3, 3, 1, 2, 9, 2, 5, 6, 3 ,
394  7, 5, 2, 6, 4, 8, 1, 0, 2, 4, 7, 9, 3, 3, 0 ,
395  5, 3, 8, 7, 10, 6, 7, 7, 6, 10, 4, 4, 5, 8, 0
396  };
397  RadiotherapyData rd1(15,15,intensity1);
398 
399  /*
400  * The following 25 clinical instances were provided by
401  * - James F. Dempsey, ViewRay, Inc.
402  * - H. Edwin Romeijn, Department of Industrial and Operations
403  * Engineering, The University of Michigan
404  * - J. Cole Smith, Department of Industrial and Systems
405  * Engineering, University of Florida
406  * - Z. Caner Taskin, Department of Industrial and Systems
407  * Engineering, University of Florida
408  * - Chunhua Men, Department of Industrial and Systems Engineering,
409  * University of Florida
410  * They are from the articles
411  * - "Mixed-Integer Programming Techniques for Decomposing IMRT
412  * Fluence Maps Using Rectangular Apertures", Z. Caner Taskin,
413  * J. Cole Smith, H. Edwin Romeijn
414  * - "Optimal Multileaf Collimator Leaf Sequencing in IMRT Treatment
415  * Planning", Z. Caner Tasin, J. Cole Smith, H. Edwin Romeijn, James
416  * F. Dempsey
417  */
418  static const int case1_beam1_matrix[] = {
419  2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
420  2, 1, 0, 0, 0, 0, 0, 0, 0, 5, 0, 3, 0, 2,
421  3, 1, 0, 0, 0, 0, 0, 0, 18, 0, 0, 4, 6, 0,
422  2, 0, 0, 3, 11, 8, 15, 1, 11, 0, 0, 0, 10, 0,
423  0, 0, 0, 9, 11, 14, 6, 2, 7, 0, 0, 0, 7, 0,
424  0, 8, 2, 7, 10, 11, 7, 2, 0, 7, 0, 0, 0, 1,
425  0, 0, 4, 1, 6, 7, 0, 0, 0, 0, 0, 0, 0, 1,
426  0, 3, 1, 0, 4, 6, 0, 0, 0, 1, 0, 0, 0, 1,
427  0, 1, 5, 6, 8, 8, 5, 0, 2, 0, 0, 0, 7, 0,
428  0, 5, 2, 8, 10, 11, 5, 3, 7, 0, 2, 4, 11, 0,
429  0, 0, 0, 1, 12, 13, 9, 7, 11, 1, 2, 3, 6, 0,
430  0, 0, 0, 0, 0, 0, 0, 4, 20, 0, 0, 8, 5, 0,
431  3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 6, 7, 0, 2,
432  2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
433  1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 2, 1
434  };
435  RadiotherapyData case1_beam1(15, 14, case1_beam1_matrix);
436 
437  static const int case1_beam2_matrix[] = {
438  2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 4, 3, 4, 0, 2,
439  2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 2, 0, 1,
440  3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 3,
441  0, 0, 0, 5, 5, 3, 0, 0, 3, 2, 8, 6, 0, 0, 3,
442  0, 0, 7, 11, 10, 11, 5, 8, 4, 11, 13, 20, 0, 0, 3,
443  0, 10, 10, 9, 7, 7, 7, 2, 9, 0, 0, 0, 9, 0, 2,
444  0, 4, 7, 7, 5, 6, 2, 0, 4, 0, 0, 0, 3, 0, 2,
445  0, 10, 2, 7, 1, 2, 0, 0, 0, 0, 0, 0, 0, 3, 1,
446  0, 0, 5, 6, 3, 1, 0, 6, 8, 0, 0, 0, 0, 1, 2,
447  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 2,
448  0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2
449  };
450  RadiotherapyData case1_beam2(11, 15, case1_beam2_matrix);
451 
452  static const int case1_beam3_matrix[] = {
453  2, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 1,
454  1, 2, 0, 0, 0, 0, 0, 0, 4, 4, 0, 0, 1, 2, 2,
455  1, 3, 0, 0, 0, 0, 0, 0, 0, 6, 4, 1, 12, 0, 2,
456  2, 0, 0, 0, 0, 0, 0, 0, 0, 11, 6, 1, 9, 0, 2,
457  2, 0, 0, 0, 0, 0, 0, 0, 2, 11, 0, 0, 0, 2, 1,
458  0, 0, 0, 0, 0, 1, 0, 4, 0, 0, 0, 0, 0, 1, 1,
459  0, 3, 0, 2, 6, 7, 6, 6, 4, 0, 0, 0, 0, 0, 2,
460  0, 0, 10, 12, 11, 10, 13, 13, 12, 5, 0, 0, 0, 0, 2,
461  0, 0, 11, 12, 10, 10, 14, 15, 15, 5, 2, 7, 12, 0, 2,
462  0, 9, 5, 9, 7, 6, 12, 16, 13, 8, 5, 7, 7, 0, 2,
463  2, 0, 0, 0, 0, 0, 4, 20, 12, 8, 1, 6, 8, 0, 2,
464  0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 7, 0, 2,
465  0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
466  2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 1,
467  0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, 1
468  };
469  RadiotherapyData case1_beam3(15, 15, case1_beam3_matrix);
470 
471  static const int case1_beam4_matrix[] = {
472  3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, 2,
473  0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2,
474  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2,
475  0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 13, 0, 4, 0, 2,
476  0, 6, 5, 5, 8, 9, 11, 20, 8, 9, 18, 10, 7, 0, 2,
477  0, 3, 10, 9, 12, 11, 15, 15, 11, 11, 16, 15, 3, 0, 3,
478  0, 5, 7, 12, 14, 11, 15, 15, 13, 10, 15, 10, 5, 0, 3,
479  0, 5, 1, 9, 11, 9, 13, 9, 12, 6, 3, 0, 0, 0, 2,
480  0, 0, 0, 0, 4, 2, 4, 0, 7, 0, 0, 0, 0, 0, 2,
481  2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
482  2, 0, 0, 1, 7, 4, 0, 0, 0, 10, 10, 4, 0, 1, 1,
483  2, 2, 0, 0, 0, 0, 0, 4, 0, 14, 14, 9, 0, 0, 1,
484  2, 2, 0, 0, 0, 0, 0, 0, 0, 12, 16, 5, 1, 0, 2,
485  2, 2, 0, 0, 0, 0, 0, 0, 1, 10, 12, 6, 3, 0, 2,
486  1, 3, 0, 0, 0, 0, 0, 0, 2, 12, 15, 3, 0, 1, 2
487  };
488  RadiotherapyData case1_beam4(15, 15, case1_beam4_matrix);
489 
490  static const int case1_beam5_matrix[] = {
491  3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 2,
492  0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2,
493  0, 0, 6, 4, 3, 1, 0, 0, 7, 0, 0, 0, 0, 3, 2,
494  0, 13, 6, 1, 1, 1, 5, 0, 2, 0, 0, 0, 0, 1, 2,
495  0, 2, 12, 5, 4, 2, 2, 0, 1, 20, 11, 11, 5, 0, 2,
496  0, 9, 12, 7, 3, 2, 7, 3, 5, 14, 12, 13, 11, 0, 2,
497  0, 5, 11, 13, 6, 6, 5, 5, 5, 15, 11, 13, 12, 0, 2,
498  0, 0, 0, 1, 4, 5, 0, 0, 0, 7, 9, 9, 8, 0, 2,
499  4, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 4, 5, 0, 2,
500  2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
501  2, 2, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 9, 0, 3
502  };
503  RadiotherapyData case1_beam5(11, 15, case1_beam5_matrix);
504 
505  static const int case2_beam1_matrix[] = {
506  1, 1, 1, 4, 1, 0, 1, 5, 2, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 2,
507  1, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
508  1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 2, 7, 2, 1,
509  1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 12, 12, 5, 8, 5, 3, 0,
510  2, 1, 3, 0, 0, 0, 0, 0, 4, 20, 10, 1, 0, 8, 7, 8, 6, 7, 2, 1,
511  1, 3, 1, 0, 3, 1, 13, 18, 14, 10, 5, 0, 3, 7, 7, 7, 6, 7, 2, 0,
512  2, 0, 0, 0, 3, 1, 9, 8, 8, 6, 2, 3, 4, 5, 11, 10, 9, 10, 3, 0,
513  2, 0, 0, 0, 1, 1, 7, 8, 5, 4, 1, 1, 0, 4, 3, 1, 0, 0, 0, 2,
514  2, 0, 0, 1, 0, 0, 4, 5, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
515  2, 0, 0, 4, 2, 0, 2, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
516  3, 0, 5, 6, 3, 1, 2, 5, 3, 1, 3, 0, 1, 0, 4, 5, 5, 9, 0, 1,
517  1, 0, 2, 8, 3, 2, 3, 6, 5, 3, 4, 6, 4, 5, 10, 11, 8, 10, 4, 0,
518  0, 0, 0, 8, 5, 4, 5, 8, 5, 7, 6, 5, 3, 5, 8, 7, 7, 10, 2, 0,
519  3, 0, 9, 11, 5, 5, 6, 11, 7, 6, 6, 6, 4, 6, 8, 7, 7, 9, 2, 0,
520  2, 0, 11, 11, 5, 6, 7, 9, 9, 6, 8, 5, 4, 6, 10, 6, 7, 7, 2, 0,
521  2, 0, 6, 11, 4, 3, 1, 0, 0, 0, 0, 4, 7, 6, 2, 0, 0, 3, 0, 2,
522  1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
523  1, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 2
524  };
525  RadiotherapyData case2_beam1(18, 20, case2_beam1_matrix);
526 
527  static const int case2_beam2_matrix[] = {
528  2, 3, 2, 1, 5, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 3,
529  3, 3, 3, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
530  3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 3, 2,
531  3, 3, 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 8, 5, 1,
532  2, 3, 1, 0, 0, 0, 0, 1, 0, 0, 5, 6, 5, 5, 1, 2, 6, 2, 1,
533  2, 2, 2, 0, 0, 0, 0, 8, 0, 4, 2, 5, 2, 7, 5, 1, 4, 2, 1,
534  2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 0, 0, 3, 4, 7, 4, 0,
535  3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 6, 6, 7, 5, 7, 8, 7, 0,
536  2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 7, 10, 7, 2, 3, 5, 12, 6, 0,
537  4, 0, 0, 0, 0, 6, 5, 6, 4, 8, 10, 12, 9, 7, 1, 6, 6, 6, 0,
538  0, 0, 0, 18, 18, 3, 3, 4, 6, 9, 12, 12, 7, 5, 0, 0, 0, 0, 2,
539  0, 0, 0, 20, 11, 0, 1, 4, 5, 10, 10, 8, 6, 1, 6, 3, 4, 1, 3,
540  0, 0, 0, 16, 11, 0, 3, 2, 7, 11, 10, 13, 7, 2, 2, 0, 0, 0, 2,
541  3, 0, 0, 14, 10, 1, 5, 2, 8, 15, 9, 9, 13, 5, 0, 0, 0, 0, 3,
542  2, 0, 0, 16, 9, 5, 5, 4, 7, 18, 0, 0, 0, 0, 0, 0, 0, 1, 2,
543  2, 0, 0, 15, 10, 7, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2,
544  2, 0, 0, 0, 18, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2
545  };
546  RadiotherapyData case2_beam2(17, 19, case2_beam2_matrix);
547 
548  static const int case2_beam3_matrix[] = {
549  1, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
550  1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
551  1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 4, 3, 2, 6, 2, 2,
552  1, 0, 0, 0, 0, 0, 0, 4, 2, 10, 11, 12, 7, 7, 4, 0, 4, 1,
553  2, 0, 0, 0, 0, 0, 0, 4, 6, 9, 10, 12, 6, 5, 4, 4, 3, 2,
554  2, 0, 0, 0, 0, 14, 0, 7, 2, 9, 8, 8, 3, 6, 4, 4, 2, 2,
555  3, 0, 0, 0, 10, 11, 0, 0, 1, 7, 4, 2, 2, 0, 0, 0, 2, 2,
556  0, 0, 0, 1, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
557  0, 0, 0, 0, 4, 1, 1, 0, 2, 2, 0, 0, 2, 0, 3, 0, 1, 2,
558  0, 0, 0, 0, 5, 5, 7, 7, 8, 9, 5, 8, 1, 1, 0, 0, 0, 3,
559  0, 0, 8, 0, 10, 10, 12, 15, 16, 10, 7, 6, 0, 3, 0, 0, 0, 3,
560  0, 0, 20, 4, 12, 12, 11, 19, 17, 17, 11, 9, 12, 12, 11, 13, 3, 1,
561  0, 0, 0, 11, 8, 10, 11, 15, 18, 12, 5, 3, 6, 8, 11, 12, 9, 0,
562  1, 0, 0, 6, 10, 1, 3, 17, 17, 13, 5, 1, 4, 16, 8, 15, 3, 1,
563  2, 0, 0, 8, 0, 0, 0, 0, 0, 11, 6, 0, 6, 0, 0, 0, 0, 3,
564  2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2,
565  2, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2,
566  2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2
567  };
568  RadiotherapyData case2_beam3(18, 18, case2_beam3_matrix);
569 
570  static const int case2_beam4_matrix[] = {
571  3, 0, 5, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 2, 2,
572  0, 0, 5, 2, 2, 0, 7, 3, 3, 0, 0, 0, 0, 0, 0, 3, 1, 2,
573  0, 0, 0, 4, 3, 0, 8, 11, 9, 4, 0, 2, 0, 0, 0, 0, 4, 1,
574  0, 0, 9, 5, 5, 2, 12, 13, 10, 7, 3, 1, 4, 0, 0, 0, 0, 3,
575  0, 16, 9, 4, 10, 7, 15, 16, 8, 5, 6, 4, 7, 10, 0, 11, 0, 2,
576  0, 0, 12, 6, 12, 12, 18, 18, 14, 9, 7, 7, 8, 12, 13, 12, 10, 0,
577  0, 0, 0, 8, 13, 15, 18, 20, 12, 13, 12, 12, 12, 13, 11, 10, 8, 0,
578  0, 0, 0, 3, 5, 14, 17, 16, 11, 8, 4, 10, 12, 11, 14, 9, 1, 3,
579  0, 0, 0, 0, 0, 3, 14, 8, 5, 4, 5, 9, 4, 0, 0, 0, 0, 3,
580  4, 3, 0, 0, 1, 0, 8, 3, 3, 0, 0, 0, 0, 0, 2, 0, 0, 3,
581  1, 7, 0, 0, 1, 2, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
582  3, 4, 5, 0, 0, 0, 0, 0, 0, 0, 5, 1, 4, 1, 4, 0, 0, 2,
583  2, 5, 4, 0, 0, 0, 0, 0, 0, 0, 8, 10, 7, 0, 6, 1, 4, 1,
584  2, 4, 4, 0, 0, 0, 0, 0, 0, 4, 5, 5, 6, 1, 6, 6, 2, 2,
585  2, 4, 3, 2, 0, 0, 0, 0, 4, 3, 12, 2, 1, 7, 3, 4, 2, 2,
586  2, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 3, 7, 3, 12, 5, 5, 1,
587  2, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 2, 2,
588  3, 3, 5, 0, 3, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 3
589  };
590  RadiotherapyData case2_beam4(18, 18, case2_beam4_matrix);
591 
592  static const int case2_beam5_matrix[] = {
593  0, 0, 0, 15, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2,
594  0, 0, 2, 10, 16, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 2,
595  0, 0, 6, 9, 15, 3, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 3,
596  2, 4, 9, 12, 15, 3, 4, 0, 3, 0, 2, 17, 13, 0, 0, 0, 2, 3,
597  0, 5, 12, 14, 17, 5, 2, 0, 0, 8, 17, 16, 13, 4, 0, 0, 0, 3,
598  0, 6, 13, 16, 17, 5, 2, 2, 4, 5, 12, 10, 10, 13, 6, 0, 0, 3,
599  0, 0, 20, 17, 18, 8, 4, 5, 6, 10, 14, 13, 11, 2, 1, 4, 0, 3,
600  0, 0, 0, 14, 18, 11, 8, 9, 9, 10, 13, 12, 8, 8, 5, 6, 5, 0,
601  0, 0, 0, 2, 11, 10, 6, 3, 1, 6, 10, 11, 5, 8, 9, 8, 9, 0,
602  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 7, 3, 10, 4, 5, 3, 1,
603  0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 6, 6, 2, 2, 2, 2, 1,
604  0, 0, 0, 0, 0, 0, 1, 0, 3, 3, 4, 3, 4, 1, 0, 0, 2, 0,
605  0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 1, 0, 0, 0, 0, 4, 1, 2,
606  2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 0, 0, 0, 0, 8, 3, 1,
607  1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, 0, 2,
608  1, 3, 5, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
609  1, 2, 1, 4, 8, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2
610  };
611  RadiotherapyData case2_beam5(17, 18, case2_beam5_matrix);
612 
613  static const int case3_beam1_matrix[] = {
614  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0,
615  0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 13, 8, 8, 1, 0, 0, 0,
616  1, 2, 0, 0, 0, 0, 0, 0, 11, 9, 5, 5, 4, 5, 0, 2, 0,
617  1, 0, 0, 0, 0, 0, 8, 13, 9, 6, 4, 4, 4, 8, 0, 2, 0,
618  0, 2, 17, 10, 13, 14, 10, 8, 7, 6, 4, 4, 5, 8, 0, 2, 0,
619  0, 12, 20, 9, 14, 15, 7, 2, 5, 5, 5, 3, 4, 9, 0, 1, 1,
620  0, 17, 13, 10, 15, 16, 5, 1, 5, 7, 5, 6, 4, 8, 0, 2, 1,
621  1, 0, 15, 9, 15, 20, 6, 1, 4, 7, 7, 6, 5, 9, 7, 1, 1,
622  0, 0, 2, 7, 16, 9, 5, 0, 3, 7, 5, 5, 4, 7, 4, 5, 0,
623  0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 4, 4, 2, 6, 5, 4, 0,
624  0, 0, 0, 0, 0, 0, 0, 0, 1, 6, 3, 3, 3, 6, 5, 4, 0,
625  0, 0, 0, 5, 7, 5, 8, 0, 2, 7, 5, 4, 5, 7, 4, 5, 0,
626  0, 4, 9, 8, 16, 19, 5, 1, 3, 7, 6, 5, 6, 9, 6, 1, 1,
627  0, 13, 12, 8, 14, 14, 4, 2, 0, 8, 4, 5, 5, 8, 2, 0, 2,
628  0, 20, 11, 7, 14, 15, 3, 0, 0, 6, 3, 3, 5, 9, 0, 1, 1,
629  0, 6, 17, 4, 14, 14, 6, 1, 1, 5, 2, 3, 5, 7, 0, 1, 0,
630  0, 0, 0, 11, 6, 13, 7, 2, 2, 5, 2, 4, 3, 6, 0, 2, 0,
631  1, 0, 0, 0, 6, 0, 8, 2, 3, 5, 3, 7, 4, 7, 0, 0, 0,
632  0, 0, 0, 0, 0, 0, 6, 0, 4, 4, 7, 10, 4, 0, 0, 0, 0,
633  0, 0, 0, 0, 0, 0, 0, 0, 2, 8, 5, 0, 10, 0, 1, 0, 0,
634  0, 0, 0, 0, 0, 0, 0, 0, 6, 2, 0, 0, 0, 0, 1, 0, 0,
635  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0
636  };
637  RadiotherapyData case3_beam1(22, 17, case3_beam1_matrix);
638 
639  static const int case3_beam2_matrix[] = {
640  0, 0, 1, 1, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
641  0, 0, 8, 0, 1, 4, 5, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0,
642  2, 0, 0, 0, 3, 2, 2, 1, 1, 0, 0, 1, 4, 7, 11, 9, 0, 0, 0,
643  2, 0, 0, 0, 3, 2, 2, 0, 2, 4, 1, 4, 7, 11, 10, 20, 1, 0, 0,
644  3, 0, 2, 0, 2, 2, 2, 1, 7, 8, 5, 9, 13, 16, 13, 14, 12, 0, 0,
645  2, 0, 1, 0, 3, 2, 4, 5, 15, 16, 12, 11, 15, 17, 15, 14, 9, 0, 3,
646  2, 0, 11, 0, 6, 3, 0, 5, 17, 16, 10, 10, 13, 17, 13, 14, 7, 1, 3,
647  2, 0, 5, 0, 8, 1, 0, 2, 16, 16, 9, 8, 10, 14, 12, 13, 12, 0, 3,
648  0, 0, 0, 2, 8, 1, 0, 7, 15, 17, 7, 8, 10, 12, 9, 12, 5, 1, 0,
649  0, 0, 0, 0, 5, 0, 2, 7, 15, 13, 5, 4, 9, 7, 4, 0, 0, 2, 0,
650  0, 0, 0, 0, 4, 0, 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
651  0, 0, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
652  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
653  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
654  0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
655  };
656  RadiotherapyData case3_beam2(15, 19, case3_beam2_matrix);
657 
658  static const int case3_beam3_matrix[] = {
659  0, 0, 0, 0, 0, 0, 0, 0, 15, 8, 10, 0, 0, 0, 0, 0, 0,
660  0, 0, 0, 0, 0, 0, 0, 15, 10, 7, 10, 7, 18, 0, 0, 0, 0,
661  0, 3, 5, 5, 3, 0, 7, 8, 12, 9, 12, 11, 20, 0, 0, 0, 0,
662  0, 0, 0, 4, 5, 2, 6, 5, 12, 9, 12, 12, 14, 3, 0, 1, 0,
663  0, 0, 0, 7, 2, 4, 7, 9, 11, 9, 10, 10, 7, 5, 0, 0, 0,
664  0, 0, 1, 7, 1, 2, 7, 8, 10, 4, 5, 1, 0, 0, 0, 0, 0,
665  0, 0, 0, 3, 0, 3, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0,
666  0, 7, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0,
667  3, 2, 4, 0, 0, 0, 0, 0, 0, 0, 2, 4, 4, 7, 10, 8, 0,
668  0, 0, 4, 4, 0, 0, 0, 9, 6, 7, 7, 10, 6, 13, 8, 10, 0,
669  0, 6, 12, 12, 0, 0, 0, 15, 9, 11, 15, 16, 15, 17, 4, 17, 0,
670  0, 5, 14, 12, 5, 0, 9, 18, 15, 18, 19, 18, 16, 17, 6, 14, 0,
671  0, 14, 7, 13, 3, 2, 16, 17, 13, 17, 17, 16, 17, 12, 8, 12, 0,
672  0, 4, 14, 8, 5, 1, 10, 12, 7, 19, 17, 18, 15, 13, 0, 0, 3,
673  0, 0, 6, 10, 0, 0, 0, 4, 5, 16, 17, 16, 13, 15, 2, 0, 3,
674  0, 0, 0, 0, 0, 0, 0, 0, 5, 17, 15, 16, 12, 15, 2, 2, 0,
675  1, 0, 0, 0, 0, 0, 2, 2, 0, 7, 15, 9, 11, 13, 7, 1, 0,
676  0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 15, 0, 3, 0,
677  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 1, 2, 0,
678  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0
679  };
680  RadiotherapyData case3_beam3(20, 17, case3_beam3_matrix);
681 
682  static const int case3_beam4_matrix[] = {
683  0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 1, 0, 0,
684  0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 3, 0,
685  0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 12, 0, 3, 0,
686  2, 0, 0, 0, 0, 0, 2, 0, 10, 9, 20, 0, 0, 15, 0, 3, 0,
687  0, 0, 0, 14, 0, 0, 0, 3, 7, 11, 16, 16, 6, 16, 2, 2, 0,
688  0, 0, 10, 9, 5, 0, 0, 16, 7, 10, 17, 16, 13, 11, 12, 0, 0,
689  0, 9, 10, 10, 5, 2, 11, 9, 9, 12, 16, 18, 12, 13, 3, 0, 3,
690  0, 5, 11, 10, 6, 4, 10, 15, 10, 13, 17, 18, 16, 5, 11, 0, 2,
691  0, 1, 13, 11, 7, 2, 19, 12, 14, 12, 16, 18, 16, 12, 7, 11, 0,
692  0, 0, 14, 6, 7, 0, 0, 11, 13, 13, 17, 16, 16, 11, 7, 11, 0,
693  0, 0, 5, 0, 0, 0, 0, 7, 4, 8, 11, 12, 12, 10, 7, 9, 0,
694  2, 0, 0, 0, 0, 0, 0, 1, 2, 2, 5, 5, 7, 7, 8, 1, 1,
695  3, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 6, 5, 11, 0, 2,
696  0, 6, 3, 2, 2, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0,
697  0, 0, 0, 0, 4, 4, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0,
698  0, 0, 0, 0, 4, 6, 2, 9, 12, 6, 5, 5, 5, 0, 0, 0, 1,
699  0, 0, 0, 4, 2, 4, 0, 7, 10, 8, 10, 10, 5, 0, 0, 1, 0,
700  1, 0, 0, 3, 0, 0, 0, 0, 6, 5, 11, 9, 11, 0, 0, 0, 0,
701  0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 10, 13, 13, 0, 0, 0, 0
702  };
703  RadiotherapyData case3_beam4(19, 17, case3_beam4_matrix);
704 
705  static const int case3_beam5_matrix[] = {
706  0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
707  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
708  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
709  0, 0, 7, 1, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0,
710  0, 0, 0, 0, 0, 0, 1, 15, 0, 0, 0, 0, 4, 5, 0, 0, 0, 3, 0,
711  0, 0, 0, 0, 1, 0, 0, 13, 2, 0, 5, 9, 9, 9, 1, 7, 0, 3, 0,
712  1, 0, 1, 2, 5, 0, 0, 3, 5, 0, 8, 10, 9, 12, 10, 17, 4, 2, 0,
713  3, 0, 0, 0, 5, 1, 0, 8, 9, 2, 10, 13, 12, 14, 12, 14, 10, 1, 3,
714  3, 0, 0, 0, 3, 2, 2, 11, 11, 8, 14, 15, 16, 17, 15, 15, 5, 2, 3,
715  3, 0, 2, 2, 2, 1, 3, 9, 8, 7, 7, 15, 13, 19, 18, 13, 15, 1, 0,
716  3, 0, 0, 2, 0, 2, 2, 6, 1, 3, 1, 7, 9, 12, 11, 19, 0, 0, 0,
717  3, 0, 0, 4, 0, 2, 3, 2, 1, 1, 0, 3, 4, 7, 20, 0, 0, 0, 0,
718  3, 0, 16, 0, 3, 0, 3, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
719  4, 0, 16, 3, 4, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
720  0, 1, 0, 0, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
721  };
722  RadiotherapyData case3_beam5(15, 19, case3_beam5_matrix);
723 
724  static const int case4_beam1_matrix[] = {
725  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0,
726  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 5, 8, 10, 0, 0, 0, 0, 2,
727  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 2, 9, 2, 0, 2, 1, 2,
728  0, 0, 0, 0, 0, 0, 0, 10, 17, 12, 0, 7, 5, 0, 0, 1, 6, 7, 4, 4, 3, 1,
729  2, 0, 0, 0, 20, 0, 0, 0, 0, 0, 2, 1, 3, 1, 1, 1, 6, 7, 6, 4, 0, 1,
730  2, 1, 0, 8, 6, 0, 0, 0, 0, 0, 0, 2, 3, 2, 2, 1, 6, 7, 7, 7, 0, 0,
731  2, 0, 11, 5, 2, 4, 6, 0, 0, 3, 4, 2, 6, 1, 2, 1, 8, 5, 8, 8, 2, 0,
732  1, 0, 1, 1, 0, 0, 2, 4, 7, 2, 0, 1, 3, 1, 5, 0, 11, 4, 7, 9, 2, 0,
733  0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 6, 1, 10, 3, 7, 8, 3, 0,
734  1, 0, 0, 0, 0, 0, 3, 5, 8, 0, 1, 1, 2, 1, 7, 1, 11, 3, 6, 8, 4, 0,
735  1, 0, 7, 4, 2, 6, 6, 0, 6, 3, 2, 4, 7, 6, 10, 2, 11, 3, 6, 7, 4, 0,
736  0, 8, 16, 13, 0, 0, 0, 0, 0, 0, 2, 3, 6, 6, 7, 3, 10, 3, 5, 7, 4, 0,
737  2, 0, 0, 0, 16, 0, 0, 0, 0, 0, 3, 2, 4, 7, 9, 4, 9, 3, 5, 6, 4, 0,
738  0, 0, 0, 0, 0, 0, 0, 12, 6, 8, 5, 4, 5, 8, 6, 3, 8, 3, 5, 6, 3, 0,
739  0, 0, 0, 0, 0, 0, 0, 14, 15, 10, 0, 3, 9, 8, 4, 2, 7, 3, 4, 5, 1, 0,
740  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 11, 4, 2, 7, 2, 4, 5, 0, 2,
741  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 4, 1, 8, 2, 3, 2, 2, 2,
742  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 12, 5, 0, 0, 0, 0, 0, 2,
743  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 0, 0, 0
744  };
745  RadiotherapyData case4_beam1(19, 22, case4_beam1_matrix);
746 
747  static const int case4_beam2_matrix[] = {
748  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
749  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 3, 2, 9, 17, 10, 11, 6, 0, 0, 5, 0,
750  0, 0, 0, 0, 0, 0, 7, 6, 0, 0, 0, 0, 1, 2, 7, 14, 16, 14, 16, 7, 5, 5, 0, 4,
751  0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 5, 10, 16, 20, 12, 17, 8, 13, 13, 0, 4,
752  0, 3, 7, 2, 0, 5, 5, 0, 6, 2, 0, 0, 3, 12, 16, 17, 17, 10, 19, 9, 11, 13, 0, 4,
753  3, 0, 19, 9, 11, 10, 3, 2, 0, 7, 7, 13, 20, 14, 17, 15, 18, 7, 18, 11, 11, 15, 0, 4,
754  0, 3, 4, 9, 10, 9, 0, 2, 0, 2, 0, 13, 13, 13, 14, 14, 17, 4, 17, 11, 11, 16, 0, 4,
755  0, 1, 0, 0, 0, 6, 0, 0, 1, 1, 0, 5, 13, 9, 11, 9, 12, 5, 14, 11, 10, 18, 0, 4,
756  0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 10, 9, 8, 7, 12, 2, 13, 10, 11, 17, 0, 4,
757  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 8, 2, 0, 4, 13, 8, 12, 19, 0, 4,
758  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 3, 0, 0, 0, 0, 5, 8, 15, 0, 2, 0,
759  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 5, 0,
760  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 3, 0, 0
761  };
762  RadiotherapyData case4_beam2(13, 24, case4_beam2_matrix);
763 
764  static const int case4_beam3_matrix[] = {
765  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0,
766  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 4, 0, 0, 0, 0, 0, 0, 0,
767  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 3, 2, 0, 0, 0, 0, 0, 0, 0,
768  0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 5, 4, 3, 0, 0, 0, 0, 0, 0, 1, 0,
769  0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 4, 4, 6, 3, 1, 0, 0, 5, 5, 0, 0, 1, 0,
770  1, 0, 0, 0, 11, 0, 9, 8, 5, 6, 3, 5, 6, 2, 0, 0, 1, 3, 4, 7, 0, 0, 0,
771  2, 2, 0, 0, 7, 11, 0, 6, 8, 5, 6, 2, 3, 0, 0, 0, 2, 1, 5, 3, 3, 0, 0,
772  1, 2, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 3, 1, 3, 2, 2, 0, 0,
773  1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 5, 7, 2, 0, 3, 1, 2, 0, 0,
774  1, 0, 6, 2, 4, 7, 3, 0, 0, 0, 3, 4, 6, 8, 6, 6, 4, 0, 2, 1, 3, 0, 2,
775  0, 7, 6, 7, 7, 13, 14, 9, 10, 6, 6, 8, 8, 9, 8, 6, 5, 0, 2, 0, 2, 0, 2,
776  0, 7, 8, 8, 8, 12, 12, 14, 10, 8, 7, 8, 7, 7, 7, 5, 6, 0, 1, 0, 2, 0, 2,
777  0, 0, 0, 1, 7, 20, 13, 8, 17, 11, 6, 6, 5, 6, 9, 7, 7, 0, 1, 0, 3, 0, 2,
778  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 6, 5, 6, 7, 8, 8, 0, 1, 1, 4, 0, 2,
779  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 8, 0, 3, 2, 4, 0, 2,
780  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 4, 4, 5, 0, 0,
781  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0,
782  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0
783  };
784  RadiotherapyData case4_beam3(18, 23, case4_beam3_matrix);
785 
786  static const int case4_beam4_matrix[] = {
787  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 7, 1, 2, 0, 0,
788  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 6, 0, 5, 0, 3, 1, 3, 1, 0,
789  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 7, 8, 10, 0, 2, 1, 4, 0, 0,
790  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 8, 9, 8, 1, 2, 1, 4, 0, 2,
791  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 7, 6, 4, 9, 9, 7, 0, 2, 2, 3, 0, 0,
792  0, 0, 0, 0, 3, 17, 8, 9, 15, 14, 6, 10, 5, 5, 7, 5, 5, 1, 2, 3, 3, 0, 2,
793  0, 0, 2, 7, 12, 20, 19, 16, 12, 12, 12, 9, 8, 8, 5, 2, 5, 0, 2, 3, 4, 0, 3,
794  0, 12, 10, 13, 9, 15, 15, 11, 11, 14, 8, 10, 10, 10, 5, 4, 3, 0, 2, 4, 4, 0, 0,
795  0, 2, 13, 4, 6, 12, 10, 6, 4, 7, 5, 6, 8, 8, 5, 4, 2, 0, 3, 3, 4, 0, 0,
796  1, 0, 4, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 2, 5, 3, 1, 0, 3, 3, 2, 0, 0,
797  2, 1, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 2, 0, 4, 4, 0, 0, 0,
798  2, 3, 0, 0, 13, 0, 2, 9, 0, 8, 7, 8, 2, 0, 0, 0, 4, 2, 6, 4, 4, 0, 0,
799  0, 0, 0, 0, 0, 0, 4, 7, 1, 3, 7, 9, 7, 4, 0, 0, 1, 7, 5, 5, 0, 1, 0,
800  0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 9, 7, 8, 7, 1, 0, 0, 0, 0, 0, 0, 1, 0,
801  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 11, 2, 0, 0, 0, 0, 0, 0, 0, 0,
802  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 9, 6, 0, 0, 0, 0, 0, 0, 0,
803  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 7, 0, 0, 0, 0, 0, 0, 0
804  };
805  RadiotherapyData case4_beam4(17, 23, case4_beam4_matrix);
806 
807  static const int case4_beam5_matrix[] = {
808  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 3, 0, 0, 0, 1, 4, 0, 0,
809  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0,
810  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 8, 6, 0, 0, 0, 6, 2, 10, 0, 3, 0, 0,
811  3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 7, 9, 5, 6, 0, 12, 10, 7, 15, 0, 3, 0,
812  4, 0, 0, 0, 12, 0, 0, 0, 0, 9, 7, 10, 4, 4, 0, 8, 0, 15, 12, 10, 11, 0, 3, 0,
813  2, 0, 5, 12, 8, 0, 0, 9, 6, 14, 14, 8, 10, 8, 5, 5, 3, 18, 13, 12, 15, 0, 4, 0,
814  0, 19, 19, 15, 19, 1, 0, 17, 10, 14, 15, 13, 12, 9, 5, 8, 5, 20, 13, 13, 13, 0, 4, 1,
815  3, 3, 14, 0, 10, 0, 15, 8, 5, 9, 2, 5, 10, 11, 5, 9, 7, 20, 15, 11, 11, 0, 4, 0,
816  5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 8, 14, 9, 18, 11, 10, 11, 0, 4, 0,
817  0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 1, 0, 3, 4, 11, 12, 12, 13, 8, 11, 0, 4, 0,
818  0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 4, 0, 2, 0, 2, 10, 9, 13, 6, 0, 0, 2, 3, 0,
819  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 6, 4, 0, 0, 0, 0, 4, 0, 0
820  };
821  RadiotherapyData case4_beam5(12, 24, case4_beam5_matrix);
822 
823  static const int case5_beam1_matrix[] = {
824  1, 2, 1, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2,
825  1, 2, 0, 0, 0, 0, 0, 0, 0, 4, 0, 11, 0, 0, 0, 1,
826  1, 2, 0, 0, 0, 0, 0, 0, 1, 9, 8, 1, 8, 4, 5, 0,
827  1, 2, 0, 0, 5, 0, 4, 4, 1, 7, 4, 5, 5, 5, 4, 0,
828  0, 1, 0, 8, 2, 2, 1, 1, 0, 0, 0, 0, 2, 5, 1, 1,
829  0, 0, 2, 2, 4, 4, 4, 2, 0, 0, 0, 0, 0, 6, 3, 1,
830  0, 1, 3, 2, 3, 5, 4, 1, 2, 2, 4, 2, 2, 6, 4, 1,
831  0, 0, 0, 0, 1, 0, 0, 1, 0, 2, 4, 2, 0, 0, 0, 1,
832  0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 0, 0, 0, 0, 1,
833  0, 0, 1, 3, 3, 0, 2, 2, 1, 3, 6, 0, 0, 0, 0, 1,
834  0, 3, 2, 4, 7, 5, 2, 4, 4, 8, 0, 0, 2, 10, 3, 1,
835  0, 3, 3, 7, 9, 7, 4, 3, 0, 0, 0, 0, 0, 6, 4, 0,
836  2, 0, 1, 7, 0, 0, 0, 4, 0, 0, 0, 5, 0, 8, 3, 1,
837  2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 6, 0, 2, 1, 1,
838  2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2
839  };
840  RadiotherapyData case5_beam1(15, 16, case5_beam1_matrix);
841 
842  static const int case5_beam2_matrix[] = {
843  2, 2, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 1, 2,
844  2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
845  2, 3, 4, 0, 0, 0, 0, 5, 5, 5, 0, 0, 5, 0, 1, 0, 1,
846  2, 2, 4, 0, 0, 0, 0, 0, 2, 2, 3, 0, 3, 0, 1, 5, 0,
847  2, 2, 2, 0, 0, 0, 0, 0, 0, 8, 4, 0, 2, 2, 3, 8, 0,
848  3, 1, 1, 0, 0, 0, 3, 1, 2, 13, 14, 13, 4, 10, 2, 16, 0,
849  3, 2, 0, 0, 0, 0, 0, 0, 9, 19, 16, 6, 8, 18, 2, 9, 0,
850  3, 0, 0, 8, 8, 1, 6, 7, 6, 20, 8, 0, 0, 0, 0, 1, 2,
851  4, 2, 2, 17, 2, 0, 0, 0, 3, 13, 0, 1, 0, 1, 4, 0, 2,
852  2, 6, 0, 8, 0, 0, 3, 0, 2, 0, 0, 0, 0, 0, 0, 0, 1,
853  0, 0, 5, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
854  0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
855  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2
856  };
857  RadiotherapyData case5_beam2(13, 17, case5_beam2_matrix);
858 
859  static const int case5_beam3_matrix[] = {
860  1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
861  1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 5, 4, 1,
862  1, 2, 0, 0, 0, 0, 0, 0, 0, 10, 11, 5, 10, 3, 4, 1,
863  1, 2, 1, 2, 0, 0, 0, 3, 0, 0, 11, 5, 4, 0, 2, 0,
864  2, 1, 0, 9, 0, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 1,
865  1, 3, 3, 0, 0, 4, 1, 0, 0, 0, 0, 0, 0, 0, 0, 2,
866  3, 0, 0, 4, 8, 6, 2, 7, 6, 9, 0, 0, 0, 0, 0, 2,
867  0, 0, 0, 12, 13, 11, 9, 12, 10, 7, 9, 5, 3, 10, 4, 0,
868  0, 0, 10, 14, 13, 10, 12, 15, 9, 11, 12, 8, 7, 8, 9, 0,
869  2, 0, 7, 13, 12, 12, 11, 14, 10, 10, 10, 1, 6, 7, 8, 0,
870  0, 1, 0, 9, 19, 11, 18, 14, 8, 0, 0, 0, 0, 7, 0, 0,
871  0, 0, 0, 0, 8, 20, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2,
872  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 2,
873  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 2, 2, 1, 2
874  };
875  RadiotherapyData case5_beam3(14, 16, case5_beam3_matrix);
876 
877  static const int case5_beam4_matrix[] = {
878  0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
879  0, 1, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
880  0, 0, 11, 5, 3, 3, 12, 10, 20, 1, 0, 4, 6, 2, 6, 0,
881  1, 0, 9, 7, 7, 10, 11, 8, 8, 18, 12, 8, 6, 4, 8, 0,
882  0, 0, 9, 10, 9, 10, 12, 7, 9, 7, 6, 9, 5, 5, 6, 0,
883  0, 0, 0, 6, 11, 7, 8, 7, 4, 10, 6, 9, 1, 0, 5, 1,
884  3, 1, 0, 0, 5, 1, 3, 2, 0, 0, 0, 0, 0, 0, 0, 2,
885  1, 3, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1,
886  1, 2, 0, 0, 2, 0, 2, 0, 0, 3, 0, 1, 3, 0, 0, 1,
887  1, 2, 0, 0, 0, 0, 0, 0, 11, 1, 6, 6, 4, 0, 3, 0,
888  1, 2, 0, 0, 0, 0, 0, 2, 9, 6, 3, 8, 6, 0, 6, 1,
889  1, 1, 1, 0, 0, 0, 0, 0, 6, 2, 0, 4, 1, 1, 3, 1,
890  1, 1, 1, 0, 0, 0, 0, 0, 3, 0, 0, 6, 0, 1, 1, 1,
891  1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 10, 1, 1, 0, 1
892  };
893  RadiotherapyData case5_beam4(14, 16, case5_beam4_matrix);
894 
895  static const int case5_beam5_matrix[] = {
896  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 4, 0, 0, 2,
897  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
898  0, 0, 7, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
899  2, 0, 9, 12, 3, 0, 1, 0, 0, 10, 0, 0, 0, 0, 0, 0, 1,
900  3, 0, 10, 11, 11, 1, 9, 3, 5, 0, 6, 3, 14, 12, 0, 0, 3,
901  2, 0, 5, 7, 12, 5, 9, 10, 4, 0, 0, 5, 20, 2, 5, 0, 0,
902  1, 4, 0, 2, 4, 7, 3, 5, 9, 0, 0, 15, 15, 17, 4, 1, 0,
903  2, 4, 0, 0, 0, 0, 0, 0, 6, 0, 5, 12, 9, 14, 6, 8, 0,
904  2, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 6, 3, 0,
905  2, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0,
906  2, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0,
907  2, 3, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
908  };
909  RadiotherapyData case5_beam5(12, 17, case5_beam5_matrix);
911 
913  RadiotherapyData rds[] = {rd0, rd1,
914  case1_beam1,
915  case1_beam2,
916  case1_beam3,
917  case1_beam4,
918  case1_beam5,
919  case2_beam1,
920  case2_beam2,
921  case2_beam3,
922  case2_beam4,
923  case2_beam5,
924  case3_beam1,
925  case3_beam2,
926  case3_beam3,
927  case3_beam4,
928  case3_beam5,
929  case4_beam1,
930  case4_beam2,
931  case4_beam3,
932  case4_beam4,
933  case4_beam5,
934  case5_beam1,
935  case5_beam2,
936  case5_beam3,
937  case5_beam4,
938  case5_beam5
939  };
941  const unsigned int rds_n = sizeof(rds) / sizeof(RadiotherapyData);
942 }
943 // STATISTICS: example-any