Write settings to a parameter file.
unsigned char write_params(lprec *lp, char *filename, char *options);
Return Value
Returns TRUE (1) if parameters could be written, else FALSE (0).
Parameters
lp
Pointer to previously created lp model. See return value of make_lp, copy_lp, read_lp, read_LP, read_mps, read_freemps, read_MPS, read_freeMPS, read_XLI
filename
Filename to write the parameters to.
options
Optional options. Can be:
-h header: Write parameters at specified header. By default this is Default
Remarks
All lp_solve parameters (options) are written to a parameter file. This file has an ini-format as used by Windows applications. All parameters are written under a header. This is by default [Default]. The header can be specified in the options parameter. Other headers are preserved.
Example parameter file:
[Default] ; lp_solve version 5.5 settings anti_degen=ANTIDEGEN_FIXEDVARS + ANTIDEGEN_STALLING + ANTIDEGEN_INFEASIBLE basiscrash=CRASH_NONE improve=IMPROVE_DUALFEAS + IMPROVE_THETAGAP maxpivot=250 negrange=-1e+006 pivoting=PRICER_DEVEX + PRICE_ADAPTIVE presolve=PRESOLVE_NONE presolveloops=2147483647 scalelimit=5 scaling=SCALE_GEOMETRIC + SCALE_EQUILIBRATE + SCALE_INTEGERS simplextype=SIMPLEX_DUAL_PRIMAL bb_depthlimit=-50 bb_floorfirst=BRANCH_AUTOMATIC bb_rule=NODE_PSEUDONONINTSELECT + NODE_GREEDYMODE + NODE_DYNAMICMODE + NODE_RCOSTFIXING ;break_at_first=0 ;break_at_value=-1e+030 mip_gap_abs=1e-011 mip_gap_rel=1e-011 epsint=1e-007 epsb=1e-010 epsd=1e-009 epsel=1e-012 epsperturb=1e-005 epspivot=2e-007 infinite=1e+030 ;debug=0 ;obj_bound=1e+030 ;print_sol=0 ;timeout=0 ;trace=0 ;verbose=NORMAL
Note that there are some options commented out (;). This is done because these options can not be used in general for all models or because they are debug/trace/print options. These options can be made active and will be read by read_params but note again that they are possible dangerous to be used in general (except for the debug/trace/print options). Note that there are two kind of entries:
Numercial values can be integer values like maxpivot or floating point values like epsel
Options are a combination of constants as defined in the manual. Multiple options are added with +. For example option anti_degen.
Example
#include <stdio.h>
#include <stdlib.h>
#include "lp_lib.h"
int main(void)
{
lprec *lp;
/* Create a new LP model */
lp = make_lp(0, 0);
if(lp == NULL) {
fprintf(stderr, "Unable to create new LP model\n");
return(1);
}
write_params(lp, "a.ini", "-h MyParams"); /* Will write parameters in file a.ini under section MyParams */
delete_lp(lp);
return(0);
}
See Also make_lp, copy_lp, read_lp, read_LP, read_mps, read_freemps, read_MPS, read_freeMPS, read_XLI, read_params, reset_params