Skip to content

c# nuget packing missing setBasis #2926

@EEParker

Description

@EEParker

Hello,

Thank you for all your work on this library, it is a genuine help!

Question: it seems as though setBasis is missing from the nuget package and c# api.

c#
getBasis https://github.com/ERGO-Code/HiGHS/blob/master/highs/interfaces/highs_csharp_api.cs#L347
setBasis missing?

c++
getBasis https://github.com/ERGO-Code/HiGHS/blob/master/highs/interfaces/highs_c_api.h#L998
setBasis https://github.com/ERGO-Code/HiGHS/blob/master/highs/interfaces/highs_c_api.h#L1250

For context, I'm using HiGHS for real-time power system dispatch (~2,000 variables) where the LP structure stays fixed between solves and only bound values change (simplex warm start). The current work around is P/Invoking Highs_setBasis directly, but it would be nice to have it in the nuget API.

I wasn't sure if you were taking PRs, so I've included my workaround here. This is just replicating what is already in the c++ api.

Thank you for your time.

  [DllImport(highslibname)]
  private static extern int Highs_setBasis(IntPtr highs, int[] col_status, int[] row_status);

  [DllImport(highslibname)]
  private static extern int Highs_setLogicalBasis(IntPtr highs);

  Public wrapper methods:

  public HighsStatus setBasis(HighsBasis basis)
  {
      int[] colbasstat = basis.colbasisstatus.Select(x => (int)x).ToArray();
      int[] rowbasstat = basis.rowbasisstatus.Select(x => (int)x).ToArray();
      return (HighsStatus)HighsLpSolver.Highs_setBasis(this.highs, colbasstat, rowbasstat);
  }

  public HighsStatus setLogicalBasis()
  {
      return (HighsStatus)HighsLpSolver.Highs_setLogicalBasis(this.highs);
  }

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions