Calculating
Calculation performs after the LP has been specified.
int Calculate(IntPtr ProcessCallback)
This function performs the calculation and returns on the following results:
int calc_None = 0; // Calculation has not been provided yet
int calc_Optimal = 1; // Finished with optimal solution
int calc_Infeasible = -1; // Failed with primal infeasibility
int calc_DblInfeasible = -2; // Failed with dual infeasibility
int calc_Unknown = 2; // Finished because reached the maximum number of iterations
int calc_Suboptimal = 3; // Finished due to slow convergence
int calc_Stoped = 4; // Stopped by the user
int calc_Error = -3; // Failed due to numerical error
int calc_Unbounded = -4; // Failed because the linear program is unbounded
In general, the successful results are positive and unsuccessful results are negative.
The function has one parameter that is callback function that provides some additional control and can stop or cancel the whole calculation process. The callback function has the following signature:
int Callback(int IterCount, // Index of the current iteration
double PrimalObj, // Primal objective function value
double DualObj, // Dual objective function value
double InfPrimal, // Primal infeasibility
double InfDual, // Dual infeasibility
double Optimality // Optimality of the solution
)
This function is an optional function that can stop the iterations with some user-defined checks. When it needs to stop the calculation it should return one of the predefined values:
int res_Abort = -1; // Calculation is canceled
int res_None = 0; // Calculation continues
int res_Stop = 1; // Calculation is stopped and the results are ready
Note: Unfortunately this function is available now only for Visual C++ and Borland Delphi interfaces.
|