git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@263 331e1502-861f-0410-8da2-ba01fb791d7f
109 lines
11 KiB
HTML
109 lines
11 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
|
<title>ParadisEO-MOEO: moeoObjectiveVectorTraits.h Source File</title>
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
|
<link href="tabs.css" rel="stylesheet" type="text/css">
|
|
</head><body>
|
|
<!-- Generated by Doxygen 1.5.1 -->
|
|
<div class="tabs">
|
|
<ul>
|
|
<li><a href="main.html"><span>Main Page</span></a></li>
|
|
<li><a href="classes.html"><span>Classes</span></a></li>
|
|
<li id="current"><a href="files.html"><span>Files</span></a></li>
|
|
<li>
|
|
<form action="search.php" method="get">
|
|
<table cellspacing="0" cellpadding="0" border="0">
|
|
<tr>
|
|
<td><label> <u>S</u>earch for </label></td>
|
|
<td><input type="text" name="query" value="" size="20" accesskey="s"/></td>
|
|
</tr>
|
|
</table>
|
|
</form>
|
|
</li>
|
|
</ul></div>
|
|
<h1>moeoObjectiveVectorTraits.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-</span>
|
|
<a name="l00002"></a>00002
|
|
<a name="l00003"></a>00003 <span class="comment">//-----------------------------------------------------------------------------</span>
|
|
<a name="l00004"></a>00004 <span class="comment">// moeoObjectiveVectorTraits.h</span>
|
|
<a name="l00005"></a>00005 <span class="comment">// (c) OPAC Team (LIFL), Dolphin Project (INRIA), 2007</span>
|
|
<a name="l00006"></a>00006 <span class="comment">/*</span>
|
|
<a name="l00007"></a>00007 <span class="comment"> This library...</span>
|
|
<a name="l00008"></a>00008 <span class="comment"></span>
|
|
<a name="l00009"></a>00009 <span class="comment"> Contact: paradiseo-help@lists.gforge.inria.fr, http://paradiseo.gforge.inria.fr</span>
|
|
<a name="l00010"></a>00010 <span class="comment"> */</span>
|
|
<a name="l00011"></a>00011 <span class="comment">//-----------------------------------------------------------------------------</span>
|
|
<a name="l00012"></a>00012
|
|
<a name="l00013"></a>00013 <span class="preprocessor">#ifndef MOEOOBJECTIVEVECTORTRAITS_H_</span>
|
|
<a name="l00014"></a>00014 <span class="preprocessor"></span><span class="preprocessor">#define MOEOOBJECTIVEVECTORTRAITS_H_</span>
|
|
<a name="l00015"></a>00015 <span class="preprocessor"></span>
|
|
<a name="l00016"></a>00016 <span class="preprocessor">#include <vector></span>
|
|
<a name="l00017"></a>00017 <span class="preprocessor">#include <iostream></span>
|
|
<a name="l00018"></a>00018 <span class="preprocessor">#include <stdexcept></span>
|
|
<a name="l00019"></a>00019
|
|
<a name="l00023"></a><a class="code" href="classmoeoObjectiveVectorTraits.html">00023</a> <span class="keyword">class </span><a class="code" href="classmoeoObjectiveVectorTraits.html">moeoObjectiveVectorTraits</a>
|
|
<a name="l00024"></a>00024 {
|
|
<a name="l00025"></a>00025 <span class="keyword">public</span>:
|
|
<a name="l00026"></a>00026
|
|
<a name="l00032"></a><a class="code" href="classmoeoObjectiveVectorTraits.html#52264fa9e700c4ff183dd90f6965d9fc">00032</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classmoeoObjectiveVectorTraits.html#52264fa9e700c4ff183dd90f6965d9fc">setup</a>(<span class="keywordtype">unsigned</span> _nObjectives, std::vector < bool > & _bObjectives)
|
|
<a name="l00033"></a>00033 {
|
|
<a name="l00034"></a>00034 <span class="comment">// in case the number of objectives was already set to a different value</span>
|
|
<a name="l00035"></a>00035 <span class="keywordflow">if</span> ( <a class="code" href="classmoeoObjectiveVectorTraits.html#cac944804ce067ae62ca9b6bc139db03">nObj</a> && (<a class="code" href="classmoeoObjectiveVectorTraits.html#cac944804ce067ae62ca9b6bc139db03">nObj</a> != _nObjectives) ) {
|
|
<a name="l00036"></a>00036 std::cout << <span class="stringliteral">"WARNING\n"</span>;
|
|
<a name="l00037"></a>00037 std::cout << <span class="stringliteral">"WARNING : the number of objectives are changing\n"</span>;
|
|
<a name="l00038"></a>00038 std::cout << <span class="stringliteral">"WARNING : Make sure all existing objects are destroyed\n"</span>;
|
|
<a name="l00039"></a>00039 std::cout << <span class="stringliteral">"WARNING\n"</span>;
|
|
<a name="l00040"></a>00040 }
|
|
<a name="l00041"></a>00041 <span class="comment">// number of objectives</span>
|
|
<a name="l00042"></a>00042 <a class="code" href="classmoeoObjectiveVectorTraits.html#cac944804ce067ae62ca9b6bc139db03">nObj</a> = _nObjectives;
|
|
<a name="l00043"></a>00043 <span class="comment">// min/max vector</span>
|
|
<a name="l00044"></a>00044 <a class="code" href="classmoeoObjectiveVectorTraits.html#db329d416c75711f671c9d7cffb06299">bObj</a> = _bObjectives;
|
|
<a name="l00045"></a>00045 <span class="comment">// in case the number of objectives and the min/max vector size don't match</span>
|
|
<a name="l00046"></a>00046 <span class="keywordflow">if</span> (<a class="code" href="classmoeoObjectiveVectorTraits.html#cac944804ce067ae62ca9b6bc139db03">nObj</a> != <a class="code" href="classmoeoObjectiveVectorTraits.html#db329d416c75711f671c9d7cffb06299">bObj</a>.size())
|
|
<a name="l00047"></a>00047 <span class="keywordflow">throw</span> std::runtime_error(<span class="stringliteral">"Number of objectives and min/max size don't match in moeoObjectiveVectorTraits::setup"</span>);
|
|
<a name="l00048"></a>00048 }
|
|
<a name="l00049"></a>00049
|
|
<a name="l00053"></a><a class="code" href="classmoeoObjectiveVectorTraits.html#b7b3047536f5ba2f7d0da3f19b00f4d3">00053</a> <span class="keyword">static</span> <span class="keywordtype">unsigned</span> <a class="code" href="classmoeoObjectiveVectorTraits.html#b7b3047536f5ba2f7d0da3f19b00f4d3">nObjectives</a>()
|
|
<a name="l00054"></a>00054 {
|
|
<a name="l00055"></a>00055 <span class="comment">// in case the number of objectives would not be assigned yet</span>
|
|
<a name="l00056"></a>00056 <span class="keywordflow">if</span> (! <a class="code" href="classmoeoObjectiveVectorTraits.html#cac944804ce067ae62ca9b6bc139db03">nObj</a>)
|
|
<a name="l00057"></a>00057 <span class="keywordflow">throw</span> std::runtime_error(<span class="stringliteral">"Number of objectives not assigned in moeoObjectiveVectorTraits"</span>);
|
|
<a name="l00058"></a>00058 <span class="keywordflow">return</span> <a class="code" href="classmoeoObjectiveVectorTraits.html#cac944804ce067ae62ca9b6bc139db03">nObj</a>;
|
|
<a name="l00059"></a>00059 }
|
|
<a name="l00060"></a>00060
|
|
<a name="l00065"></a><a class="code" href="classmoeoObjectiveVectorTraits.html#5cb7975e5ea32809e01b7078313d326d">00065</a> <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classmoeoObjectiveVectorTraits.html#5cb7975e5ea32809e01b7078313d326d">minimizing</a>(<span class="keywordtype">unsigned</span> _i)
|
|
<a name="l00066"></a>00066 {
|
|
<a name="l00067"></a>00067 <span class="comment">// in case there would be a wrong index</span>
|
|
<a name="l00068"></a>00068 <span class="keywordflow">if</span> (_i >= <a class="code" href="classmoeoObjectiveVectorTraits.html#db329d416c75711f671c9d7cffb06299">bObj</a>.size())
|
|
<a name="l00069"></a>00069 <span class="keywordflow">throw</span> std::runtime_error(<span class="stringliteral">"Wrong index in moeoObjectiveVectorTraits"</span>);
|
|
<a name="l00070"></a>00070 <span class="keywordflow">return</span> <a class="code" href="classmoeoObjectiveVectorTraits.html#db329d416c75711f671c9d7cffb06299">bObj</a>[_i];
|
|
<a name="l00071"></a>00071 }
|
|
<a name="l00072"></a>00072
|
|
<a name="l00077"></a><a class="code" href="classmoeoObjectiveVectorTraits.html#b76148b68b28d41600065b9d82e815b5">00077</a> <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classmoeoObjectiveVectorTraits.html#b76148b68b28d41600065b9d82e815b5">maximizing</a>(<span class="keywordtype">unsigned</span> _i) {
|
|
<a name="l00078"></a>00078 <span class="keywordflow">return</span> (! <a class="code" href="classmoeoObjectiveVectorTraits.html#5cb7975e5ea32809e01b7078313d326d">minimizing</a>(_i));
|
|
<a name="l00079"></a>00079 }
|
|
<a name="l00080"></a>00080
|
|
<a name="l00084"></a><a class="code" href="classmoeoObjectiveVectorTraits.html#c1199e4f019ec88a0365db81e9ab8d1f">00084</a> <span class="keyword">static</span> <span class="keywordtype">double</span> <a class="code" href="classmoeoObjectiveVectorTraits.html#c1199e4f019ec88a0365db81e9ab8d1f">tolerance</a>()
|
|
<a name="l00085"></a>00085 {
|
|
<a name="l00086"></a>00086 <span class="keywordflow">return</span> 1e-6;
|
|
<a name="l00087"></a>00087 }
|
|
<a name="l00088"></a>00088
|
|
<a name="l00089"></a>00089
|
|
<a name="l00090"></a>00090 <span class="keyword">private</span>:
|
|
<a name="l00091"></a>00091
|
|
<a name="l00093"></a><a class="code" href="classmoeoObjectiveVectorTraits.html#cac944804ce067ae62ca9b6bc139db03">00093</a> <span class="keyword">static</span> <span class="keywordtype">unsigned</span> <a class="code" href="classmoeoObjectiveVectorTraits.html#cac944804ce067ae62ca9b6bc139db03">nObj</a>;
|
|
<a name="l00095"></a><a class="code" href="classmoeoObjectiveVectorTraits.html#db329d416c75711f671c9d7cffb06299">00095</a> <span class="keyword">static</span> std::vector < bool > <a class="code" href="classmoeoObjectiveVectorTraits.html#db329d416c75711f671c9d7cffb06299">bObj</a>;
|
|
<a name="l00096"></a>00096
|
|
<a name="l00097"></a>00097 };
|
|
<a name="l00098"></a>00098
|
|
<a name="l00099"></a>00099 <span class="preprocessor">#endif </span><span class="comment">/*MOEOOBJECTIVEVECTORTRAITS_H_*/</span>
|
|
<a name="l00100"></a>00100
|
|
<a name="l00101"></a>00101
|
|
<a name="l00102"></a>00102 <span class="comment">// The static variables of the moeoObjectiveVectorTraits class need to be allocated</span>
|
|
<a name="l00103"></a>00103 <span class="comment">// (maybe it would have been better to put this on a moeoObjectiveVectorTraits.cpp file)</span>
|
|
<a name="l00104"></a>00104 <span class="keywordtype">unsigned</span> <a class="code" href="classmoeoObjectiveVectorTraits.html#cac944804ce067ae62ca9b6bc139db03">moeoObjectiveVectorTraits::nObj</a>;
|
|
<a name="l00105"></a>00105 std::vector < bool > <a class="code" href="classmoeoObjectiveVectorTraits.html#db329d416c75711f671c9d7cffb06299">moeoObjectiveVectorTraits::bObj</a>;
|
|
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Tue Apr 17 16:53:21 2007 for ParadisEO-MOEO by
|
|
<a href="http://www.doxygen.org/index.html">
|
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address>
|
|
</body>
|
|
</html>
|