91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 15KB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發布日期: 2021-06-03
  • 語言: 其他
  • 標簽: HSA??和聲算法??

資源簡介

多目標和聲算法的源代碼,是和聲原始算法的升級版,主要用于求最優解

資源截圖

代碼片段和文件信息

/*
?IF?YOU?USE?THIS?CODE?YOU?CAN?CITE?THE?FOLLOWING?WORK:
?[1]?M.?Fesanghary?S.?Asadi?Z.W.?Geem?Design?of?Low-Emission?and?Energy-Efficient?Residential?Buildings?Using?a?Multi-objective?Optimization?Algorithm?Building?and?Environment?49?(2012)?245-250
???
*/



using?System;
using?System.Collections.Generic;
using?System.Linq;
using?System.Text;
using?System.IO;

namespace?MultiobjectiveHS
{

????public?class?CostOptimizer?:?MOHS.IFunction
????{

????????#region?Fields

????????MOHS?hs;
????????int?nVar;
????????double[]?xlb;
????????double[]?xub;
????????int?Iteration?=?0;
????????public?string?address?=?System.Environment.GetFolderPath(System.Environment.SpecialFolder.DesktopDirectory);
????????StreamWriter?sw1;
????????double[]?bestSolution;
????????string?str1?=?DateTime.Now.ToLongDateString();
????????string?str2?=?(DateTime.Now.Hour).ToString();
????????string?str3?=?(DateTime.Now.Minute).ToString();
????????string?str4?=?(DateTime.Now.Second).ToString();
????????string?name2?name1;
????????
????????#endregion

????????public?void?Solve()
????????{
????????????name1?=?address?+?“\\Report.txt“;

????????????nVar?=?2;??//?number?of?variables

????????????xlb?=?new?double[nVar];
????????????xub?=?new?double[nVar];


????????????RunHS();

????????}


????????public?double[]?F(double[]?x)
????????{
????????????double[]?f?=?new?double[hs.nobjectives];
????????????Iteration++;
????????????try
????????????{

????????????????f[0]?=?x[0]?+?Math.Exp(x[1]);????????????????????????//?objective?1?=?x0?+?exp(x1)?
????????????????f[1]?=?-2?*?x[0]?+?Math.Exp(-x[1]);??????????????????//?objective?2?=?-2x0?+?exp(-x1)?

????????????}
????????????catch?(Exception?e)?//?in?case?of?error...!
????????????{
????????????????f[0]?=?f[1]?=?double.MaxValue;
????????????????Console.WriteLine(e.Message);
????????????}

????????????#region?Report

????????????try
????????????{
????????????????if?(Iteration?==?1)?{?File.Delete(name1);?}

????????????????sw1?=?File.AppendText(name1);
????????????????sw1.Write(Iteration.ToString()?+?“\t“);
????????????????sw1.Write(f[0].ToString(“e“)?+?“\t“?+?f[1].ToString(“e“)?+?“\t“);
????????????????for?(int?i?=?0;?i?????????????????????sw1.Write(x[i].ToString()?+?“\t“);
????????????????sw1.WriteLine();
????????????????sw1.Close();

????????????????if?(Iteration?%?10?==?0)
????????????????????Console.WriteLine(“#?“?+?Iteration.ToString()?+?“??f0?=?“?+?(f[0]).ToString(“e“)?+?“??f1?=?“?+?(f[1]).ToString(“e“));

????????????????if?(Iteration?%?50?==?0)
????????????????{
????????????????????hs.choosePareto();
????????????????????Utility.WriteMatrix(hs.ParetoSet?“Pareto?Front“?“e3“);
????????????????}
????????????}
????????????catch?(Exception?e)
????????????{
????????????????Console.WriteLine(e.Message);
????????????}


????????????#endregion


????????????return?f;
????????}


????????public?void?R

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????????890??2011-12-07?18:54??MultiobjectiveHS\MultiobjectiveHS.sln
?????文件???????18432??2011-12-07?18:57??MultiobjectiveHS\MultiobjectiveHS.suo
?????目錄???????????0??2011-12-07?18:58??MultiobjectiveHS\MultiobjectiveHS\
?????文件????????4247??2011-12-07?18:56??MultiobjectiveHS\MultiobjectiveHS\CostOptimizer.cs
?????文件???????14782??2011-12-07?18:56??MultiobjectiveHS\MultiobjectiveHS\MOHS.cs
?????文件????????2570??2011-12-07?18:56??MultiobjectiveHS\MultiobjectiveHS\MultiobjectiveHS.csproj
?????目錄???????????0??2011-12-07?18:58??MultiobjectiveHS\MultiobjectiveHS\Optimization\
?????文件???????14782??2011-12-07?18:48??MultiobjectiveHS\MultiobjectiveHS\Optimization\MOHS.cs
?????文件?????????400??2011-12-07?18:56??MultiobjectiveHS\MultiobjectiveHS\Program.cs
?????目錄???????????0??2011-12-07?18:58??MultiobjectiveHS\MultiobjectiveHS\Properties\
?????文件????????1450??2011-12-07?18:54??MultiobjectiveHS\MultiobjectiveHS\Properties\AssemblyInfo.cs
?????文件?????????793??2011-12-07?18:32??MultiobjectiveHS\MultiobjectiveHS\Utility.cs

評論

共有 條評論