37 views

Skip to first unread message

Sep 27, 2023, 6:55:29 AM9/27/23

to lp_solve

Hi,

im testing with a model with semi-continuous bounds:

min: + 5.77 * b + 5.76 * a;

a <= 1;

y: + b + a = 100;

2 <= a <= 100;

sec a;

a <= 1;

y: + b + a = 100;

2 <= a <= 100;

sec a;

lpsolve converts the lp-model to mps:

*<meta creator='lp_solve v5.5'>

*<meta rows=1>

*<meta columns=2>

*<meta equalities=1>

*<meta integers=0>

*<meta scvars=1>

*<meta origsense='MIN'>

*

NAME LPSolver

ROWS

N R0

E y

COLUMNS

b R0 5.7700000000 y 1.0000000000

a R0 5.7600000000 y 1.0000000000

RHS

RHS y 100.00000000

BOUNDS

LO BND a 2.0000000000

SC BND a 1.0000000000

ENDATA

*<meta rows=1>

*<meta columns=2>

*<meta equalities=1>

*<meta integers=0>

*<meta scvars=1>

*<meta origsense='MIN'>

*

NAME LPSolver

ROWS

N R0

E y

COLUMNS

b R0 5.7700000000 y 1.0000000000

a R0 5.7600000000 y 1.0000000000

RHS

RHS y 100.00000000

BOUNDS

LO BND a 2.0000000000

SC BND a 1.0000000000

ENDATA

the LO and SC bound are swapped.

in a bigger example SC was set to "100" but i cant recreate it as small example.

I know that this bound is not "good". But i think i should be interpreted as " a = 0".

Am I wrong?

Thank you,

Ralf

Sep 27, 2023, 7:51:06 AM9/27/23

to Ralf Moorbrink, lp_solve

Hello,

No, this is correct.

Since you don't use labels before your constraints,

a <= 1

Is seen as an upper bound of 1 on variable a

If you really want that this is seen as a constraint you must put it as:

R1: a <= 1;

Then you have

2 <= a <= 100

Again bounds on variable a.

Since this new upper bound is larger than the previous one, the upper bound of 1 is kept.

So at this point you have a lower bound of 2 and an upper bound of 1

And that is also how it is specified in the MPS format

LO BND a 2.0000000000

SC BND a 1.0000000000

SC BND a 1.0000000000

means that there is a lower bound of 2 and an upper bound of 1 and that the variable is semi-continuious.

As a proof, read this mps file again and let it generate the lp file:

lp_solve -mps c:\brol\a.mps -wlp con

/* LPSolver */

/* Objective function */

min: +5.77 b +5.76 a;

/* Constraints */

y: +b +a = 100;

/* Variable bounds */

2 <= a <= 1;

/* Semi-continuous variables */

sec a;

Value of objective function: 577.00000000

Actual values of the variables:

b 100

a 0

/* LPSolver */

/* Objective function */

min: +5.77 b +5.76 a;

/* Constraints */

y: +b +a = 100;

/* Variable bounds */

2 <= a <= 1;

/* Semi-continuous variables */

sec a;

Value of objective function: 577.00000000

Actual values of the variables:

b 100

a 0

Peter

--

You received this message because you are subscribed to the Google Groups "lp_solve" group.

To unsubscribe from this group and stop receiving emails from it, send an email to lp_solve+u...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/lp_solve/3c9f6728-e7bd-45d3-ad07-f528efb50324n%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all

Reply to author

Forward

0 new messages

Search

Clear search

Close search

Google apps

Main menu