help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-glpk] A Simple MIP model in MathProg - (simple cplex mip model


From: Noli Sicad
Subject: Re: [Help-glpk] A Simple MIP model in MathProg - (simple cplex mip model included)
Date: Wed, 7 Nov 2012 11:36:04 +1100

You are saying that this formulation will give the right results.

#######
param number := 4;

set NUMBER := {1..number};

var x{n in NUMBER}, integer;


s.t. c1: - x[1] + x[2] + x[3]+ 10 * x[4], <= 20;
s.t. c2: x[1] - 3 * x[2] + x[3], <= 30;
s.t. c3: x[2] - 3.5 * x[4], == 0;
s.t. x1: 0 <= x[1] <= 40;
s.t. x4: 2 <= x[4] <= 3;

maximize obj: x[1] + 2 * x[2] + 3 * x[3] + x[4];

#####

X2 and X3 needs to Float / Real, based on the results of the Original
Cplex problem.

This is the answer of the CPLEX problem.

######
   No. Column name       Activity     Lower bound   Upper bound
------ ------------    ------------- ------------- -------------
     1 x1                         40             0            40
     2 x2                       10.5             0
     3 x3                       19.5             0
     4 x4           *              3             2             3
######

Still the question remains the same,

How you exactly translate this variable


var x{n in NUMBER}?


Noli

On 11/7/12, Raniere Gaia Silva <address@hidden> wrote:
> Maybe it answer your question:
>
> ###
>
> param number := 4;
>
> set NUMBER := {1..number};
>
> var x{n in NUMBER};
>
> s.t. c1: - x[1] + x[2] + x[3]+ 10 * x[4], <= 20;
> s.t. c2: x[1] - 3 * x[2] + x[3], <= 30;
> s.t. c3: x[2] - 3.5 * x[4], == 0;
> s.t. x1: 0 <= x[1] <= 40;
> s.t. x4: 2 <= x[4] <= 3;
>
> maximize obj: x[1] + 2 * x[2] + 3 * x[3] + x[4];
>
> end;
>
> ###
>
> Once your problem is a MIP, for the integer variables you must use:
>
> ###
>
> var x{n in NUMBER}, integer;
>
> ###
>
> And for binary variables:
>
> ###
>
> var x{n in NUMBER}, binary;
>
> ###
>
> Raniere
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]