Binary Values

View: New views
2 Messages — Rating Filter:   Alert me  

Binary Values

by Marcelo Coelho Quinho :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I am trying to use LPSolve with binary variables, but the result for some
variable values not are integer.

Ex.

(P1)
max: +d1 +d2 +3 d3 +5 d4;
+d1 +d2 +d3 +d4 <= 3.5;
d1 <= 1;
d2 <= 1;
d3 <= 1;
d4 <= 1;

int d1,d2,d3,d4;

or

(P2)
max: +d1 +d2 +3 d3 +5 d4;
+d1 +d2 +d3 +d4 <= 3.5;

bin d1,d2,d3,d4;

Result P1, P2: d1 = 0.5, d2 = 1, d3 = 1, d4 = 1;

What is wrong?

Re: Binary Values

by Peter Notebaert-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Are you using the IDE to solve these models? There is an option to ignore integer variables. It must be set.

Peter

--- In lp_solve@..., Marcelo Coelho Quinho <marceloquinho@...> wrote:

>
> Hi,
>
> I am trying to use LPSolve with binary variables, but the result for some
> variable values not are integer.
>
> Ex.
>
> (P1)
> max: +d1 +d2 +3 d3 +5 d4;
> +d1 +d2 +d3 +d4 <= 3.5;
> d1 <= 1;
> d2 <= 1;
> d3 <= 1;
> d4 <= 1;
>
> int d1,d2,d3,d4;
>
> or
>
> (P2)
> max: +d1 +d2 +3 d3 +5 d4;
> +d1 +d2 +d3 +d4 <= 3.5;
>
> bin d1,d2,d3,d4;
>
> Result P1, P2: d1 = 0.5, d2 = 1, d3 = 1, d4 = 1;
>
> What is wrong?
>