<divclass="fragment"><divclass="line"><spanclass="comment">// Copyright 2018 Google LLC</span></div><divclass="line"><spanclass="comment">// Licensed under the Apache License, Version 2.0 (the "License");</span></div><divclass="line"><spanclass="comment">// you may not use this file except in compliance with the License.</span></div><divclass="line"><spanclass="comment">// You may obtain a copy of the License at</span></div><divclass="line"><spanclass="comment">//</span></div><divclass="line"><spanclass="comment">// http://www.apache.org/licenses/LICENSE-2.0</span></div><divclass="line"><spanclass="comment">//</span></div><divclass="line"><spanclass="comment">// Unless required by applicable law or agreed to in writing, software</span></div><divclass="line"><spanclass="comment">// distributed under the License is distributed on an "AS IS" BASIS,</span></div><divclass="line"><spanclass="comment">// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div><divclass="line"><spanclass="comment">// See the License for the specific language governing permissions and</span></div><divclass="line"><spanclass="comment">// limitations under the License.</span></div><divclass="line"></div><divclass="line"><spanclass="preprocessor">#include <numeric></span><spanclass="comment">// std::iota</span></div><divclass="line"></div><divclass="line"><spanclass="preprocessor">#include "<aclass="code"href="base_2logging_8h.html">ortools/base/logging.h</a>"</span></div><divclass="line"><spanclass="preprocessor">#include "<aclass="code"href="constraint__solver_8h.html">ortools/constraint_solver/constraint_solver.h</a>"</span></div><divclass="line"></div><divclass="line"><spanclass="keyword">namespace </span><aclass="code"href="namespaceoperations__research.html">operations_research</a> {</div><divclass="line"><spanclass="keywordtype">void</span> SolveNursesExample() {</div><divclass="line"><spanclass="comment">// Instantiate the solver.</span></div><divclass="line"> Solver solver(<spanclass="stringliteral">"NursesExample"</span>);</div><divclass="line"> std::array<int, 4> nurses;</div><divclass="line"> std::iota(std::begin(nurses), std::end(nurses), 0);</div><divclass="line"> {</div><divclass="line"> std::ostringstream oss;</div><divclass="line"><spanclass="keywordflow">for</span> (<spanclass="keyword">auto</span> i : nurses) oss <<<spanclass="charliteral">''</span><< i;</div><divclass="line"><aname="a0"></a><aclass="code"href="base_2logging_8h.html#accad43a85d781d53381cd53a9894b6ae">LOG</a>(<aname="a1"></a><aclass="code"href="log__severity_8h.html#ab4a2cbab234914b320b7fae11b6e8cb9">INFO</a>) <<<spanclass="stringliteral">"Nurses:"</span><< oss.str();</div><divclass="line"> }</div><divclass="line"></div><divclass="line"><spanclass="comment">// Nurse assigned to shift 0 means not working that day.</span></div><divclass="line"> std::array<int, 4> shifts;</div><divclass="line"> std::iota(std::begin(shifts), std::end(shifts), 0);</div><divclass="line"> {</div><divclass="line"> std::ostringstream oss;</div><divclass="line"><spanclass="keywordflow">for</span> (<spanclass="keyword">auto</span> i : shifts) oss <<<spanclass="charliteral">''</span><< i;</div><divclass="line"><aclass="code"href="base_2logging_8h.html#accad43a85d781d53381cd53a9894b6ae">LOG</a>(<aclass="code"href="log__severity_8h.html#ab4a2cbab234914b320b7fae11b6e8cb9">INFO</a>) <<<spanclass="stringliteral">"Shifts:"</span><< oss.str();</div><divclass="line"> }</div><divclass="line"></div><divclass="line"> std::array<int, 7> days;</div><divclass="line"> std::iota(std::begin(days), std::end(days), 0);</div><divclass="line"> {</div><divclass="line"> std::ostringstream oss;</div><divclass="line"><spanclass="keywordflow">for</span> (<spanclass="keyword">auto</spa