mirror of
https://github.com/BlackLight/libCSP--.git
synced 2024-12-28 03:25:12 +01:00
666 lines
37 KiB
HTML
666 lines
37 KiB
HTML
<!-- This comment will put IE 6, 7 and 8 in quirks mode -->
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
|
<title>libCSP++: CSP< T > Class Template Reference</title>
|
|
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
|
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javaScript" src="search/search.js"></script>
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
|
|
</head>
|
|
<body onload='searchBox.OnSelectItem(0);'>
|
|
<!-- Generated by Doxygen 1.6.3 -->
|
|
<script type="text/javascript"><!--
|
|
var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
|
--></script>
|
|
<div class="navigation" id="top">
|
|
<div class="tabs">
|
|
<ul>
|
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
|
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
|
|
<li><a href="files.html"><span>Files</span></a></li>
|
|
<li>
|
|
<div id="MSearchBox" class="MSearchBoxInactive">
|
|
<img id="MSearchSelect" src="search/search.png"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
alt=""/>
|
|
<input type="text" id="MSearchField" value="Search" accesskey="S"
|
|
onfocus="searchBox.OnSearchFieldFocus(true)"
|
|
onblur="searchBox.OnSearchFieldFocus(false)"
|
|
onkeyup="searchBox.OnSearchFieldChange(event)"/>
|
|
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div class="tabs">
|
|
<ul>
|
|
<li><a href="annotated.html"><span>Class List</span></a></li>
|
|
<li><a href="functions.html"><span>Class Members</span></a></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class="contents">
|
|
<h1>CSP< T > Class Template Reference</h1><!-- doxytag: class="CSP" -->
|
|
<p>Main class for managing a <a class="el" href="classCSP.html" title="Main class for managing a CSP.">CSP</a>.
|
|
<a href="#_details">More...</a></p>
|
|
|
|
<p><code>#include <<a class="el" href="csp_09_09_8h_source.html">csp++.h</a>></code></p>
|
|
|
|
<p><a href="classCSP-members.html">List of all members.</a></p>
|
|
<table border="0" cellpadding="0" cellspacing="0">
|
|
<tr><td colspan="2"><h2>Classes</h2></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">struct </td><td class="memItemRight" valign="bottom"><b>arc</b></td></tr>
|
|
<tr><td colspan="2"><h2>Public Member Functions</h2></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a3a4c1cfab4f5c2376b5f9da588e73f5a"></a><!-- doxytag: member="CSP::CSP" ref="a3a4c1cfab4f5c2376b5f9da588e73f5a" args="()" -->
|
|
</td><td class="memItemRight" valign="bottom"><a class="el" href="classCSP.html#a3a4c1cfab4f5c2376b5f9da588e73f5a">CSP</a> ()</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Empty constructor - just do nothing, used for declaring an object and initialize it later. <br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classCSP.html#ad49548121582cc2d59e0d7f100092b75">CSP</a> (int n, bool(*c)(std::vector< <a class="el" href="structCSPvariable.html">CSPvariable</a>< T > >)=__default_constraint)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Class constructor. <a href="#ad49548121582cc2d59e0d7f100092b75"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classCSP.html#a734bb08d8f45394a2acfc8822981a6d0">CSP</a> (int n, T default_value, bool set_variables=false, bool(*c)(std::vector< <a class="el" href="structCSPvariable.html">CSPvariable</a>< T > >)=__default_constraint)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Class constructor. <a href="#a734bb08d8f45394a2acfc8822981a6d0"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classCSP.html#a4017c17aac9d3e96d0e821ebbe09da7b">setDomain</a> (size_t index, std::vector< T > domain)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Set the domain for the i-th variable. <a href="#a4017c17aac9d3e96d0e821ebbe09da7b"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classCSP.html#a65518e67e33e31bff1b5f9aabdf80a01">setDomain</a> (size_t index, T domain[], int size)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Set the domain for the i-th variable. <a href="#a65518e67e33e31bff1b5f9aabdf80a01"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classCSP.html#a534a0d9bd10fb544f94196bf3c386657">setConstraint</a> (bool(*c)(std::vector< <a class="el" href="structCSPvariable.html">CSPvariable</a>< T > >))</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Apply the constraint to the <a class="el" href="classCSP.html" title="Main class for managing a CSP.">CSP</a> as a boolean function. <a href="#a534a0d9bd10fb544f94196bf3c386657"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classCSP.html#a457e1df05d4ec16be00118bda22fd882">setConstraint</a> (std::vector< bool(*)(std::vector< <a class="el" href="structCSPvariable.html">CSPvariable</a>< T > >) > c)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Apply the constraints to the <a class="el" href="classCSP.html" title="Main class for managing a CSP.">CSP</a> as vector of boolean functions. <a href="#a457e1df05d4ec16be00118bda22fd882"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classCSP.html#a0231b93bceae257f0e1c35041f8fe63f">dropConstraint</a> (size_t index)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Drops a constraint from the <a class="el" href="classCSP.html" title="Main class for managing a CSP.">CSP</a>. <a href="#a0231b93bceae257f0e1c35041f8fe63f"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classCSP.html#a8dc6aec6ca7e40d198e58b0ec14fee66">appendConstraint</a> (bool(*c)(std::vector< <a class="el" href="structCSPvariable.html">CSPvariable</a>< T > >))</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Append a constraint to the list of the constraint of the <a class="el" href="classCSP.html" title="Main class for managing a CSP.">CSP</a>. <a href="#a8dc6aec6ca7e40d198e58b0ec14fee66"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classCSP.html#a466845256e638c5e258fd728b641359f">refreshDomains</a> (void)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Updates the domains of the variables. Any constraint or node fixed value is applied. <a href="#a466845256e638c5e258fd728b641359f"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a7ff61c379081881c21626926bdfd8733"></a><!-- doxytag: member="CSP::solve" ref="a7ff61c379081881c21626926bdfd8733" args="(size_t maxIterations=0)" -->
|
|
void </td><td class="memItemRight" valign="bottom"><a class="el" href="classCSP.html#a7ff61c379081881c21626926bdfd8733">solve</a> (size_t maxIterations=0)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Get, if it exists, the solution of the <a class="el" href="classCSP.html" title="Main class for managing a CSP.">CSP</a>, calling refreshDomains until a fixed point is reached. <br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">std::vector< T > </td><td class="memItemRight" valign="bottom"><a class="el" href="classCSP.html#ae9db774b971c480cbef66168b9b6cf07">domain</a> (size_t index)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Get the domain of the i-th variable. <a href="#ae9db774b971c480cbef66168b9b6cf07"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="classCSP.html#a125c7171c19b99e631926bbe011f127d">size</a> (void)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Get the number of variables in the current <a class="el" href="classCSP.html" title="Main class for managing a CSP.">CSP</a>. <a href="#a125c7171c19b99e631926bbe011f127d"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classCSP.html#ac25064c5b2d4e1020173b56913251ebd">setValue</a> (size_t index, T value)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Set the value of a variable as a constraint. <a href="#ac25064c5b2d4e1020173b56913251ebd"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classCSP.html#a4c0cae125a610f519dc22eaec255a0ae">unsetValue</a> (size_t index)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Marks a variable as not set, and if a default value was assigned in the <a class="el" href="classCSP.html" title="Main class for managing a CSP.">CSP</a> constructor, this value will be set. By default, unless specified in the constructor, all the variables are considered as not set. <a href="#a4c0cae125a610f519dc22eaec255a0ae"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classCSP.html#a7ef9eb91c38815c9d82182696a6bd5d3">isSatisfiable</a> (void)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Check if the current <a class="el" href="classCSP.html" title="Main class for managing a CSP.">CSP</a>, with the applied constraints, is satisfiable. <a href="#a7ef9eb91c38815c9d82182696a6bd5d3"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classCSP.html#ae96286c6c7dfb6fe077544e0d4af15f4">hasUniqueSolution</a> (void)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Check if the <a class="el" href="classCSP.html" title="Main class for managing a CSP.">CSP</a>, with the given variables, domains and constraints, admits a unique solution, i.e. each domain of each variable contains an only element. <a href="#ae96286c6c7dfb6fe077544e0d4af15f4"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac74cb751589a58bf6f2815f6878d2213"></a><!-- doxytag: member="CSP::assignUniqueDomains" ref="ac74cb751589a58bf6f2815f6878d2213" args="(void)" -->
|
|
void </td><td class="memItemRight" valign="bottom"><a class="el" href="classCSP.html#ac74cb751589a58bf6f2815f6878d2213">assignUniqueDomains</a> (void)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Check if any of the variables in the <a class="el" href="classCSP.html" title="Main class for managing a CSP.">CSP</a> has a domain containing an only item. If so, it automatically assignes that item as value of the variable. <br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classCSP.html#a213dafc1aae7b1825371810a511eca4f">isSet</a> (size_t i)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Check if the i-th variable in the <a class="el" href="classCSP.html" title="Main class for managing a CSP.">CSP</a> has a fixed value. <a href="#a213dafc1aae7b1825371810a511eca4f"></a><br/></td></tr>
|
|
<tr><td class="memItemLeft" align="right" valign="top">T </td><td class="memItemRight" valign="bottom"><a class="el" href="classCSP.html#aafa5e1a65d6c5d80780437d8d684f32a">value</a> (size_t i)</td></tr>
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Get the value of the i-th variable of the <a class="el" href="classCSP.html" title="Main class for managing a CSP.">CSP</a>. Be careful: before using this function you should check whether the variable you're going to check is actually set, using the <a class="el" href="classCSP.html#a213dafc1aae7b1825371810a511eca4f" title="Check if the i-th variable in the CSP has a fixed value.">isSet()</a> method, unless you know what you're doing, in order to avoid reading inconsistent data. <a href="#aafa5e1a65d6c5d80780437d8d684f32a"></a><br/></td></tr>
|
|
</table>
|
|
<hr/><a name="_details"></a><h2>Detailed Description</h2>
|
|
<h3>template<class T><br/>
|
|
class CSP< T ></h3>
|
|
|
|
<p>Main class for managing a <a class="el" href="classCSP.html" title="Main class for managing a CSP.">CSP</a>. </p>
|
|
<hr/><h2>Constructor & Destructor Documentation</h2>
|
|
<a class="anchor" id="ad49548121582cc2d59e0d7f100092b75"></a><!-- doxytag: member="CSP::CSP" ref="ad49548121582cc2d59e0d7f100092b75" args="(int n, bool(*c)(std::vector< CSPvariable< T > >)=__default_constraint)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<class T > </div>
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname"><a class="el" href="classCSP.html">CSP</a>< T >::<a class="el" href="classCSP.html">CSP</a> </td>
|
|
<td>(</td>
|
|
<td class="paramtype">int </td>
|
|
<td class="paramname"> <em>n</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">bool(*)(std::vector< <a class="el" href="structCSPvariable.html">CSPvariable</a>< T > >) </td>
|
|
<td class="paramname"> <em>c</em> = <code>__default_constraint</code></td><td> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>Class constructor. </p>
|
|
<dl><dt><b>Parameters:</b></dt><dd>
|
|
<table border="0" cellspacing="2" cellpadding="0">
|
|
<tr><td valign="top"></td><td valign="top"><em>n</em> </td><td>Number of variables in the <a class="el" href="classCSP.html" title="Main class for managing a CSP.">CSP</a> </td></tr>
|
|
<tr><td valign="top"></td><td valign="top"><em>c</em> </td><td>Boolean function representing the constraint of the <a class="el" href="classCSP.html" title="Main class for managing a CSP.">CSP</a> If no constraint function is set in the constructor or using the applyConstraint() method, a default function always returning true will be used, that allows any domain for any variable to be valid (no constraint) </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a734bb08d8f45394a2acfc8822981a6d0"></a><!-- doxytag: member="CSP::CSP" ref="a734bb08d8f45394a2acfc8822981a6d0" args="(int n, T default_value, bool set_variables=false, bool(*c)(std::vector< CSPvariable< T > >)=__default_constraint)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<class T > </div>
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname"><a class="el" href="classCSP.html">CSP</a>< T >::<a class="el" href="classCSP.html">CSP</a> </td>
|
|
<td>(</td>
|
|
<td class="paramtype">int </td>
|
|
<td class="paramname"> <em>n</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">T </td>
|
|
<td class="paramname"> <em>default_value</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">bool </td>
|
|
<td class="paramname"> <em>set_variables</em> = <code>false</code>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">bool(*)(std::vector< <a class="el" href="structCSPvariable.html">CSPvariable</a>< T > >) </td>
|
|
<td class="paramname"> <em>c</em> = <code>__default_constraint</code></td><td> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td><td><code> [inline]</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>Class constructor. </p>
|
|
<dl><dt><b>Parameters:</b></dt><dd>
|
|
<table border="0" cellspacing="2" cellpadding="0">
|
|
<tr><td valign="top"></td><td valign="top"><em>n</em> </td><td>Number of variables in the <a class="el" href="classCSP.html" title="Main class for managing a CSP.">CSP</a> </td></tr>
|
|
<tr><td valign="top"></td><td valign="top"><em>default_value</em> </td><td>Default value for the variables in the <a class="el" href="classCSP.html" title="Main class for managing a CSP.">CSP</a> when initialized </td></tr>
|
|
<tr><td valign="top"></td><td valign="top"><em>set_variables</em> </td><td>Decide whether mark the variables set with default_value as "set" or "not set" (default: not set) </td></tr>
|
|
<tr><td valign="top"></td><td valign="top"><em>c</em> </td><td>Boolean function representing the constraint of the <a class="el" href="classCSP.html" title="Main class for managing a CSP.">CSP</a> If no constraint function is set in the constructor or using the applyConstraint() method, a default function always returning true will be used, that allows any domain for any variable to be valid (no constraint) </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
|
|
</div>
|
|
</div>
|
|
<hr/><h2>Member Function Documentation</h2>
|
|
<a class="anchor" id="a8dc6aec6ca7e40d198e58b0ec14fee66"></a><!-- doxytag: member="CSP::appendConstraint" ref="a8dc6aec6ca7e40d198e58b0ec14fee66" args="(bool(*c)(std::vector< CSPvariable< T > >))" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<class T > </div>
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void <a class="el" href="classCSP.html">CSP</a>< T >::appendConstraint </td>
|
|
<td>(</td>
|
|
<td class="paramtype">bool(*)(std::vector< <a class="el" href="structCSPvariable.html">CSPvariable</a>< T > >) </td>
|
|
<td class="paramname"> <em>c</em></td>
|
|
<td> ) </td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>Append a constraint to the list of the constraint of the <a class="el" href="classCSP.html" title="Main class for managing a CSP.">CSP</a>. </p>
|
|
<dl><dt><b>Parameters:</b></dt><dd>
|
|
<table border="0" cellspacing="2" cellpadding="0">
|
|
<tr><td valign="top"></td><td valign="top"><em>c</em> </td><td>A function pointer returning a boolean value representing the new constraint </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ae9db774b971c480cbef66168b9b6cf07"></a><!-- doxytag: member="CSP::domain" ref="ae9db774b971c480cbef66168b9b6cf07" args="(size_t index)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<class T > </div>
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">std::vector< T > <a class="el" href="classCSP.html">CSP</a>< T >::domain </td>
|
|
<td>(</td>
|
|
<td class="paramtype">size_t </td>
|
|
<td class="paramname"> <em>index</em></td>
|
|
<td> ) </td>
|
|
<td><code> [inline]</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>Get the domain of the i-th variable. </p>
|
|
<dl><dt><b>Parameters:</b></dt><dd>
|
|
<table border="0" cellspacing="2" cellpadding="0">
|
|
<tr><td valign="top"></td><td valign="top"><em>index</em> </td><td>Variable for which we're going to get the domain </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="return"><dt><b>Returns:</b></dt><dd>The domain of the i-th variable as a vector of T </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a0231b93bceae257f0e1c35041f8fe63f"></a><!-- doxytag: member="CSP::dropConstraint" ref="a0231b93bceae257f0e1c35041f8fe63f" args="(size_t index)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<class T > </div>
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void <a class="el" href="classCSP.html">CSP</a>< T >::dropConstraint </td>
|
|
<td>(</td>
|
|
<td class="paramtype">size_t </td>
|
|
<td class="paramname"> <em>index</em></td>
|
|
<td> ) </td>
|
|
<td><code> [inline]</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>Drops a constraint from the <a class="el" href="classCSP.html" title="Main class for managing a CSP.">CSP</a>. </p>
|
|
<dl><dt><b>Parameters:</b></dt><dd>
|
|
<table border="0" cellspacing="2" cellpadding="0">
|
|
<tr><td valign="top"></td><td valign="top"><em>index</em> </td><td>Index of the constraint to be dropped </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ae96286c6c7dfb6fe077544e0d4af15f4"></a><!-- doxytag: member="CSP::hasUniqueSolution" ref="ae96286c6c7dfb6fe077544e0d4af15f4" args="(void)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<class T > </div>
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">bool <a class="el" href="classCSP.html">CSP</a>< T >::hasUniqueSolution </td>
|
|
<td>(</td>
|
|
<td class="paramtype">void </td>
|
|
<td class="paramname"></td>
|
|
<td> ) </td>
|
|
<td><code> [inline]</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>Check if the <a class="el" href="classCSP.html" title="Main class for managing a CSP.">CSP</a>, with the given variables, domains and constraints, admits a unique solution, i.e. each domain of each variable contains an only element. </p>
|
|
<dl class="return"><dt><b>Returns:</b></dt><dd>true if the <a class="el" href="classCSP.html" title="Main class for managing a CSP.">CSP</a> has an only possible solution, false otherwise </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a7ef9eb91c38815c9d82182696a6bd5d3"></a><!-- doxytag: member="CSP::isSatisfiable" ref="a7ef9eb91c38815c9d82182696a6bd5d3" args="(void)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<class T > </div>
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">bool <a class="el" href="classCSP.html">CSP</a>< T >::isSatisfiable </td>
|
|
<td>(</td>
|
|
<td class="paramtype">void </td>
|
|
<td class="paramname"></td>
|
|
<td> ) </td>
|
|
<td><code> [inline]</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>Check if the current <a class="el" href="classCSP.html" title="Main class for managing a CSP.">CSP</a>, with the applied constraints, is satisfiable. </p>
|
|
<dl class="return"><dt><b>Returns:</b></dt><dd>true if the <a class="el" href="classCSP.html" title="Main class for managing a CSP.">CSP</a> has at least a possible solution, false otherwise </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a213dafc1aae7b1825371810a511eca4f"></a><!-- doxytag: member="CSP::isSet" ref="a213dafc1aae7b1825371810a511eca4f" args="(size_t i)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<class T > </div>
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">bool <a class="el" href="classCSP.html">CSP</a>< T >::isSet </td>
|
|
<td>(</td>
|
|
<td class="paramtype">size_t </td>
|
|
<td class="paramname"> <em>i</em></td>
|
|
<td> ) </td>
|
|
<td><code> [inline]</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>Check if the i-th variable in the <a class="el" href="classCSP.html" title="Main class for managing a CSP.">CSP</a> has a fixed value. </p>
|
|
<dl><dt><b>Parameters:</b></dt><dd>
|
|
<table border="0" cellspacing="2" cellpadding="0">
|
|
<tr><td valign="top"></td><td valign="top"><em>i</em> </td><td>Index of the variable to be checked </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="return"><dt><b>Returns:</b></dt><dd>true if the i-th variable has a fixed value, false otherwise </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a466845256e638c5e258fd728b641359f"></a><!-- doxytag: member="CSP::refreshDomains" ref="a466845256e638c5e258fd728b641359f" args="(void)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<class T > </div>
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void <a class="el" href="classCSP.html">CSP</a>< T >::refreshDomains </td>
|
|
<td>(</td>
|
|
<td class="paramtype">void </td>
|
|
<td class="paramname"></td>
|
|
<td> ) </td>
|
|
<td><code> [inline]</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>Updates the domains of the variables. Any constraint or node fixed value is applied. </p>
|
|
<dl><dt><b>Parameters:</b></dt><dd>
|
|
<table border="0" cellspacing="2" cellpadding="0">
|
|
<tr><td valign="top"></td><td valign="top"><em>max_iterations</em> </td><td>Maximum number of iterations, after which the function will quit. This can be used to break endless loops in domains assignations. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a457e1df05d4ec16be00118bda22fd882"></a><!-- doxytag: member="CSP::setConstraint" ref="a457e1df05d4ec16be00118bda22fd882" args="(std::vector< bool(*)(std::vector< CSPvariable< T > >) > c)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<class T > </div>
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void <a class="el" href="classCSP.html">CSP</a>< T >::setConstraint </td>
|
|
<td>(</td>
|
|
<td class="paramtype">std::vector< bool(*)(std::vector< <a class="el" href="structCSPvariable.html">CSPvariable</a>< T > >) > </td>
|
|
<td class="paramname"> <em>c</em></td>
|
|
<td> ) </td>
|
|
<td><code> [inline]</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>Apply the constraints to the <a class="el" href="classCSP.html" title="Main class for managing a CSP.">CSP</a> as vector of boolean functions. </p>
|
|
<dl><dt><b>Parameters:</b></dt><dd>
|
|
<table border="0" cellspacing="2" cellpadding="0">
|
|
<tr><td valign="top"></td><td valign="top"><em>c</em> </td><td>Vector containing pointers to boolean functions representing the constraints of the <a class="el" href="classCSP.html" title="Main class for managing a CSP.">CSP</a> </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a534a0d9bd10fb544f94196bf3c386657"></a><!-- doxytag: member="CSP::setConstraint" ref="a534a0d9bd10fb544f94196bf3c386657" args="(bool(*c)(std::vector< CSPvariable< T > >))" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<class T > </div>
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void <a class="el" href="classCSP.html">CSP</a>< T >::setConstraint </td>
|
|
<td>(</td>
|
|
<td class="paramtype">bool(*)(std::vector< <a class="el" href="structCSPvariable.html">CSPvariable</a>< T > >) </td>
|
|
<td class="paramname"> <em>c</em></td>
|
|
<td> ) </td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>Apply the constraint to the <a class="el" href="classCSP.html" title="Main class for managing a CSP.">CSP</a> as a boolean function. </p>
|
|
<dl><dt><b>Parameters:</b></dt><dd>
|
|
<table border="0" cellspacing="2" cellpadding="0">
|
|
<tr><td valign="top"></td><td valign="top"><em>c</em> </td><td>Boolean function representing the constraint of the <a class="el" href="classCSP.html" title="Main class for managing a CSP.">CSP</a> </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a65518e67e33e31bff1b5f9aabdf80a01"></a><!-- doxytag: member="CSP::setDomain" ref="a65518e67e33e31bff1b5f9aabdf80a01" args="(size_t index, T domain[], int size)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<class T > </div>
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void <a class="el" href="classCSP.html">CSP</a>< T >::setDomain </td>
|
|
<td>(</td>
|
|
<td class="paramtype">size_t </td>
|
|
<td class="paramname"> <em>index</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">T </td>
|
|
<td class="paramname"> <em>domain</em>[], </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">int </td>
|
|
<td class="paramname"> <em>size</em></td><td> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td><td><code> [inline]</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>Set the domain for the i-th variable. </p>
|
|
<dl><dt><b>Parameters:</b></dt><dd>
|
|
<table border="0" cellspacing="2" cellpadding="0">
|
|
<tr><td valign="top"></td><td valign="top"><em>index</em> </td><td>Variable for which we're setting the domain </td></tr>
|
|
<tr><td valign="top"></td><td valign="top"><em>domain</em> </td><td>Array containing the possible values for that variable </td></tr>
|
|
<tr><td valign="top"></td><td valign="top"><em>size</em> </td><td>Size of "domain" array </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a4017c17aac9d3e96d0e821ebbe09da7b"></a><!-- doxytag: member="CSP::setDomain" ref="a4017c17aac9d3e96d0e821ebbe09da7b" args="(size_t index, std::vector< T > domain)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<class T > </div>
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void <a class="el" href="classCSP.html">CSP</a>< T >::setDomain </td>
|
|
<td>(</td>
|
|
<td class="paramtype">size_t </td>
|
|
<td class="paramname"> <em>index</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">std::vector< T > </td>
|
|
<td class="paramname"> <em>domain</em></td><td> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>Set the domain for the i-th variable. </p>
|
|
<dl><dt><b>Parameters:</b></dt><dd>
|
|
<table border="0" cellspacing="2" cellpadding="0">
|
|
<tr><td valign="top"></td><td valign="top"><em>index</em> </td><td>Variable for which we're setting the domain </td></tr>
|
|
<tr><td valign="top"></td><td valign="top"><em>domain</em> </td><td>Vector containing the possible values for that variable </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ac25064c5b2d4e1020173b56913251ebd"></a><!-- doxytag: member="CSP::setValue" ref="ac25064c5b2d4e1020173b56913251ebd" args="(size_t index, T value)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<class T > </div>
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void <a class="el" href="classCSP.html">CSP</a>< T >::setValue </td>
|
|
<td>(</td>
|
|
<td class="paramtype">size_t </td>
|
|
<td class="paramname"> <em>index</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">T </td>
|
|
<td class="paramname"> <em>value</em></td><td> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td><td><code> [inline]</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>Set the value of a variable as a constraint. </p>
|
|
<dl><dt><b>Parameters:</b></dt><dd>
|
|
<table border="0" cellspacing="2" cellpadding="0">
|
|
<tr><td valign="top"></td><td valign="top"><em>index</em> </td><td>Index of the parameter to be set </td></tr>
|
|
<tr><td valign="top"></td><td valign="top"><em>value</em> </td><td>Value to be set </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a125c7171c19b99e631926bbe011f127d"></a><!-- doxytag: member="CSP::size" ref="a125c7171c19b99e631926bbe011f127d" args="(void)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<class T > </div>
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">size_t <a class="el" href="classCSP.html">CSP</a>< T >::size </td>
|
|
<td>(</td>
|
|
<td class="paramtype">void </td>
|
|
<td class="paramname"></td>
|
|
<td> ) </td>
|
|
<td><code> [inline]</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>Get the number of variables in the current <a class="el" href="classCSP.html" title="Main class for managing a CSP.">CSP</a>. </p>
|
|
<dl class="return"><dt><b>Returns:</b></dt><dd>Size of the <a class="el" href="classCSP.html" title="Main class for managing a CSP.">CSP</a> </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a4c0cae125a610f519dc22eaec255a0ae"></a><!-- doxytag: member="CSP::unsetValue" ref="a4c0cae125a610f519dc22eaec255a0ae" args="(size_t index)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<class T > </div>
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void <a class="el" href="classCSP.html">CSP</a>< T >::unsetValue </td>
|
|
<td>(</td>
|
|
<td class="paramtype">size_t </td>
|
|
<td class="paramname"> <em>index</em></td>
|
|
<td> ) </td>
|
|
<td><code> [inline]</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>Marks a variable as not set, and if a default value was assigned in the <a class="el" href="classCSP.html" title="Main class for managing a CSP.">CSP</a> constructor, this value will be set. By default, unless specified in the constructor, all the variables are considered as not set. </p>
|
|
<dl><dt><b>Parameters:</b></dt><dd>
|
|
<table border="0" cellspacing="2" cellpadding="0">
|
|
<tr><td valign="top"></td><td valign="top"><em>index</em> </td><td>Index of the variable to be unset </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="aafa5e1a65d6c5d80780437d8d684f32a"></a><!-- doxytag: member="CSP::value" ref="aafa5e1a65d6c5d80780437d8d684f32a" args="(size_t i)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<class T > </div>
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">T <a class="el" href="classCSP.html">CSP</a>< T >::value </td>
|
|
<td>(</td>
|
|
<td class="paramtype">size_t </td>
|
|
<td class="paramname"> <em>i</em></td>
|
|
<td> ) </td>
|
|
<td><code> [inline]</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>Get the value of the i-th variable of the <a class="el" href="classCSP.html" title="Main class for managing a CSP.">CSP</a>. Be careful: before using this function you should check whether the variable you're going to check is actually set, using the <a class="el" href="classCSP.html#a213dafc1aae7b1825371810a511eca4f" title="Check if the i-th variable in the CSP has a fixed value.">isSet()</a> method, unless you know what you're doing, in order to avoid reading inconsistent data. </p>
|
|
<dl><dt><b>Parameters:</b></dt><dd>
|
|
<table border="0" cellspacing="2" cellpadding="0">
|
|
<tr><td valign="top"></td><td valign="top"><em>i</em> </td><td>Index of the variable to get </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="return"><dt><b>Returns:</b></dt><dd>The value of the variable, if the variable exists </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<hr/>The documentation for this class was generated from the following files:<ul>
|
|
<li><a class="el" href="csp_09_09-def_8h_source.html">csp++-def.h</a></li>
|
|
<li>csp++.cpp</li>
|
|
</ul>
|
|
</div>
|
|
<!--- window showing the filter options -->
|
|
<div id="MSearchSelectWindow"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
|
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Variables</a></div>
|
|
|
|
<!-- iframe showing the search results (closed by default) -->
|
|
<div id="MSearchResultsWindow">
|
|
<iframe src="" frameborder="0"
|
|
name="MSearchResults" id="MSearchResults">
|
|
</iframe>
|
|
</div>
|
|
|
|
<hr class="footer"/><address style="text-align: right;"><small>Generated on Thu May 27 11:41:31 2010 for libCSP++ by
|
|
<a href="http://www.doxygen.org/index.html">
|
|
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
|
|
</body>
|
|
</html>
|