HiGHS
HiGHS copied to clipboard
C# API does not support adding multiple objectives
The HighsLpSolver-class in the C# API does not support adding and clearing multiple linear objectives, despite this being exported by the DLLs.
https://github.com/ERGO-Code/HiGHS/blob/869cbd4df4eba475f5df0774036dce1fce490c14/highs/interfaces/highs_csharp_api.cs#L180
This could be added by the following code:
[DllImport(Highslibname)]
private static extern int Highs_clearLinearObjectives(IntPtr highs);
[DllImport(Highslibname)]
private static extern int Highs_addLinearObjective(IntPtr highs, double weight, int offset, double[] coefficients, double absTolerance, double relTolerance, int priority);
public HighsStatus clearLinearObjectives()
{
return (HighsStatus)Highs_clearLinearObjectives(_highs);
}
public HighsStatus addLinearObjective(double weight, int offset, double[] coefficients, double absTolerance, double relTolerance, int priority)
{
return (HighsStatus)Highs_addLinearObjective(_highs, weight, offset, coefficients, absTolerance, relTolerance, priority);
}
Thanks, we will add this to the C# API