Code: Select all

```
OPTION OPTCR=0.00001;
SETS
I products / PR1, PR2 /
J trucks / CAM1*CAM5 /
K markets / MER1, MER2 /;
PARAMETERS
A(I) offer
/ PR1 50
PR2 50 /
B(J) transport
/ CAM1 25
CAM2 25
CAM3 50
CAM4 50
CAM5 100 / ;
TABLE D(K,I) min demand
PR1 PR2
MER1 25 25
MER2 25 25 ;
SCALAR L transport cost proportional to the weight. L = proportionality constant /1/;
PARAMETERS
C(J) fixed transportation cost
/ CAM1 20
CAM2 20
CAM3 40
CAM4 40
CAM5 80 / ;
VARIABLES
X (I, J, K) quantities transported of product I to market K in truck J
Y(J,K) total quantities of product I to market K in truck J
ALFA (J, K) binary variable by which a truck can only go to a single market
BETA (J) binary variable that marks with 1 the use of a truck and with zero the non-use
Z cost of transportation ;
POSITIVE VARIABLE X,Y ;
BINARY VARIABLE ALFA,BETA ;
EQUATIONS
COSTE objetive function
OFERTA(I) offer of the product I
DEMANDA(K,I) demand of the merkat K
TRANSPORTE(J) transport of the truck J
DEFYJK(J,K) matching equation Y(J,K) and X(I,J,K)
CAMER(J,K) equation of binary variable ALFA
USOCAM(J); equation of binary variable BETA
COSTE .. Z =E= SUM((J,K), Y(J,K)*BETA(J)*C(J)*L);
OFERTA(I) .. SUM((J,K), X(I,J,K)) =L= A(I) ;
DEMANDA(K,I) .. SUM(J, X(I,J,K) ) =G= D(K,I) ;
TRANSPORTE(J) .. SUM((I,K) ,X(I,J,K)) =L= B(J);
DEFYJK(J,K) .. Y(J,K) =E= SUM(I,X(I,J,K));
CAMER(J,K) .. Y(J,K) =E= SUM(I,X(I,J,K)*ALFA(J,K));
USOCAM(J) .. BETA(J) =E= SUM(K,ALFA(J,K));
MODEL DICIEMBRE2 /ALL/ ;
SOLVE DICIEMBRE2 USING MINLP MINIMIZING Z ;
DISPLAY X.L, Z.L, Y.L, ALFA.L, BETA.L;
The lst. document tell me this........
MODEL DICIEMBRE2 OBJECTIVE Z
TYPE MINLP DIRECTION MINIMIZE
SOLVER DICOPT FROM LINE 80
**** SOLVER STATUS 1 Normal Completion
**** MODEL STATUS 5 Locally Infeasible
**** OBJECTIVE VALUE 0.0000
And this.......
** Warning ** The number of nonlinear derivatives equal to zero
in the initial point is large (= 27 percent).
A better initial point will probably help the
optimization.
Pre-triangular equations: 0
Post-triangular equations: 1
** Infeasible solution. There are no superbasic variables.
** Warning ** The number of nonlinear derivatives equal to zero
in the final point is large (= 22 percent).
Better bounds on the variables may help the
optimization.
** Warning ** The variance of the derivatives in the final
point is large (= 4.1 ). A better scaling or
better bounds on the variables will probably
help the optimization.
```

Thanks