Copy an existing lprec structure to a new lprec structure.
lprec *copy_lp(lprec *lp);
Return Value
Returns a pointer to a new lprec structure. This must be provided to almost all
lp_solve functions.
A NULL return value indicates an error. Specifically not enough memory
available to setup an lprec structure.
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
Remarks
The copy_lp function constructs a new LP from an existing lp structure. The new structure is independent from the original one.
Example
#include <stdio.h>
#include <stdlib.h>
#include "lp_lib.h"
int main(void)
{
lprec *lp, *lpcopy;
/* Create a new LP model */
lp = make_lp(0, 0);
if(lp == NULL) {
fprintf(stderr, "Unable to create new LP model\n");
return(1);
}
/* Model created */
/*
.
.
.
*/
lpcopy = copy_lp(lp);
/*
.
.
.
*/
delete_lp(lp);
delete_lp(lpcopy);
return(0);
}
See Also make_lp, delete_lp, free_lp, read_lp, read_LP, read_mps, read_freemps, read_MPS, read_freeMPS, read_XLI