Implementation
To load a matrix into Xpress Optimizer we need to perform the following steps:
- Initialize Xpress Optimizer.
- Create a new problem.
- Read the matrix file.
The following C program folioinput.c (similar interfaces exist for Java and C#) shows how to load a matrix file, solve it, and write out the results. For clarity's sake we have omitted all error checking in this program except for the initialization function. In general it is recommended to test the return value of the initialization function and also whether the problem has been created and read correctly.
To use Xpress Optimizer, we need to include the header file xprs.h.
#include <stdio.h> #include "xprs.h" int main(int argc, char **argv) { XPRSprob prob; /* Initialize Xpress */ if (XPRSinit(NULL)) { char message[512]; XPRSgetlicerrmsg(message,512); printf("%s\n", message); return -1; } XPRScreateprob(&prob); /* Create a new problem */ XPRSreadprob(prob, "Folio", ""); /* Read the problem matrix */ XPRSchgobjsense(prob, XPRS_OBJ_MAXIMIZE); /* Set sense to maximization */ XPRSlpoptimize(prob, ""); /* Solve the problem */ XPRSwriteprtsol(prob, "Folio.prt", ""); /* Write results to `Folio.prt' */ XPRSdestroyprob(prob); /* Delete the problem */ XPRSfree(); /* Terminate Xpress */ return 0; }
© 2001-2025 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.