#if !defined(AFX_GAQUEEN_H__C26AE0A3_F9B4_426F_A324_B460CC7946CB__INCLUDED_)
#define AFX_GAQUEEN_H__C26AE0A3_F9B4_426F_A324_B460CC7946CB__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class CGAQueen
{
public:
CGAQueen(int nPopulation,int nIteration,float Mutation,int mChBoard)
virtual ~CGAQueen()
void Clear() // to clear chess board with 0 value
void InitialPopulation() // to create the first and initial randompopulation
void FillArea(int index) // to fill chess board with desired chromosome
int CostFunc(int index) // determine the cost of matrix[index][index]
void PopulationSort() // to sort population from the best to the worst
void GenerateCrossOverMatrix() // a way to create children from parent is CcrossOver
void Mating() // to create children from parents
void Ap
Dijkstra算法求最短路徑(C#版) using System
using System.Collections
using System.Text
namespace Greedy
{
class Marx
{
private int[] distance
private int row
private ArrayList ways = new ArrayList()
public Marx(int n,params int[] d)
{
this.row = n
distance = new int[row * row]
for (int i = 0 i < row * row i++)
{
this.distance[i] = d[i]
This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
CHAPT12\Chapt12.cpp Part of the 32-bit test progrma for the Win32Port class.
CHAPT12\Chapt12.dsp The Visual C++ project file for the program.
CHAPT12\Chapt12.dsw The Visual C++ workspace file for the program.
CHAPT12\Chapt12.h The header file for the app s application class
CHAPT12\Chapt12.ico The icon used in Chapt12.exe
CHAPT12\Chapt12.rc The resource file use in the test program.
CHAPT12\Chapt12Dlg.cpp The implementation of the dialog class
CHAPT12\Chapt12Dlg.h The declarations of the dialog class
CHAPT12\MyWin32Port.h Definition for a class derived from Win32Port.
CHAPT12\resource.h The resource IDs
CHAPT13\AnsiWinTerm.cpp Class used in Win32 terminal emulation
CHAPT13\AnsiWinTerm.h Header file for the AnsiWinTerm class
CHAPT13\Chapt13.cpp 32-bit test program of terminal emulation
CHAPT13\Chapt13.dsp Visual C++ project file
CHAPT13\Chapt13.dsw Visual C++ workspace file
CHAPT13\Chapt13.rc The resource file used in the test program
CHAPT13\resource.h IDs defined in the resource file
CHAPT13\Win32Term.cpp The Win32 general purpose terminal class
CHAPT13\Win32Term.h Definition of the class
CHAPT13\Debug\Chapt13.exe 32-bit executable of the test program.
μC/OS-II Goals
Probably the most important goal of μC/OS-II was to make it backward compatible with μC/OS (at least from an
application’s standpoint). A μC/OS port might need to be modified to work with μC/OS-II but at least, the application
code should require only minor changes (if any). Also, because μC/OS-II is based on the same core as μC/OS, it is just
as reliable. I added conditional compilation to allow you to further reduce the amount of RAM (i.e. data space) needed
by μC/OS-II. This is especially useful when you have resource limited products. I also added the feature described in
the previous section and cleaned up the code.
Where the book is concerned, I wanted to clarify some of the concepts described in the first edition and provide
additional explanations about how μC/OS-II works. I had numerous requests about doing a chapter on how to port
μC/OS and thus, such a chapter has been included in this book for μC/OS-II.
兩種解決方案 Richard just finished building his new house. Now the only thing the house misses is a cute little wooden fence. He had no idea how to make a wooden fence, so he decided to order one. Somehow he got his hands on the ACME Fence Catalogue 2002, the ultimate resource on cute little wooden fences. After reading its preface he already knew, what makes a little wooden fence cute.
A wooden fence consists of N wooden planks, placed vertically in a row next to each other. A fence looks cute if and only if the following conditions are met:
?The planks have different lengths, namely 1, 2, . . . , N plank length units.
?Each plank with two neighbors is either larger than each of its neighbors or smaller than each of them. (Note that this makes the top of the fence alternately rise and fall.)