学会使用cplex的第一步.docVIP

  • 86
  • 0
  • 约1.17万字
  • 约 9页
  • 2019-09-08 发布于江西
  • 举报
学会使用cplex的第一步——在Microsoft Visual C++使用cplex 已有 1678 次阅读2011-11-25 16:21|系统分类: 科研笔记|关键词:cplex visual studio c CPLEX对学习OPERATION RESEARCH的人来说是必备工具,在解决最优化问题上依然是最知名的。 主要记录下cplex的初步使用,本文主要参考的英文网址在: .au/ilog/cplex/12.1/mvs/c_cpp.html 本文主要记录如何初次在cplex安装好后,在visual studio中运行cplex的例子。 对英文说明进行了解释,将自己以前遇到的问题也写出来,方便大家解决。 学会如何使用 Microsoft Visual Studio 1.安装并运行 cplex中的C and C++ examples (see dotnet.html for the C# and VB examples). 2.将cplex和C or C++ project 链接。 下载cplex和安装 CPLEX 安装目录记住最好安装到默认的C:\ILOG\CPLEX121 (the default location) ****我因为没有安装到这个目录,遇到的问题:“问题:将cplex安装在c:\program files\IBM下,在vc2008的cmd窗户下运行例子时候,出现C:\Program 不是内部或外部命令,也不是可运行的程序或批处理文件。 原因:cplex安装的C:\Program Files\下,中间有空格,由于路径中有空格,所以,出了这个问题 ; 解决办法: 就用正常的路径,将路径全加上了双引号。其实,如果当初安装时候把cplex安装到c盘根目录,就不会出现这样的问题了。 Library Locations cplex的一些文件都在默认路径下得多个文件夹下。都是后缀为lib的文件。 下面来试试建立和运行第一个cplex例子吧Building and Running CPLEX Examples 所有的例子都在默认目录下CPLEXDIR\examples\x86_.net2005_8.0\stat_mta\examples.sln. 运行vc2005或者2008 File-Open Project/Solution.CPLEXDIR\examples\x86_.net2005_8.0\stat_mta. 选择例子,打开. 比如选择blend例子To build only one example (for instance, blend): 选择该项目Select the blend project in the Solution Explorer window. 建立项目From the Build menu, choose Build blend. 项目完成Wait for the completion of the building process. 4.运行例子 run an example (for instance, blend): 怎么看结果呢? 方法: 打开vc中的command prompt window ,在vc菜单的tool下面的 Visual Studio 2005 Command prompt: 0:先要在cmd窗口中设置路径,得打出来Type set path C:\ILOG\CPLEX_Studio_Preview123\cplex\bin\x86_win32 so that cplex121.dll is on the path. 0然后运行例子Type C:\ILOG\CPLEX_Studio_Preview123\cplex\examples\x86_windows_vs2008\stat_mta\blend. 0然后就能看到结果了The result is then displayed. 附:在vc中debug那些例子的话,会出来这样的对话框: debugging information for iloplex.l.exe can Not be found or does not match 网上找到了解决方案,共享一下: 1. 打开项目属性,把 Configuration Properties - C/C++ - General - Debug Information Format 设置成 Program Database (/Zi) 或 Program Database for Edit Continue (/ZI) ; 2. 把 C/C++ - General - Optimization 设置成 Disabled

文档评论(0)

1亿VIP精品文档

相关文档