| |||||||||||||||
| |||||||||||||||
|
Apply a primal heuristic to a knapsack problem Description The program demonstrates the use of the MIP log callback. We take the knapsack problem stored in burglar.mps and initiate a tree search. At each node, so long as the current solution is both LP optimal and integer infeasible, we truncate the solution values to create a feasible integer solution. We then update the cutoff, if the new objective value has improved it, and continue the search.
Source Files By clicking on a file name, a preview is opened at the bottom of this page.
Data Files Knapsack.csproj
<?xml version="1.0" encoding="UTF-8" standalone="no"?><Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
<XpressExampleFiles Condition="'$(XpressExampleFiles)'==''">../../data</XpressExampleFiles>
</PropertyGroup>
<ItemGroup>
<Content Include="$(XpressExampleFiles)/burglar.mps">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="FICO.Xpress.XPRSdn" Version="46.1.1"/> <!-- Version 46.01.01 or later -->
</ItemGroup>
<!-- This is for execution with "dotnet run" and friends which runs from the project directory rather than the output directory. -->
<Target AfterTargets="AfterBuild" Name="CopyExampleData">
<Copy DestinationFolder="$(ProjectDir)" SourceFiles="$(XpressExampleFiles)/burglar.mps"/>
</Target>
</Project>
| |||||||||||||||
| © Copyright 2025 Fair Isaac Corporation. |