![CI](https://github.com/MarcelGosselin/LpSolveDotNet/workflows/CI/badge.svg)
# LpSolveDotNet
LpSolveDotNet is a .NET wrapper for the Mixed Integer Linear Programming (MILP) solver lp_solve. The solver lp_solve solves pure linear, (mixed) integer/binary, semi-cont and special ordered sets (SOS) models.
The wrapper works with these .NET implementations:
* .NET Framework versions 2.0 and up
* .NET Core 3.0 and up
* [.NET Standard](https://docs.microsoft.com/en-us/dotnet/standard/net-standard) 1.5 and up **See other platforms usage below**
on these platforms:
| OS | Architecture | Package to reference | Notes |
| ------- | ------------ | -------------------- | -- |
| Windows | x64 | LpSolveDotNet.Native.win-x64 | |
| Windows | x86 (or 32 bit on x64) | LpSolveDotNet.Native.win-x86 | |
| Linux | x64 | LpSolveDotNet.Native.linux-x64 | |
| Linux | x86 | LpSolveDotNet.Native.linux-x86 | |
| OSX | x86 | LpSolveDotNet.Native.osx-x86 | Not tested |
| Others | Others | LpSolveDotNet | **See other platforms usage below** |
## Standard Usage
To use `LpSolveDotNet` with one of the supported platforms listed above, follow these steps:
1. Find the package name for your target platform(s) in the table above and add it (them) to your project. The `LpSolveDotNet.Native.???` packages, which reference the `LpSolveDotNet` package, will not only add the .NET wrapper of the `lp_solve` library, it will also take care of copying the native library to your build output.
1. In your project, add a call to the `LpSolveDotNet.LpSolve.Init()` method. This will ensure that the right native library is called. If you are
1. Use one of the factory methods on `LpSolve` class to create an `LpSolve` instance:
* make_lp
* read_LP
* read_MPS
* read_XLI
1. Place the returned `LpSolve` instance into a `using` statement so it is properly disposed of when done with it.
1. Use methods on that instance. The methods are like the [official lpsolve documentation](http://lpsolve.sourceforge.net/5.5/index.htm) except the first parameter which is passed implicitly by this instance.
*In a future version, the API will look more like .NET than C. Don't worry the old syntax will stay there.*
## Other Platforms Usage
If you need to target a platform not listed above, you need to do extra steps to use `LpSolveDotNet`.
### Other .NET Targets
If your application resolves to use LpSolveDotNet's .NET Stantards targets (with an app targeting .NET Core earlier than 3.0, Xamarin...), the library will not pick up the native library by itself. The different ways to fix this are (pick one):
1. Using property `LpSolve.CustomLoadNativeLibrary`
1. Create a method that takes in a file path and enables your .NET implementation to load it
1. Assign this method to the property `LpSolve.CustomLoadNativeLibrary`
1. Call method `LpSolve.Init()`
1. Placing the native library in a folder in the paths searched by the .NET implementation. This could also be what your method `LpSolve.CustomLoadNativeLibrary` is doing.
### Other OS / Architectures
If your application runs on an OS / Architecture not listed above, you need to do the following:
1. Build [lp_solve](https://sourceforge.net/projects/lpsolve/) for your OS / Architecture combination.
1. Deploy the built native library along your application
1. (optional) Depending on your .NET version, you may need to look at [previous section](#Other-.NET-Targets)
1. If you did **not** put the native library in a folder in the paths searched by the .NET implementation, call `LpSolve.Init()` and tweak the arguments to match your case
## Examples
You can see examples in the [Demo project](./src/LpSolveDotNet.Demo/LpSolveDotNet.Demo.csproj) translated from lpsolve's original C# samples.
* [Formulation of an lp model in lpsolve](./src/LpSolveDotNet.Demo/FormulateSample.cs)
* [demo inside lp_solve_5.5.2.3_cs.net.zip](./src/LpSolveDotNet.Demo/OriginalSample.cs)
## Releases
You can see the [release history](./ReleaseNotes.md).
没有合适的资源?快使用搜索试试~ 我知道了~
LpSolveDotNet:允许在.NET中使用混合整数线性规划(MILP)求解器lp_solve
共53个文件
cs:10个
csproj:7个
md:6个
5星 · 超过95%的资源 需积分: 10 5 下载量 66 浏览量
2021-05-23
14:39:47
上传
评论
收藏 1.46MB ZIP 举报
温馨提示
LpSolveDotNet LpSolveDotNet是用于混合整数线性编程(MILP)求解器lp_solve的.NET包装器。 求解器lp_solve求解纯线性,(混合)整数/二进制,半连续和特殊有序集(SOS)模型。 包装器可与以下.NET实现一起使用: .NET Framework 2.0版及更高版本 .NET Core 3.0及更高版本 1.5及更高版本请参阅下面的其他平台使用 在这些平台上: 作业系统 建筑学 套餐参考 笔记 视窗 x64的 LpSolveDotNet.Native.win-x64 视窗 x86(或x64上的32位) LpSolveDotNet.Native.win-x86 Linux x64的 LpSolveDotNet.Native.linux-x64 Linux x86 LpSolveDotNet.Native.linux-x86
资源详情
资源评论
资源推荐
收起资源包目录
LpSolveDotNet-master.zip (53个子文件)
LpSolveDotNet-master
MigratingFromFrom3To4.md 4KB
NOTICE 308B
.github
workflows
build-doc.yaml 600B
continuous-integration.yaml 997B
deployment.yaml 1KB
LICENSE 24KB
src
LpSolveDotNet
LpSolveDotNet.csproj 1KB
PivotRuleAndModes.cs 2KB
BranchSelectorResult.cs 327B
Interop.cs 70KB
BranchAndBoundBranchSelector.cs 499B
ScalingAlgorithmAndParameters.cs 5KB
LpSolve.cs 244KB
BranchAndBoundNodeSelector.cs 706B
LpSolveDotNet.Demo
FormulateSample.cs 4KB
Program.cs 568B
OriginalSample.cs 12KB
App.config 224B
LpSolveDotNet.Demo.csproj 954B
LpSolveDotNet.sln 5KB
Directory.Build.props 4KB
Native
LpSolveDotNet.Native.win-x64.targets 535B
LpSolveDotNet.Native.win-x86.csproj 116B
Directory.Build.targets 950B
LpSolveDotNet.Native.osx-x86.csproj 116B
LpSolveDotNet.Native.linux-x86.targets 535B
LpSolveDotNet.Native.linux-x86.csproj 118B
Directory.Build.props 1KB
LpSolveDotNet.Native.win-x86.targets 535B
NativeBinaries
osx-x86
liblpsolve55.dylib 615KB
win-x86
lpsolve55.dll 380KB
linux-x64
liblpsolve55.so 679KB
win-x64
lpsolve55.dll 610KB
linux-x86
liblpsolve55.so 617KB
LpSolveDotNet.Native.win-x64.csproj 116B
LpSolveDotNet.Native.linux-x64.targets 535B
LpSolveDotNet.Native.linux-x64.csproj 118B
LpSolveDotNet.Native.osx-x86.targets 535B
.gitignore 4KB
docfx
articles
toc.yml 38B
intro.md 31B
filterConfig.yml 240B
toc.yml 99B
api
.gitignore 64B
index.md 116B
.gitignore 106B
index.md 223B
docfx.json 1KB
README.md 4KB
.editorconfig 8KB
.gitattributes 331B
ReleaseNotes.md 5KB
build
Build.cmd 513B
共 53 条
- 1
MachineryLy
- 粉丝: 29
- 资源: 4611
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论1