FICO
FICO Xpress Optimization Examples Repository
FICO Optimization Community FICO Xpress Optimization Home
Back to examples browserPrevious exampleNext example

Save/access a postsolved solution in memory

Description
We take the knapsack problem in burglar.mps and initiate a tree search. Whenever an integer solution it found it is postsolved, stored in memory, and printed to an output file. The best and final solution values, and other tree search information, are displayed on screen.

savesol_dnet.zip[download all files]

Source Files
By clicking on a file name, a preview is opened at the bottom of this page.
SaveSol.cs[download]
SaveSol.csproj[download]

Data Files





SaveSol.csproj

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net5.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="38.1.2" /> <!-- Version 38.01.02 or later -->
  </ItemGroup>

  <!-- This is for execution with "dotnet run" and friends which runs from the project directory rather than the output directory. -->
  <Target Name="CopyExampleData" AfterTargets="AfterBuild">
    <Copy SourceFiles="$(XpressExampleFiles)/burglar.mps" DestinationFolder="$(ProjectDir)" />
  </Target>

</Project>

Back to examples browserPrevious exampleNext example