user2007843
user2007843

Reputation: 609

.lp format to .zpl

I am trying to convert a program from .lp format to .zpl, but before I convert my actual program I am trying to convert a simple problem to figure out how the .zpl format will work. It is very confusing for me to use .zpl and I could use some help

Here is the program in .lp format

 Max : 3 x + 5 y;

 x <= 4;
 2 y <= 12;
 3 x + 2 y <= 18;
 x >= 0;
 y >=0;

Here is my attempted conversion to .zpl, I am getting an error for the semicolon in the first line

maximize cost : 3*x + 5*y;

subto 1 : x <= 4;
subto 2 : 2*y <= 12;
subto 3 : 3*x + 2*y <= 18;
subto 4 : x >= 0;
subto 5 : y >= 0;

Upvotes: 0

Views: 275

Answers (1)

Anders Gustafsson
Anders Gustafsson

Reputation: 15981

If I interpret the Zimpl manual, section 4, correctly, you need to declare your variables before you define your objective and constraints, i.e. you need to start with:

# Variable definitions
var x >= 0;
var y >= 0;

LPsolve apparently provides support for generating .zpl files from .lp files using a specific driver, see this link.

Upvotes: 1

Related Questions