lp_solve 线性规划求解包的使用
来源:互联网 发布:淘宝66活动 编辑:程序博客网 时间:2024/06/07 22:22
网上关于lpsolve的资料不多,也没有怎么说配置,对于初入这个包的人来说,非常痛苦,我也是搞了一天,才在mac和win上都搞了出来。具体使用还是蛮简单的。
I'm rather new to C++. I'm trying to use VS2015 and the lp_solve library(https://sourceforge.net/projects/lpsolve/files/lpsolve/5.5.2.5/) to solve my linear eq problem(for exact Gromov-Hausdorrf Distance, see https://mediatum.ub.tum.de/doc/1231885/1231885.pdf section 3.1 and 3.3). My machine is x64 system. Here is what I've done:
- donwload the lp_solve_5.5.2.5_dev_win64.zip package and decompress it.
- specific the library directoy(through project -> properties -> linker)
- specific lib I used (liblpsolve55.lib and liblpsolve55d.lib for statically linking) through project->properties->linker->input->additional dependency.
- declare the .h file directory(through project->properties->C/C++).
Here is what I declare in my code:
#include "lp_lib.h"
#pragma comment(lib, "liblpsolve55.lib") // static
#pragma comment(lib, "liblpsolve55d.lib") // static for debug
While when I run the code with x86, it will show the following problems:
- error LNK2019: unresolved external symbol _make_lp@8 referenced in function "void __cdecl my_solve [totally 13 errors like this]
- warning LNK4272: library machine type 'X86' conflicts with target machine type 'x64' [totally 2 warnings like this]
While when I switch the runner with x64:
- I got 550 errors, mainly due to the “dlfcn.h”: No such file or directory
in the lp_lib.h file, it has lines:
#if (LoadInverseLib == TRUE) || (LoadLanguageLib == TRUE) #ifdef WIN32 #include <windows.h> #else #include <dlfcn.h> #endif#endif
- which means it has treat me as a linux machine since dlfcn.h is for unix/linux
I've also try to use the 32bit version package(lp_solve_5.5.2.5_dev_win32.zip), but it do not work either.
- with x86 runner:__iob, _printf issues.
- with x64 runner:“dlfcn.h”: No such file or directory
I've successively build and run the demo in my mac with the corresponding package(lp_solve_5.5.2.5_dev_osx32.tar.gz). But I still want to know how to build and run it in VS2015.
Here I'll state what I do in mac if anyone need it(using Xcode).
- download the lp_solve_5.5.2.5_dev_osx32.tar.gz package
- add all the .h file in build phase -> headers
- add the liblpsolve55.a file in build phase -> link binary with libraries
- (if you want to use .dylib as dynamic linking, add it to the build phase -> copy file, but it do not work for me)
- in build setting, set the Architectures to 32-bit intel
- in build setting, set the Build Active Architecture Only to No
Thank you very much, actually nobody answer this question :) But I've solve the problem myself. Here is what I do for VS2015:
use package lp_solve_5.5.2.5_dev_win32.zip
add the .h file and .lib as above
change the run library, through properties -> C/C++ -> code generation -> run library -> change the DLL(/MDd) to (/MTd)
if you still got some fprintf issues, go to properties -> linker -> input -> additional dependency, and add : legacy_stdio_definitions.lib
That will be OK. That my be some translation issue, yes I use the chinese-version VS...
- lp_solve 线性规划求解包的使用
- 整数线性规划(ILP)—lp_solve
- 线性规划问题的matlab求解
- 线性规划问题的matlab求解
- matlab求解线性规划问题
- 线性规划求解路径问题
- matlab 求解线性规划问题
- 单纯形求解线性规划
- matlab 求解线性规划
- 线性规划的python的pulp包
- 从线性规划到单纯形法的求解
- 利用Matlab求解线性规划问题
- 用 Octave 求解线性规划问题
- 单纯形法 -- 求解线性规划
- 快速用matlab求解线性规划
- 两阶段法求解线性规划求解
- 线性规划问题求解的几种可能结果及判定方法
- 几类可以神奇转化为线性规划的问题matlab求解
- Github项目解析(九)-->实现Activity跳转动画的五种方式
- 负载均衡原理与技术实现
- 阿里云发布ECS磁盘加密,一键加密,业务0改动
- Git 的 .gitignore 配置
- 练习 13:文档:Google
- lp_solve 线性规划求解包的使用
- 手把手图文说明如何在Eclipse中查看JDK类库的源代码(JDK1.8,Eclipse Oxygen)
- 【BZOJ3669】【NOI2014】魔法森林 LCT
- 解析Json数组格式
- VS2012一打开就停止工作的解决办法
- JAVA和C之间的socket通信
- 自己写“俄罗斯方块”(一).实现基本业务逻辑和绘图
- java设计模式(十三)——模板方法模式(Template Method)
- 大数据产品推荐:金鹏汽车金融大数据风控系统