programación matemática con sas®, fortran-nag y mpl

88
MIM-UCM PRO MAT OGRAMACIÓN TEMÁTICA v1.1 Asignatura: Optimizac Profesor: Áng Alumno: Alfonso d Fech Página 1 1 ción y Simulación gel Felipe Ortega de la Fuente Ruiz ha: Junio de 2009

Upload: alfonso

Post on 06-Feb-2016

24 views

Category:

Documents


0 download

DESCRIPTION

Serie de ejercicios de optimización y simulación para realizarcon Fortran-NAG, MPL y/o SAS.Incluye entre varios otros: Método del símplex, Knapsack LP (Mochila) y resolvedor genérico de Sudoku.

TRANSCRIPT

Page 1: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM

PROGRAMACIÓN

MATEMÁTICA

PROGRAMACIÓN

MATEMÁTICA v1.1

Asignatura: Optimización y Simulación

Profesor: Ángel Felipe Ortega

Alumno: Alfonso de la Fuente Ruiz

Fecha

Página 1

PROGRAMACIÓN

1.1

Optimización y Simulación

Ángel Felipe Ortega

: Alfonso de la Fuente Ruiz

Fecha: Junio de 2009

Page 2: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 2

INTRODUCCIÓN

El alumno ha recibido una serie de prácticas de optimización y simulación para realizar

con Fortran-NAG, MPL y/o SAS, con un máximo de 3 puntos y conforme a los

siguientes criterios:

Page 3: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 3

PRÁCTICAS

A continuación se incluye copia de los enunciados de las prácticas asignadas al alumno.

Se incluyen resultados, desarrollo matemático y código fuente, a continuación de cada

práctica resuelta. Cuando una práctica se ha resuelto por varios métodos, se incluyen

unos a continuación de otros.

Debido a causa de fuerza mayor, el alumno ha realizado las prácticas en una versión

educacional doméstica de SAS ante la imposibilidad de utilizar el de las aulas de la

facultad dispuesto a tal fin y efecto. La versión utilizada fue SAS 9.1.

La versión de MPLWin empleada fue la recibida durante el curso 2006-2007.

NOTAS DE LA VERSIÓN:

La presente versión corresponde a la 1.1, que viene a corregir los dos errores

señalados en la entrega de la primera versión:

- Matriz de distancias en la práctica 5 (caminos mínimos)

- Transcripción de las fórmulas a código SAS en la práctica 13 (tienda de

campaña)

Adicionalmente, se completaron las prácticas 9 (cortes de materiales) y 11 (seguridad

de una tabla).

Page 4: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 4

Page 5: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 5

CÓDIGO SAS:

TITLE 'Asignación lineal';

DATA DATOS;

INPUT D1 D2 D3 D4 D5 D6 D7 D8 D9 D10;

DATALINES;

82 32 44 51 34 63 25 46 39 60

43 85 50 1 97 91 83 39 91 62

99 27 68 94 91 83 32 81 29 9

52 87 20 82 82 44 21 69 81 71

73 53 16 93 51 47 60 37 63 42

61 84 99 48 79 45 1 51 11 35

52 65 20 44 55 82 83 60 82 45

64 83 2 58 64 22 77 78 58 46

70 82 14 61 83 9 48 84 96 47

51 2 72 48 5 9 56 99 70 10

;

PROC ASSIGN DATA=DATOS OUT=SALIDA;

COST D1 D2 D3 D4 D5 D6 D7 D8 D9 D10;

RUN;

PROC PRINT DATA=SALIDA;

SUM _FCOST_;

RUN;

Page 6: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 6

RESULTADOS:

Asignación lineal

Obs D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 _ASSIGN_ _FCOST_

1 82 32 44 51 34 63 25 46 39 60 D5 34

2 43 85 50 1 97 91 83 39 91 62 D4 1

3 99 27 68 94 91 83 32 81 29 9 D10 9

4 52 87 20 82 82 44 21 69 81 71 D7 21

5 73 53 16 93 51 47 60 37 63 42 D8 37

6 61 84 99 48 79 45 1 51 11 35 D9 11

7 52 65 20 44 55 82 83 60 82 45 D1 52

8 64 83 2 58 64 22 77 78 58 46 D3 2

9 70 82 14 61 83 9 48 84 96 47 D6 9

10 51 2 72 48 5 9 56 99 70 10 D2 2

178

Page 7: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 7

Page 8: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 8

CÓDIGO MPL:

TITLE "NTRANS";

INDEX

I=1..9; J=1..13;

DATA

A[I]=(57 65 36 50 31 68 40 60 65);

B[J]=(35 26 31 50 22 14 33 51 50 44 51 17 48);

C[I,J]=((29 61 6 17 66 62 47 9 36 99 26 80 56),

(21 45 86 48 40 51 33 94 13 66 25 82 32),

(81 12 30 38 86 68 1 3 60 38 27 40 68),

(59 73 31 50 50 68 55 1 88 87 18 88 72),

(82 55 42 45 91 50 89 49 32 3 36 60 15),

(67 77 18 38 92 84 47 98 51 2 28 62 90),

(81 4 78 25 37 70 14 7 65 59 30 80 19),

(78 80 51 35 48 26 51 58 84 51 36 99 26),

(34 79 73 98 74 34 85 78 83 67 75 83 61));

DECISION VARIABLES

X[I,J];

MIN

Z=SUM(I,J:C[I,J]*X[I,J]);

SUBJECT TO

LECONSTR[I]:SUM(J:X[I,J])<=A[I];

EQCONSTR[J]:SUM(I:X[I,J])=B[J];

END

Page 9: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 9

RESULTADOS:

MPL Modeling System - Copyright (c) 1988-1996, Maximal Software, Inc.

--------------------------------------------------------------------------------

MODEL STATISTICS

Problem name: NTRANS

Filename: NTRANS.mpl

Date: June 3, 2009

Time: 19:29

Parsing time: 0.03 sec

Solver: FortMP (mps)

Objective value: 8687.00000000

Iterations: 0

Solution time: 1.52 sec

Constraints: 22

Variables: 117

Nonzeros: 234

Density: 9 %

SOLUTION RESULT

Optimal solution found

MIN Z = 8687.0000

Page 10: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 10

DECISION VARIABLES

VARIABLE X[I,J] :

I J Activity Reduced Cost

-------------------------------------------

1 1 0.0000 39.0000

1 2 0.0000 64.0000

1 3 31.0000 0.0000

1 4 26.0000 0.0000

1 5 0.0000 36.0000

1 6 0.0000 72.0000

1 7 0.0000 47.0000

1 8 0.0000 9.0000

1 9 0.0000 31.0000

1 10 0.0000 108.0000

1 11 0.0000 9.0000

1 12 0.0000 41.0000

1 13 0.0000 48.0000

2 1 0.0000 23.0000

2 2 0.0000 40.0000

2 3 0.0000 72.0000

2 4 0.0000 23.0000

2 5 0.0000 2.0000

2 6 0.0000 53.0000

2 7 0.0000 25.0000

2 8 0.0000 86.0000

2 9 50.0000 0.0000

2 10 0.0000 67.0000

2 11 15.0000 0.0000

2 12 0.0000 35.0000

2 13 0.0000 16.0000

3 1 0.0000 90.0000

3 2 0.0000 14.0000

Page 11: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 11

3 3 0.0000 23.0000

3 4 0.0000 20.0000

3 5 0.0000 55.0000

3 6 0.0000 77.0000

3 7 33.0000 0.0000

3 8 0.0000 2.0000

3 9 0.0000 54.0000

3 10 0.0000 46.0000

3 11 0.0000 9.0000

3 12 3.0000 0.0000

3 13 0.0000 59.0000

4 1 0.0000 68.0000

4 2 0.0000 75.0000

4 3 0.0000 24.0000

4 4 0.0000 32.0000

4 5 0.0000 19.0000

4 6 0.0000 77.0000

4 7 0.0000 54.0000

4 8 38.0000 0.0000

4 9 0.0000 82.0000

4 10 0.0000 95.0000

4 11 12.0000 0.0000

4 12 0.0000 48.0000

4 13 0.0000 63.0000

5 1 0.0000 85.0000

5 2 0.0000 51.0000

5 3 0.0000 29.0000

5 4 0.0000 21.0000

5 5 0.0000 54.0000

5 6 0.0000 53.0000

5 7 0.0000 82.0000

5 8 0.0000 42.0000

5 9 0.0000 20.0000

5 10 0.0000 5.0000

5 11 0.0000 12.0000

5 12 0.0000 14.0000

5 13 31.0000 0.0000

Page 12: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 12

6 1 0.0000 66.0000

6 2 0.0000 69.0000

6 3 0.0000 1.0000

6 4 0.0000 10.0000

6 5 0.0000 51.0000

6 6 0.0000 83.0000

6 7 0.0000 36.0000

6 8 0.0000 87.0000

6 9 0.0000 35.0000

6 10 44.0000 0.0000

6 11 24.0000 0.0000

6 12 0.0000 12.0000

6 13 0.0000 71.0000

7 1 0.0000 84.0000

7 2 26.0000 0.0000

7 3 0.0000 65.0000

7 4 0.0000 1.0000

7 5 1.0000 0.0000

7 6 0.0000 73.0000

7 7 0.0000 7.0000

7 8 13.0000 0.0000

7 9 0.0000 53.0000

7 10 0.0000 61.0000

7 11 0.0000 6.0000

7 12 0.0000 34.0000

7 13 0.0000 4.0000

8 1 0.0000 70.0000

8 2 0.0000 65.0000

8 3 0.0000 27.0000

8 4 24.0000 0.0000

8 5 19.0000 0.0000

8 6 0.0000 18.0000

8 7 0.0000 33.0000

8 8 0.0000 40.0000

8 9 0.0000 61.0000

8 10 0.0000 42.0000

8 11 0.0000 1.0000

Page 13: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 13

8 12 0.0000 42.0000

8 13 17.0000 0.0000

9 1 35.0000 0.0000

9 2 0.0000 38.0000

9 3 0.0000 23.0000

9 4 0.0000 37.0000

9 5 2.0000 0.0000

9 6 14.0000 0.0000

9 7 0.0000 41.0000

9 8 0.0000 34.0000

9 9 0.0000 34.0000

9 10 0.0000 32.0000

9 11 0.0000 14.0000

9 12 14.0000 0.0000

9 13 0.0000 9.0000

-------------------------------------------

Page 14: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 14

CONSTRAINTS

CONSTRAINT LECONSTR[I] :

I Slack Shadow Price

---------------------------------------

1 0.0000 44.0000

2 0.0000 36.0000

3 0.0000 43.0000

4 0.0000 43.0000

5 0.0000 37.0000

6 0.0000 33.0000

7 0.0000 37.0000

8 0.0000 26.0000

9 0.0000 0.0000

---------------------------------------

CONSTRAINT EQCONSTR[J] :

J Slack Shadow Price

----------------------------------------

1 0.0000 -34.0000

2 0.0000 -41.0000

3 0.0000 -50.0000

4 0.0000 -61.0000

5 0.0000 -74.0000

6 0.0000 -34.0000

7 0.0000 -44.0000

8 0.0000 -44.0000

9 0.0000 -49.0000

10 0.0000 -35.0000

11 0.0000 -61.0000

12 0.0000 -83.0000

13 0.0000 -52.0000

----------------------------------------

END

Page 15: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 15

CÓDIGO SAS:

dm 'log; clear; output; clear'; /* limpiar ventanas */

TITLE 'TRANSPORTER2';

DATA DATOS;

INPUT ORIGEN $ OFERTA DESTINO1-DESTINO13;

DATALINES;

. . 35 26 31 50 22 14 33 51 50 44 51 17 48

ORIGEN_1 57 29 61 6 17 66 62 47 9 36 99 26 80 56

ORIGEN_2 65 21 45 86 48 40 51 33 94 13 66 25 82 32

ORIGEN_3 36 81 12 30 38 86 68 1 3 60 38 27 40 68

ORIGEN_4 50 59 73 31 50 50 68 55 1 88 87 18 88 72

ORIGEN_5 31 82 55 42 45 91 50 89 49 32 3 36 60 15

ORIGEN_6 68 67 77 18 38 92 84 47 98 51 2 28 62 90

ORIGEN_7 40 81 4 78 25 37 70 14 7 65 59 30 80 19

ORIGEN_8 60 78 80 51 35 48 26 51 58 84 51 36 99 26

ORIGEN_9 65 34 79 73 98 74 34 85 78 83 67 75 83 61

;

PROC TRANS COST=DATOS OUT=SALIDA;

TAILNODE ORIGEN;

HEADNODE DESTINO1-DESTINO13;

SUPPLY OFERTA;

RUN;

PROC PRINT DATA=SALIDA;

RUN;

Page 16: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 16

RESULTADOS:

TRANSPORTER2

O

b

s

OR

IG

EN

OF

ER

TA

DE

ST

IN

O1

DE

ST

IN

O2

DE

ST

IN

O3

DE

ST

IN

O4

DE

ST

IN

O5

DE

ST

IN

O6

DE

ST

IN

O7

DE

ST

IN

O8

DE

ST

IN

O9

DES

TIN

O10

DES

TIN

O11

DES

TIN

O12

DES

TIN

O13

_D

UA

L_

1

_D

EM

AN

D_

. 35 26 31 50 22 14 33 51 50 44 51 17 48 .

2

OR

IG

EN

_1

57 0 0 31 26 0 0 0 0 0 0 0 0 0 -

44

3

OR

IG

EN

_2

65 0 0 0 0 0 0 0 0 50 0 15 0 0 -

36

4

OR

IG

EN

_3

36 0 0 0 0 0 0 33 0 0 0 0 3 0 -

43

5

OR

IG

EN

_4

50 0 0 0 0 0 0 0 38 0 0 12 0 0 -

43

6

OR

IG

EN

_5

31 0 0 0 0 0 0 0 0 0 0 0 0 31 -

37

7

OR

IG

EN

_6

68 0 0 0 0 0 0 0 0 0 44 24 0 0 -

33

8

OR

IG

EN

_7

40 0 26 0 0 1 0 0 13 0 0 0 0 0 -

37

9

OR

IG

EN

_8

60 0 0 0 24 19 0 0 0 0 0 0 0 17 -

26

1

0

OR

IG

EN

_9

65 35 0 0 0 2 14 0 0 0 0 0 14 0 0

1

1

_D

UA

L_

. 34 41 50 61 74 34 44 44 49 35 61 83 52 .

Page 17: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 17

Page 18: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 18

CÓDIGO MPL:

MAX

z = 4.1950 x1 + x2;

SUBJECT TO

-1.7115 x1 + x2 <= 1.5770;

x1 + 3 x2 <= 17;

1.2990 x1 + x2 <= 10.4950;

-0.2600 x1 + x2 >= -1.3000;

x1>=0;

x2>=0;

Page 19: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 19

RESULTADOS:

MPL Modeling System - Copyright (c) 1988-1996, Maximal Software, Inc.

--------------------------------------------------------------------------------

MODEL STATISTICS

Problem name: Problem

Filename: NLINEAL.mpl

Date: June 3, 2009

Time: 19:06

Parsing time: 0.04 sec

Solver: FortMP (mps)

Objective value: 32.4054000000

Iterations: 0

Solution time: 1.83 sec

Constraints: 6

Variables: 2

Nonzeros: 10

Density: 83 %

SOLUTION RESULT

Optimal solution found

MAX z = 32.4054

Page 20: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 20

DECISION VARIABLES

PLAIN VARIABLES

Variable Name Activity Reduced Cost

------------------------------------------------------

x1 7.5658 0.0000

x2 0.6671 0.0000

------------------------------------------------------

CONSTRAINTS

PLAIN CONSTRAINTS

Constraint Name Slack Shadow Price

------------------------------------------------------

c1 13.8587 0.0000

c2 7.4330 0.0000

c3 0.0000 2.8576

c4 0.0000 -1.8576

c5 -7.5658 0.0000

c6 -0.6671 0.0000

------------------------------------------------------

END

Page 21: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 21

PROBLEMA ENTERO CÓDIGO MPL:

INTEGER

x1;

x2;

MAX

z = 4.1950 x1 + x2;

SUBJECT TO

-1.7115 x1 + x2 <= 1.5770;

x1 + 3 x2 <= 17;

1.2990 x1 + x2 <= 10.4950;

-0.2600 x1 + x2 >= -1.3000;

x1>=0;

x2>=0;

Page 22: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 22

RESULTADOS:

MPL Modeling System - Copyright (c) 1988-1996, Maximal Software, Inc.

--------------------------------------------------------------------------------

MODEL STATISTICS

Problem name: Problem

Filename: NLINEAL2.mpl

Date: June 3, 2009

Time: 19:14

Parsing time: 0.03 sec

Solver: FortMP (mps)

Objective value: 30.3650000000

Iterations: 0

Integer nodes: 0

Solution time: 1.34 sec

Constraints: 6

Variables: 2

Integers: 2

Nonzeros: 10

Density: 83 %

SOLUTION RESULT

Integer optimal solution found

MAX z = 30.3650

DECISION VARIABLES

PLAIN VARIABLES

Variable Name Activity Reduced Cost

------------------------------------------------------

x1 7.0000 -4.1950

x2 1.0000 -1.0000

------------------------------------------------------

CONSTRAINTS

PLAIN CONSTRAINTS

Constraint Name Slack Shadow Price

------------------------------------------------------

c1 12.5575 0.0000

c2 7.0000 0.0000

c3 0.4020 0.0000

c4 -0.4800 0.0000

c5 -7.0000 0.0000

c6 -1.0000 0.0000

------------------------------------------------------

END

Page 23: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 23

CÓDIGO SAS: dm 'log; clear; output; clear'; /* limpiar ventanas */

TITLE 'PL cont, ent';

PROC NLP;

MAX z;

DECVAR x1, x2;

BOUNDS x1>=0;

BOUNDS x2>=0;

LINCON -1.7115*x1 + x2 <= 1.5770;

LINCON x1 + 3*x2 <= 17;

LINCON 1.2990*x1 + x2 <= 10.4950;

LINCON -0.2600*x1 + x2 >= -1.3000;

z = 4.1950*x1 + x2;

RUN;

Page 24: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 24

RESULTADOS:

PL cont, ent

PROC NLP: Nonlinear Maximization

Gradient is computed using analytic formulas.

Hessian is computed using analytic formulas.

PL cont, ent

PROC NLP: Nonlinear Maximization

Inicio de optimización

Parámetros estimados

N Parámetro Estimación

Función

objetivo

gradiente

Restricción

de la cota

inferior

Restricción

de la cota

superior

1 x1 0.520825 4.195000 0 .

2 x2 0.971440 1.000000 0 .

Value of Objective Function = 3.1562998082

Restricciones lineales

1 1.49695 : 1.5770 >= - 1.7115 * x1 + 1.0000 * x2

2 13.56486 : 17.0000 >= + 1.0000 * x1 + 3.0000 * x2

3 8.84701 : 10.4950 >= + 1.2990 * x1 + 1.0000 * x2

4 2.13603 : 1.3000 >= + 0.2600 * x1 - 1.0000 * x2

PL cont, ent

PROC NLP: Nonlinear Maximization

Optimización Newton-Raphson Ridge

Ajuste a escala sin parámetro

Estimadores de parámetro 2

Límites inferiores 2

Límites superiores 0

Restricciones lineales 4

Utilizando hessiano ralo _

Inicio de optimización

Restricciones activas 0 Función Objetive 3.1562998082

Max Abs Gradient Element 4.195

Page 25: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 25

Itera

ción

Rein

icio

Llam

adas

de

func

ión

Restricc

iones

activas

Func

ión

obje

tiva

Cambio/de

función/o

bjetiva

Elemento/grad

iente/max

abs

Pic

o

Rati

o

entr

e

el

camb

io

actu

al

y

el

pred

icho

1 * 0 2 1 28.6

6864 25.5123 1.7666

0.0

313

0.04

38

2 * 0 3 2 32.4

0540 3.7368 0

0.0

313

0.03

81

Resultados de optimización

Iteraciones 2 Invocaciones de función 4

Invocaciones del hessiano 3 Restricciones activas 2

Función Objetive 32.405404105 Max Abs Gradient Element 0

Contraer 0 Actual Over Pred Change 0.0381314058

Todos los parámetros están restringidos activamente. No se puede llevar a cabo la

optimización.

PL cont, ent

PROC NLP: Nonlinear Maximization

Resultados de optimización

Parámetros estimados

N Parámetro Estimación

Función

objetivo

gradiente

1 x1 7.565747 4.195000

2 x2 0.667094 1.000000

Value of Objective Function = 32.405404105

Linear Constraints Evaluated at Solution

1 13.85868 = 1.5770 + 1.7115 * x1 - 1.0000 * x2

2 7.43297 = 17.0000 - 1.0000 * x1 - 3.0000 * x2

3 ACT 3.3307E-16 = 10.4950 - 1.2990 * x1 - 1.0000 * x2

4 ACT -2.22E-16 = 1.3000 - 0.2600 * x1 + 1.0000 * x2

Page 26: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 26

Page 27: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 27

CÓDIGO SAS:

TITLE ' Práctica 4: Problema de la mochila (LP)';

Data datos;

INFILE 'c:\documsas\lp\mochi.dat';

INPUT _ROW_ $1. _TYPE_ $ _RHS_ x1 x2 x3 x4 x5 x6 x7 x8 x9

x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x24

x25 x26 x27 x28 x29 x30 x31 x32 x33 x34 x35 x36 x37 x38 x39

x40 x41 x42 x43 x44 x45;

PROC LP DATA=datos;

RUN;

DATOS (mochi.sas):

z max . 95. 65. 87. 72. 89. 60. 84. 72. 53.

92. 96. 77. 98. 98. 60. 91. 72. 67. 62. 69. 71.

75. 98. 91. 95. 99. 84. 95. 65. 64. 76. 59. 90.

60. 90. 86. 58. 75. 79. 81. 80. 99. 89. 50. 55.

p le 715. 30. 34. 26. 48. 24. 22. 29. 44. 26.

31. 30. 21. 26. 34. 23. 23. 30. 35. 28. 34. 44.

11. 46. 26. 35. 21. 47. 43. 42. 14. 45. 43. 28.

37. 38. 31. 47. 29. 25. 27. 43. 29. 28. 30. 24.

. binary . 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17

18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37

38 39 40 41 42 43 44 45

Page 28: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 28

RESULTADOS:

Práctica 4: Problema de la mochila (LP)

The LP Procedure

Resumen del problema

Objective Function Max z

Rhs Variable _RHS_

Type Variable _TYPE_

Problem Density (%) 100.0

Variables Number

Binary 45

Slack 1

Total 46

Constraints Number

LE 1

Objective 1

Total 2

Práctica 4: Problema de la mochila (LP)

The LP Procedure

Resumen de la solución

Integer Optimal Solution

Objective Value 2267

Phase 1 Iterations 0

Phase 2 Iterations 36

Phase 3 Iterations 0

Page 29: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 29

Resumen de la solución

Integer Optimal Solution

Integer Iterations 0

Integer Solutions 1

Initial Basic Feasible Variables 3

Time Used (seconds) 0

Number of Inversions 4

Epsilon 1E-8

Infinity 1.797693E308

Maximum Phase 1 Iterations 100

Maximum Phase 2 Iterations 100

Maximum Phase 3 Iterations 99999999

Maximum Integer Iterations 100

Time Limit (seconds) 120

Práctica 4: Problema de la mochila (LP)

The LP Procedure

Resumen de la variable

Col

Nombre de la

variable Estado Tipo Precio Actividad Coste reducido

1 x1 BINARY 95 1 26.25

2 x2 BINARY 65 0 -12.91667

3 x3 BINARY 87 1 27.416667

4 x4 BINARY 72 0 -38

5 x5 BINARY 89 1 34

6 x6 BINARY 60 1 9.5833333

7 x7 BINARY 84 1 17.541667

8 x8 BINARY 72 0 -28.83333

9 x9 BINARY 53 0 -6.583333

10 x10 BINARY 92 1 20.958333

11 x11 BINARY 96 1 27.25

Page 30: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 30

Resumen de la variable

Col

Nombre de la

variable Estado Tipo Precio Actividad Coste reducido

12 x12 BINARY 77 1 28.875

13 x13 BINARY 98 1 38.416667

14 x14 BINARY 98 1 20.083333

15 x15 BINARY 60 1 7.2916667

16 x16 BINARY 91 1 38.291667

17 x17 BINARY 72 1 3.25

18 x18 BINARY 67 0 -13.20833

19 x19 BINARY 62 0 -2.166667

20 x20 BINARY 69 0 -8.916667

21 x21 BINARY 71 0 -29.83333

22 x22 BINARY 75 1 49.791667

23 x23 BINARY 98 0 -7.416667

24 x24 BINARY 91 1 31.416667

25 x25 BINARY 95 1 14.791667

26 x26 BINARY 99 1 50.875

27 x27 BINARY 84 0 -23.70833

28 x28 BINARY 95 0 -3.541667

29 x29 BINARY 65 0 -31.25

30 x30 BINARY 64 1 31.916667

31 x31 BINARY 76 0 -27.125

32 x32 BINARY 59 0 -39.54167

33 x33 BINARY 90 1 25.833333

34 x34 BINARY 60 0 -24.79167

35 x35 BINARY 90 1 2.9166667

36 x36 BINARY 86 1 14.958333

37 x37 BINARY 58 0 -49.70833

38 x38 BINARY 75 1 8.5416667

39 x39 BINARY 79 1 21.708333

40 x40 BINARY 81 1 19.125

Page 31: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 31

Resumen de la variable

Col

Nombre de la

variable Estado Tipo Precio Actividad Coste reducido

41 x41 BINARY 80 0 -18.54167

42 x42 BINARY 99 1 32.541667

43 x43 BINARY 89 1 24.833333

44 x44 BINARY 50 0 -18.75

45 x45 BASIC BINARY 55 1 0

46 p SLACK 0 0 -2.291667

Práctica 4: Problema de la mochila (LP)

The LP Procedure

Resumen de restricciones

Fila

Nombre

de la

restricción Tipo S/S Col Rhs Actividad Actividad dual

1 z OBJECTVE . 0 2267 .

2 p LE 46 715 715 2.2916667

Page 32: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 32

Page 33: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 33

CÓDIGO SAS:

dm 'log; clear; output; clear'; /* limpiar ventanas */

TITLE 'Práctica 5: Camino minimo (NETFLOW)';

DATA datos0;

INPUT inicial $ final $ longitud @@;

DATALINES;

A B 26 A C 82 A D 63 B A 71 B C 64 B E 23 C D 76 C E 52 C F 81

D C 75 D F 41

D G 68 E B 78 E F 39 E H 15 F D 21 F E 31 F G 12 F H 30 F I 32

G F 51 G I 46

H F 14 H I 43 I G 48 I H 72

;

%MACRO camino(fuente,sumidero);

PROC NETFLOW

SHORTPATH /* calcula un camino minimo desde el */

SOURCE=&fuente /* vertice fuente indicado en SOURCE */

SINK=&sumidero /* hasta el vertice destino indicado en SINK */

ARCDATA=datos0 /* conjunto de datos de los arcos */

ARCOUT=salida0; /* conjunto solucion sin restricciones */

TAIL inicial; /* variable de extremos iniciales de los arcos */

HEAD final; /* variable de extremos finales de los arcos */

COST longitud; /* variable de longitudes de los arcos */

RUN;

PROC PRINT DATA=salida0;

SUM _FCOST_; /* longitud del camino mínimo */

%MEND camino;

/* la matriz D(i,j) tiene diagonal nula por definición */

/* la matriz P(i,j) tiene como elementos de la diagonal los propios

coeficientes que se

repiten, ya que el nodo de salida es el mismo que el de llegada. */

%camino(A,B);%camino(A,C);%camino(A,D);%camino(A,E);%camino(A,F);%cami

no(A,G);%camino(A,H);%camino(A,I);

%camino(B,C);%camino(B,D);%camino(B,E);%camino(B,F);%camino(B,G);%cami

no(B,H);%camino(B,I);

%camino(C,D);%camino(C,E);%camino(C,F);%camino(C,G);%camino(C,H);%cami

no(C,I);

%camino(D,E);%camino(D,F);%camino(D,G);%camino(D,H);%camino(D,I);

%camino(E,F);%camino(E,G);%camino(E,H);%camino(E,I);

%camino(F,G);%camino(F,H);%camino(F,I);

%camino(G,H);%camino(G,I);

%camino(H,I);

%camino(B,A);

%camino(C,A);%camino(C,B);

%camino(D,A);%camino(D,B);%camino(D,C);

%camino(E,A);%camino(E,B);%camino(E,C);%camino(E,D);

%camino(F,A);%camino(F,B);%camino(F,C);%camino(F,D);%camino(F,E);

%camino(G,A);%camino(G,B);%camino(G,C);%camino(G,D);%camino(G,E);%cami

no(G,F);

%camino(H,A);%camino(H,B);%camino(H,C);%camino(H,D);%camino(H,E);%cami

no(H,F);%camino(H,G);

%camino(I,A);%camino(I,B);%camino(I,C);%camino(I,D);%camino(I,E);%cami

no(I,F);%camino(I,G);%camino(I,H);

RUN;

Page 34: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 34

RESULTADOS:

Nota: Se presentan exclusivamente los resultados solicitados, debido a que la

gran cantidad de datos que se generan durante la ejecución dificulta su localización.

�������

0 26 8271 0 64201 130 063 49 7873 23 5276 52 81

90 64 10764 38 8193 67 110221 150 75149 78 125180 109 960 72 4150 0 2921 31 0

53 71 7341 15 5812 30 32231 160 147194 123 110226 195 18272 82 5135 45 14107 117 86

0 81 4626 0 4348 72 0 ������� ;

�������

� � �� � �� � �� � �� � �� � �

� � �� � �� � �� � �� � �� � �� � �� � �� � �

� � �� � �� � �� � �� � �� � �� � �� � �� � �

� � �� � �� � � �������

Representación tridimensional de la matriz D(i,j)

Page 35: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 35

Page 36: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 36

Nota: Como los problemas de esta práctica son iguales para todos los alumnos y

se encuentran varios datos con formato “#.d0” no definido, se han inicializado éstos

arbitrariamente con los siguientes valores:

1.d0 = 1;

2.d0 = 2;

4.d0 = 4;

CÓDIGO SAS:

dm 'log; clear; output; clear'; /* limpiar ventanas */

TITLE 'Práctica 6';

PROC NLP TECH=QUANEW OUTDER=2 OUT=DERIV;

MIN f;

DECVAR x, a, b;

BOUNDS 0.1 <= x;

BOUNDS x <= 10;

BOUNDS a = 63.713763809150;

BOUNDS b = 41.890578570612;

f= EXP(4*x)*(x*x+1) + EXP(2*x)*(1/(x*x)-a*x-b) -

b*SQRT(2*b)*EXP(x)/(a*x) + 1/(x*x) - 2*b/(a*x);

RUN;

proc export DATA=DERIV;

outfile='c:/QN.xls' /** ".xls" lets SAS know you

want an Excel 5 spreadsheet **/

replace; /** if file already exists overwrite it

***/

RUN;

Page 37: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 37

RESULTADOS:

Práctica 6

PROC NLP: Nonlinear Minimization

Gradient is computed using analytic formulas.

El punto inicial se ha cambiado para que se ajuste a las restricciones de los límites

y líneas.

Práctica 6

PROC NLP: Nonlinear Minimization

Inicio de optimización

Parámetros estimados

N Parámetro Estimación

Función

objetivo

gradiente

Restricción

de la cota

inferior

Restricción

de la cota

superior

Restricción

de la cota

activa

1 x 0.105310 -3137.914104 0.100000 10.000000

2 a 63.713764 1.062502 63.713764 63.713764 Equal BC

3 b 41.890579 -3.806022 41.890579 41.890579 Equal BC

Value of Objective Function = 67.045272295

Práctica 6

PROC NLP: Nonlinear Minimization

Optimización Dual Quasi-Newton

Actualización Dual Broyden - Fletcher - Goldfarb - Shanno (DBFGS)

Estimadores de parámetro 3

Límites inferiores 3

Límites superiores 3

Inicio de optimización

Restricciones activas 2 Función Objetive 67.045272295

Max Abs Gradient Element 3137.9141041

Itera

ción

Rein

icio

Llam

adas

de

func

ión

Restric

ciones

activas

Funció

n

objeti

va

Cambio/de

función/o

bjetiva

Elemento/grad

iente/max

abs

Tam

año

del

pas

o

Pendi

ente

de

direc

ción

de

búsqu

eda

1 0 3 2 -

158.43225.5 460.8

0.0

100

-

98465

Page 38: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 38

Itera

ción

Rein

icio

Llam

adas

de

func

ión

Restric

ciones

activas

Funció

n

objeti

va

Cambio/de

función/o

bjetiva

Elemento/grad

iente/max

abs

Tam

año

del

pas

o

Pendi

ente

de

direc

ción

de

búsqu

eda

149

2 0 9 2 -1462 1303.3 221.5 20.

620

-

24.89

0

3 0 12 2 -1463 1.2982 4.0312 0.0

467

-

57.51

7

4 0 13 2 -1463 0.000455 0.1690 1.0

00

-

0.000

9

5 0 14 2 -1463 8.006E-7 0.000137 1.0

00

-16E-

7

Resultados de optimización

Iteraciones 5 Invocaciones de

función 15

Invocaciones del gradiente 10 Restricciones

activas 2

Función Objetive -1463.052601 Max Abs Gradient

Element 0.0001374811

Coeficiente angular de la dirección

de búsqueda -1.602532E-6

Se ha cumplido el criterio de convergencia GCONV.

Práctica 6

PROC NLP: Nonlinear Minimization

Resultados de optimización

Parámetros estimados

N Parámetro Estimación

Función

objetivo

gradiente

Restricción

de la cota

activa

1 x 1.520957 0.000137

2 a 63.713764 -31.559097 Equal BC

3 b 41.890579 -21.614350 Equal BC

Value of Objective Function = -1463.052601

Page 39: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 39

Page 40: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 40

CÓDIGO SAS: dm 'log; clear; output; clear'; /* limpiar ventanas */

TITLE 'Práctica 7';

PROC NLP TECH=QUANEW OUTDER=2 OUT=DERIV;

MIN fun3var;

DECVAR x1, x2, x3;

BOUNDS 0 <= x1 <= 5 , 0 <= x2 <= 10 , 0 <= x3 <= 5;

a1 = 24.665891385860;

a2 = 125.351473505031;

a3 = 18.591678701323;

a4 = -3.617939559061;

a5 = 1.068186354366;

a6 = -40.792884280481;

a7 = -10.335310127742;

a8 = 8.652942945809;

a9 = -109.638597480922;

a10 = 0.267046588592;

a11 = -63.580221642281;

a12 = -2.947260567328;

fun3var = x1**4 + (1+x1**2)*EXP(2*x3) + a1*x1**2 + a2*x1 + a3*x2**2 +

a4*x2 + a5*x3**2 + a6*x1*x2 + a7*x1*x3 + a8*x2*x3 +

(a9*x1 + a10*x2**2 + a11)*EXP(x3) + a12*x2*EXP(x3/2);

RUN;

Page 41: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 41

RESULTADOS:

Práctica 7

PROC NLP: Nonlinear Minimization

Gradient is computed using analytic formulas.

Práctica 7

PROC NLP: Nonlinear Minimization

Inicio de optimización

Parámetros estimados

N Parámetro Estimación

Función

objetivo

gradiente

Restricción

de la cota

inferior

Restricción

de la cota

superior

1 x1 0.004714 -156.748523 0 5.000000

2 x2 0.225285 7.889575 0 10.000000

3 x3 0.879179 -139.502460 0 5.000000

Value of Objective Function = -146.4262955

Práctica 7

PROC NLP: Nonlinear Minimization

Optimización Dual Quasi-Newton

Actualización Dual Broyden - Fletcher - Goldfarb - Shanno (DBFGS)

Estimadores de parámetro 3

Límites inferiores 3

Límites superiores 3

Inicio de optimización

Restricciones activas 0 Función Objetive -146.4262955

Max Abs Gradient Element 156.74852334

Itera

ción

Rein

icio

Llam

adas

de

func

ión

Restric

ciones

activas

Func

ión

obje

tiva

Cambio/de

función/o

bjetiva

Elemento/grad

iente/max

abs

Tam

año

del

pas

o

Pendi

ente

de

direc

ción

de

búsqu

eda

1 0 7 0 -

3355 3208.9 1299.9

0.5

29

-

1406.

5

2 0 10 0 - 53.1944 950.6 0.0 -

Page 42: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 42

Itera

ción

Rein

icio

Llam

adas

de

func

ión

Restric

ciones

activas

Func

ión

obje

tiva

Cambio/de

función/o

bjetiva

Elemento/grad

iente/max

abs

Tam

año

del

pas

o

Pendi

ente

de

direc

ción

de

búsqu

eda

3409 856 4895.

7

3 0 11 0 -

3655 246.8 1184.9

0.1

00

-

5922.

2

4 0 12 0 -

3755 99.8826 146.3

1.0

00

-

384.9

5 0 13 0 -

3811 55.7249 81.6659

1.0

00

-

86.67

8

6 0 15 0 -

3817 5.7469 32.0083

0.7

34

-

18.97

1

7 0 17 0 -

3817 0.3026 6.8334

1.0

15

-

0.732

8 0 19 0 -

3817 0.0105 0.8184

1.0

00

-

0.021

1

9 0 21 0 -

3817 0.000060 0.1770

1.0

00

-

0.000

2

10 0 23 0 -

3817 3.082E-6 0.000288

1.0

00

-

617E-

8

Resultados de optimización

Iteraciones 10 Invocaciones de

función 24

Invocaciones del gradiente 16 Restricciones

activas 0

Función Objetive -3816.977469 Max Abs Gradient

Element 0.0002882731

Coeficiente angular de la dirección

de búsqueda -6.170849E-6

Se ha cumplido el criterio de convergencia GCONV.

Práctica 7

PROC NLP: Nonlinear Minimization

Resultados de optimización

Page 43: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 43

Parámetros estimados

N Parámetro Estimación

Función

objetivo

gradiente

1 x1 1.516766 -0.000203

2 x2 0.935117 0.000167

3 x3 3.550296 -0.000288

Value of Objective Function = -3816.977469

Page 44: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 44

NO FIGURA

Page 45: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 45

Page 46: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 46

DESARROLLO:

1 2 3 4 5 6 6

47,99 48,02 54,04 36,64 64,22 46,57 100

18 13 9 15 10 14

Uso Resma

1 1 47,99 52,01

2 2 95,98 4,02

3 1 48,02 51,98

4 2 96,04 3,96

5 1 54,04 45,96

6 1 36,64 63,36

7 2 73,28 26,72

8 1 64,22 35,78

9 1 46,57 53,43

10 2 93,14 6,86

11 1 1 96,01 3,99

12 1 1 94,56 5,44

13 1 1 94,59 5,41

14 1 1 90,68 9,32

15 1 1 84,66 15,34

16 1 1 84,63 15,37

17 1 1 83,21 16,79

Page 47: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 47

CÓDIGO MPL:

INTEGER

X01; X02; X03; X04; X05;

X06; X07; X08; X09; X10;

X11; X12; X13; X14; X15;

X16; X17;

MIN

Z=52.01*X01 + 04.02*X02+ 51.98*X03+ 03.96*X04+ 45.96*X05+

63.36*X06 + 26.72*X07+ 35.78*X08+ 53.43*X09+ 06.86*X10+

03.99*X11 + 05.44*X12+ 05.41*X13+ 09.32*X14+ 15.34*X15+

15.37*X16 + 16.79*X17;

SUBJECT TO

X01+2*X02+X11+X12+X16 >= 18;

X03+2*X04+X11+X13+X15 >= 13;

X05+X14 >= 9;

X06+2*X07+X14+X15+X16+X17 >= 15;

X08 >= 10;

X09+2*X10+X12+X13+X17 >= 14;

X01>=0; X02>=0; X03>=0; X04>=0; X05>=0;

X06>=0; X07>=0; X08>=0; X09>=0; X10>=0;

X11>=0; X12>=0; X13>=0; X14>=0; X15>=0;

X16>=0; X17>=0;

Page 48: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 48

RESULTADOS:

MPL Modeling System - Copyright (c) 1988-1996, Maximal

Software, Inc.

----------------------------------------------------------------------

----------

MODEL STATISTICS

Problem name: Problem

Filename: CORTES.mpl

Date: June 15, 2009

Time: 12:48

Parsing time: 0.07 sec

Solver: FortMP (mps)

Objective value: 609.520000000

Iterations: 0

Integer nodes: 0

Solution time: 2.47 sec

Constraints: 23

Variables: 17

Integers: 17

Nonzeros: 41

Density: 10 %

SOLUTION RESULT

Integer optimal solution found

MIN Z = 609.5200

DECISION VARIABLES

PLAIN VARIABLES

Variable Name Activity Reduced Cost

------------------------------------------------------

X01 0.0000 0.0000

X02 0.0000 -3.9600

X03 0.0000 0.0000

X04 5.0000 3.9600

X05 0.0000 0.0000

X06 0.0000 0.0000

X07 0.0000 0.0000

X08 10.0000 0.0000

X09 0.0000 0.0000

Page 49: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 49

X10 0.0000 0.0000

X11 4.0000 0.0000

X12 14.0000 0.0000

X13 0.0000 0.0000

X14 15.0000 0.0000

X15 0.0000 6.0200

X16 0.0000 2.0600

X17 0.0000 6.0200

------------------------------------------------------

CONSTRAINTS

PLAIN CONSTRAINTS

Constraint Name Slack Shadow Price

------------------------------------------------------

c1 0.0000 -3.9900

c2 -1.0000 0.0000

c3 -6.0000 0.0000

c4 0.0000 -9.3200

c5 0.0000 -35.7800

c6 0.0000 -1.4500

c7 0.0000 -48.0200

c8 0.0000 0.0000

c9 0.0000 -51.9800

c10 -5.0000 0.0000

c11 0.0000 -45.9600

c12 0.0000 -54.0400

c13 0.0000 -8.0800

c14 -10.0000 0.0000

c15 0.0000 -51.9800

c16 0.0000 -3.9600

c17 -4.0000 0.0000

c18 -14.0000 0.0000

c19 0.0000 -3.9600

c20 -15.0000 0.0000

c21 0.0000 0.0000

c22 0.0000 0.0000

c23 0.0000 0.0000

------------------------------------------------------

END

Page 50: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 50

NO FIGURA

Page 51: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 51

Page 52: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 52

CÓDIGO MPL:

{NOTA: Retirar '!' en una variable cada vez, y repetir todas para MAX}

MIN

!MAX

! xa1;

! xa4;

! xa5;

! xb3;

! xb6;

! xc2;

! xc3;

! xc6;

! xd4;

! xd7;

! xd8;

! xe3;

! xe9;

! xf4;

! xf5;

! xg2;

! xg8;

! xh2;

! xh9;

! xi6;

! xi9;

! xj1;

! xj7;

SUBJECT TO

Page 53: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 53

!POSITIVOS:

xa1>=0; xa4>=0; xa5>=0; xb3>=0; xb6>=0; xc2>=0;

xc3>=0; xc6>=0; xd4>=0; xd7>=0; xd8>=0; xe3>=0;

xe9>=0; xf4>=0; xf5>=0; xg2>=0; xg8>=0; xh2>=0;

xh9>=0; xi6>=0; xi9>=0; xj1>=0; xj7>=0;

!HORIZONTALES:

xa1 + 17 + 17 + xa4 + xa5 + 18 + 6 + 13 + 15 + 10 = 110;

19 + 8 + xb3 + 4 + 8 + xb6 + 7 + 12 + 9 + 19 = 103;

8 + xc2 + xc3 + 10 + 15 + xc6 + 18 + 16 + 15 + 14 = 112;

10 + 9 + 8 + xd4 + 13 + 19 + xd7 + xd8 + 9 + 1 = 95;

8 + 16 + xe3 + 16 + 15 + 2 + 8 + 11 + xe9 + 4 = 95;

5 + 12 + 1 + xf4 + xf5 + 18 + 10 + 11 + 14 + 17 = 116;

10 + xg2 + 9 + 14 + 17 + 8 + 2 + xg8 + 5 + 16 = 113;

10 + xh2 + 6 + 17 + 9 + 2 + 14 + 10 + xh9 + 9 = 83;

15 + 13 + 18 + 7 + 1 + xi6 + 4 + 9 + xi9 + 3 = 94;

xj1 + 18 + 16 + 16 + 9 + 9 + xj7 + 4 + 2 + 1 = 96;

!ctes: 10 + 12 + 8 + 11 + 17 + 10 + 10 + 10 + 9 + 19 = 116;

!total: 105 131 103 119 122 104 99 131 106 113 = 1133;

!VERTICALES:

xa1+19+8+10+8+5+10+10+15+xj1+10=105;

17+8+xc2+9+16+12+xg2+xh2+13+18+12=131;

17+xb3+xc3+8+xe3+1+9+6+18+16+8=103;

xa4+4+10+xd4+16+xf4+14+17+7+16+11=119;

xa5+8+15+13+15+xf5+17+9+1+9+17=122;

18+xb6+xc6+19+2+18+8+2+xi6+9+10=104;

6+7+18+xd7+8+10+2+14+4+xj7+10=99;

13+12+16+xd8+11+11+xg8+10+9+4+10=131;

15+9+15+9+xe9+14+5+xh9+xi9+2+9=106;

!ctes: 10+19+14+1+4+17+16+9+3+1+19=113;

Page 54: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 54

{

| | I | II | III | IV | V | VI | VII | VIII| IX | X | total |

|-----|-----------------------------------------------------------|-------|

| A | xa1 | 17 | 17 | xa4 | xa5 | 18 | 6 | 13 | 15 | 10 | 110 |

|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-------|

| B | 19 | 8 | xb3 | 4 | 8 | xb6 | 7 | 12 | 9 | 19 | 103 |

|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-------|

| C | 8 | xc2 | xc3 | 10 | 15 | xc6 | 18 | 16 | 15 | 14 | 112 |

|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-------|

| D | 10 | 9 | 8 | xd4 | 13 | 19 | xd7 | xd8 | 9 | 1 | 95 |

|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-------|

| E | 8 | 16 | xe3 | 16 | 15 | 2 | 8 | 11 | xe9 | 4 | 95 |

|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-------|

| F | 5 | 12 | 1 | xf4 | xf5 | 18 | 10 | 11 | 14 | 17 | 116 |

|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-------|

| G | 10 | xg2 | 9 | 14 | 17 | 8 | 2 | xg8 | 5 | 16 | 113 |

|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-------|

| H | 10 | xh2 | 6 | 17 | 9 | 2 | 14 | 10 | xh9 | 9 | 83 |

|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-------|

| I | 15 | 13 | 18 | 7 | 1 | xi6 | 4 | 9 | xi9 | 3 | 94 |

|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-------|

| J | xj1 | 18 | 16 | 16 | 9 | 9 | xj7 | 4 | 2 | 1 | 96 |

|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-------|

| K | 10 | 12 | 8 | 11 | 17 | 10 | 10 | 10 | 9 | 19 | 116 |

|-----|-----------------------------------------------------------|-------|

|total| 105 | 131 | 103 | 119 | 122 | 104 | 99 | 131 | 106 | 113 | 1133 |

}

Page 55: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 55

RESULTADOS: Nota: se ejecuta el procedimiento dos veces con cada variable, una para minimizar (rango inferior) y otra para maximizar (rango superior), anotando el resultado de la función objetivo en la casilla correspondiente.

Page 56: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 56

CÓDIGO SAS: dm 'log; clear; output; clear'; /* limpiar ventanas */

TITLE 'PL cont, ent';

data TABLE;

format _id_ $6.;

input _id_ $ Y1-Y23 _type_ $ _rhs_;

datalines;

incog 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 min .

/* NOTA: Ejecutar con una variable cada vez y repetir para MAX */

/* Y1 ,Y2 ,Y3 ,Y4 ,Y5 ,Y6 ,Y7 ,Y8 ,Y9

,Y10,Y11,Y12,Y13,Y14,Y15,Y16,Y17,Y18,Y19,Y20,Y21,Y22,Y23; */

/*

xa1,xa4,xa5,xb3,xb6,xc2,xc3,xc6,xd4,xd7,xd8,xe3,xe9,xf4,xf5,xg2,xg8,xh2,xh9,xi6,xi9,xj1,

xj7; */

/* POSITIVOS */

pos01 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ge 0

pos02 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ge 0

pos03 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ge 0

pos04 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ge 0

pos05 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ge 0

pos06 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ge 0

pos07 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ge 0

pos08 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ge 0

pos09 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ge 0

pos10 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 ge 0

pos11 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 ge 0

pos12 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 ge 0

pos13 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 ge 0

pos14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 ge 0

pos15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 ge 0

pos16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 ge 0

pos17 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 ge 0

pos18 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 ge 0

pos19 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 ge 0

pos20 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 ge 0

pos21 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 ge 0

pos22 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 ge 0

pos23 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 ge 0

/* xa1>=0, xa4>=0, xa5>=0, xb3>=0, xb6>=0, xc2>=0,

xc3>=0, xc6>=0, xd4>=0, xd7>=0, xd8>=0, xe3>=0,

xe9>=0, xf4>=0, xf5>=0, xg2>=0, xg8>=0, xh2>=0,

xh9>=0, xi6>=0, xi9>=0, xj1>=0, xj7>=0; */

/* HORIZONTALES: */

/* Los coeficientes de igualdad salen de restar las constantes al subtotal de FILA */

hor01 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 eq 14

hor02 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 eq 17

hor03 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 eq 16

hor04 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 eq 26

hor05 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 eq 15

hor06 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 eq 28

hor07 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 eq 32

hor08 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 eq 6

hor09 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 eq 24

hor10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 eq 21

/* xa1 + 17 + 17 + xa4 + xa5 + 18 + 6 + 13 + 15 + 10 = 110,

19 + 8 + xb3 + 4 + 8 + xb6 + 7 + 12 + 9 + 19 = 103,

8 + xc2 + xc3 + 10 + 15 + xc6 + 18 + 16 + 15 + 14 = 112,

10 + 9 + 8 + xd4 + 13 + 19 + xd7 + xd8 + 9 + 1 = 95,

8 + 16 + xe3 + 16 + 15 + 2 + 8 + 11 + xe9 + 4 = 95,

5 + 12 + 1 + xf4 + xf5 + 18 + 10 + 11 + 14 + 17 = 116,

10 + xg2 + 9 + 14 + 17 + 8 + 2 + xg8 + 5 + 16 = 113,

10 + xh2 + 6 + 17 + 9 + 2 + 14 + 10 + xh9 + 9 = 83,

15 + 13 + 18 + 7 + 1 + xi6 + 4 + 9 + xi9 + 3 = 94,

xj1 + 18 + 16 + 16 + 9 + 9 + xj7 + 4 + 2 + 1 = 96, */

/* !ctes: 10 + 12 + 8 + 11 + 17 + 10 + 10 + 10 + 9 + 19 = 116,

!total: 105 131 103 119 122 104 99 131 106 113 = 1133; */

/* !VERTICALES: */

/* Los coeficientes de igualdad salen de restar las constantes al subtotal de COLUMNA */

ver01 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 eq 10

ver02 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 eq 26

ver03 0 0 0 1 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 eq 20

ver04 0 1 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 eq 24

ver05 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 eq 18

Page 57: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 57

ver06 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 eq 18

ver07 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 eq 20

ver08 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 eq 35

ver09 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 1 0 0 eq 37

/* Y1 ,Y2 ,Y3 ,Y4 ,Y5 ,Y6 ,Y7 ,Y8 ,Y9

,Y10,Y11,Y12,Y13,Y14,Y15,Y16,Y17,Y18,Y19,Y20,Y21,Y22,Y23; */

/*

xa1,xa4,xa5,xb3,xb6,xc2,xc3,xc6,xd4,xd7,xd8,xe3,xe9,xf4,xf5,xg2,xg8,xh2,xh9,xi6,xi9,xj1,

xj7; */

/* xa1+19+8+10+8+5+10+10+15+xj1+10=105,

17+8+xc2+9+16+12+xg2+xh2+13+18+12=131,

17+xb3+xc3+8+xe3+1+9+6+18+16+8=103,

xa4+4+10+xd4+16+xf4+14+17+7+16+11=119,

xa5+8+15+13+15+xf5+17+9+1+9+17=122,

18+xb6+xc6+19+2+18+8+2+xi6+9+10=104,

6+7+18+xd7+8+10+2+14+4+xj7+10=99,

13+12+16+xd8+11+11+xg8+10+9+4+10=131,

15+9+15+9+xe9+14+5+xh9+xi9+2+9=106; */

/* !ctes: 10+19+14+1+4+17+16+9+3+1+19=113 */

;

proc lp;

run;

/*

| | I | II | III | IV | V | VI | VII | VIII| IX | X | total |

|-----|-----------------------------------------------------------|-------|

| A | xa1 | 17 | 17 | xa4 | xa5 | 18 | 6 | 13 | 15 | 10 | 110 |

|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-------|

| B | 19 | 8 | xb3 | 4 | 8 | xb6 | 7 | 12 | 9 | 19 | 103 |

|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-------|

| C | 8 | xc2 | xc3 | 10 | 15 | xc6 | 18 | 16 | 15 | 14 | 112 |

|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-------|

| D | 10 | 9 | 8 | xd4 | 13 | 19 | xd7 | xd8 | 9 | 1 | 95 |

|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-------|

| E | 8 | 16 | xe3 | 16 | 15 | 2 | 8 | 11 | xe9 | 4 | 95 |

|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-------|

| F | 5 | 12 | 1 | xf4 | xf5 | 18 | 10 | 11 | 14 | 17 | 116 |

|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-------|

| G | 10 | xg2 | 9 | 14 | 17 | 8 | 2 | xg8 | 5 | 16 | 113 |

|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-------|

| H | 10 | xh2 | 6 | 17 | 9 | 2 | 14 | 10 | xh9 | 9 | 83 |

|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-------|

| I | 15 | 13 | 18 | 7 | 1 | xi6 | 4 | 9 | xi9 | 3 | 94 |

|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-------|

| J | xj1 | 18 | 16 | 16 | 9 | 9 | xj7 | 4 | 2 | 1 | 96 |

|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-------|

| K | 10 | 12 | 8 | 11 | 17 | 10 | 10 | 10 | 9 | 19 | 116 |

|-----|-----------------------------------------------------------|-------|

|total| 105 | 131 | 103 | 119 | 122 | 104 | 99 | 131 | 106 | 113 | 1133 |

*/

RUN;

Page 58: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 58

RESULTADOS:

Nota: Resultado idéntico al método MPL. Se adjunta como muestra la salida de programa que obtiene el umbral inferior para la primera incógnita.

PL cont, ent

The LP Procedure

Resumen del problema

Objective Function Min incog

Rhs Variable _rhs_

Type Variable _type_

Problem Density (%) 0.00

Variables Number

Non-negative 23

Total 23

Constraints Number

Objective 1

Total 1

PL cont, ent

The LP Procedure

Resumen de la solución

Terminated Successfully

Objective Value 0

Phase 1 Iterations 0

Phase 2 Iterations 0

Page 59: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 59

Resumen de la solución

Terminated Successfully

Phase 3 Iterations 0

Integer Iterations 0

Integer Solutions 0

Initial Basic Feasible Variables 2

Time Used (seconds) 0

Number of Inversions 2

Epsilon 1E-8

Infinity 1.797693E308

Maximum Phase 1 Iterations 100

Maximum Phase 2 Iterations 100

Maximum Phase 3 Iterations 99999999

Maximum Integer Iterations 100

Time Limit (seconds) 120

PL cont, ent

The LP Procedure

Resumen de la variable

Col

Nombre de la

variable Estado Tipo Precio Actividad Coste reducido

1 Y1 NON-NEG 1 0 1

2 Y2 ALTER NON-NEG 0 0 0

3 Y3 ALTER NON-NEG 0 0 0

4 Y4 ALTER NON-NEG 0 0 0

5 Y5 ALTER NON-NEG 0 0 0

6 Y6 ALTER NON-NEG 0 0 0

7 Y7 ALTER NON-NEG 0 0 0

8 Y8 ALTER NON-NEG 0 0 0

9 Y9 ALTER NON-NEG 0 0 0

10 Y10 ALTER NON-NEG 0 0 0

Page 60: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 60

Resumen de la variable

Col

Nombre de la

variable Estado Tipo Precio Actividad Coste reducido

11 Y11 ALTER NON-NEG 0 0 0

12 Y12 ALTER NON-NEG 0 0 0

13 Y13 ALTER NON-NEG 0 0 0

14 Y14 ALTER NON-NEG 0 0 0

15 Y15 ALTER NON-NEG 0 0 0

16 Y16 ALTER NON-NEG 0 0 0

17 Y17 ALTER NON-NEG 0 0 0

18 Y18 ALTER NON-NEG 0 0 0

19 Y19 ALTER NON-NEG 0 0 0

20 Y20 ALTER NON-NEG 0 0 0

21 Y21 ALTER NON-NEG 0 0 0

22 Y22 ALTER NON-NEG 0 0 0

23 Y23 ALTER NON-NEG 0 0 0

PL cont, ent

The LP Procedure

Resumen de restricciones

Fila

Nombre de la

restricción Tipo S/S Col Rhs Actividad Actividad dual

1 incog OBJECTVE . 0 0 .

Page 61: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 61

NO FIGURA

Page 62: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 62

Page 63: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 63

DESARROLLO:

� = � + �

, �, �? | min'(); �*+,-. /01+,/., = (2 = 4 ∗ � ∗ 2 = 8 �;

�*+,-. (*-+,/., = (4 = 4 ∗ 5,/607; 8*-+,1/9/+ = ( = (2 + (4; �-.5+:6 = 6 = ; 4 + �4;

�/-.5+0*(6 <+= 6-.5+:6 = > = ;64 + 4 = ? 4 + ; 4 + �4; '0. *(6<.)

5,/607 = 2 @6 2 A = 6 ; (4 = 46 ;

( = 8 � + 46 = 8 � + 4 ; 4 + �4; B.=*:+0CDEFG = �6(+ �=5*,63 = 4 4 �3 = 43 4�;

B.=*:+0EHDIJG = 2 ∗ 2 ∗ � = 4 4�; B.=*:+0CGCKL = 43 4� + 4 4�;

Page 64: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 64

CÓDIGO:

dm 'log; clear; output; clear'; /* limpiar ventanas */

TITLE 'Tienda de campaña';

PROC NLP;

MIN S;

DECVAR X, Y, Z;

BOUNDS X>0;

BOUNDS Y>0;

BOUNDS Z>0;

LINCON Y+Z = 2.966835545360500; /* = H */

NLINCON V = 5.605010873919824;

V = (X**2)*Z*4/3 + 4*Y*(X**2);

S1=8*X*Y;

S2=4*X*SQRT((X**2)+(Z**2));

S = S1+S2;

RUN;

Page 65: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 65

RESULTADOS:

Tienda de campaña

PROC NLP: Nonlinear Minimization

Gradient is computed using analytic formulas.

Jacobian of nonlinear constraints is computed using analytic formulas.

El punto inicial se ha cambiado para que se ajuste a las restricciones de los límites

y líneas.

Tienda de campaña

PROC NLP: Nonlinear Minimization

Inicio de optimización

Parámetros estimados

N Parámetro Estimación

Función

objetivo

gradiente

Función

Lagrange

gradiente

Restricción

de la cota

inferior

Restricción

de la cota

superior

1 X 0.835179 19.670447 -0.060274 0 .

2 Y 1.361162 6.681431 0.410580 0 .

3 Z 1.605674 2.963766 -0.410580 0 .

Value of Objective Function = 15.140847123

Valor de la función Lagrange = 15.629673043

Restricciones lineales

1 0 : ACT 2.9668 == + 1.0000 * Y + 1.0000 * Z

Valores de restricciones no lineales

Restricción Valor Residual

Multiplicador

Lagrange

[ 2 ] V 5.2911 -0.3139 1.5572 Violat. NLEC

Tienda de campaña

PROC NLP: Nonlinear Minimization

Optimización Dual Quasi-Newton

Algoritmo VMCWD de Powell (1978, 1982) modificado

Actualización Dual Broyden - Fletcher - Goldfarb - Shanno (DBFGS)

Actualización de multiplicador Lagrange de Powell(1982)

Estimadores de parámetro 3

Límites inferiores 3

Límites superiores 0

Page 66: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 66

Restricciones lineales 1

Restricciones no lineales 1

Restricciones de igualdad no lineales 1

Inicio de optimización

Función Objetive 15.624418181 Uso indebido de la

restricción máxima 0.0000131788

Gradiente máximo de la

función Lagrange 0.4228074408

Iteració

n

Reinici

o

Llamada

s de

función

Función

objetiv

a

Violación

de

restricció

n

máxima

Reducció

n

de

función

predicha

Tamañ

o

del

paso

Elemento

gradient

e

máximo

de la

función

Lagrange

1 ' 0 12 15.6009

7 0.000378 0.2230 1.000 0.441

2 0 13 15.3402

3 0.0384 0.8479 1.000 0.385

3 0 14 13.8745

0 0.8479 2.4286 1.000 0.483

4 0 15 14.7890

6 0.2238 0.6753 1.000 0.735

5 0 16 15.0968

4 0.0101 0.0246 1.000 0.193

6 0 17 15.1040

9 0.00269 0.00641 1.000 0.0463

7 0 18 15.1051

1 0.00150 0.00450 1.000 0.00448

8 0 19 15.1073

4 0.000012 0.000035 1.000 0.00009

9 0 20 15.1073

6 5.275E-9 1.585E-8 1.000 2.47E-6

Resultados de optimización

Iteraciones 9 Invocaciones de función 21

Invocaciones del

gradiente 12 Restricciones activas 2

Función Objetive 15.107361016 Uso indebido de la restricción

máxima 5.2747451E-9

Máximo gradiente

proyectado 1.7417642E-6 Función Lagrange del valor 15.107361024

Page 67: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 67

Resultados de optimización

Gradiente máximo de la

función Lagrange 1.2059529E-6

Coeficiente angular de la

dirección de búsqueda -1.585131E-8

Se ha cumplido el criterio de convergencia FCONV2.

Tienda de campaña

PROC NLP: Nonlinear Minimization

Resultados de optimización

Parámetros estimados

N Parámetro Estimación

Función

objetivo

gradiente

Función

Lagrange

gradiente

1 X 1.072286 15.712373 -0.000000354

2 Y 0.344625 8.578289 0.000001206

3 Z 2.622210 3.970036 -0.000001206

Value of Objective Function = 15.107361016

Valor de la función Lagrange = 15.107361024

Linear Constraints Evaluated at Solution

1 ACT 0 = -2.9668 + 1.0000 * Y + 1.0000 * Z

Valores de restricciones no lineales

Restricción Valor Residual

Multiplicador

Lagrange

[ 2 ] V 5.6050 -5.27E-9 1.5030 Active NLEC

Page 68: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 68

CÓDIGO (Nelder-Mead Simplex):

dm 'log; clear; output; clear'; /* limpiar ventanas */

TITLE 'Tienda de campaña';

PROC NLP TECH=NMSIMP;

MIN S;

DECVAR X, Y, Z;

BOUNDS X>0;

BOUNDS Y>0;

BOUNDS Z>0;

LINCON Y+Z = 2.966835545360500; /* = H */

NLINCON V = 5.605010873919824;

V = (X**2)*Z*4/3 + 4*Y*(X**2);

S1=8*X*Y;

S2=4*X*SQRT((X**2)+(Z**2));

S = S1+S2;

RUN;

Page 69: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 69

RESULTADOS:

Tienda de campaña

PROC NLP: Nonlinear Minimization

Gradient is computed using finite difference approximations (2).

El punto inicial se ha cambiado para que se ajuste a las restricciones de los límites

y líneas.

Tienda de campaña

PROC NLP: Nonlinear Minimization

Inicio de optimización

Parámetros estimados

N Parámetro Estimación

Función

objetivo

gradiente

Restricción

de la cota

inferior

Restricción

de la cota

superior

1 X 0.941895 21.663006 0 .

2 Y 1.614782 7.535156 0 .

3 Z 1.352054 3.091392 0 .

Value of Objective Function = 18.37581502

Restricciones lineales

1 0 : ACT 2.9668 == + 1.0000 * Y + 1.0000 * Z

Valores de restricciones no lineales

Restricción Valor Residual

[ 2 ] V 7.3296 1.7246 Violat. NLEC

Tienda de campaña

PROC NLP: Nonlinear Minimization

Optimización Nelder-Mead Simplex

Algoritmo COBYLA por M.J.D. Powell (1992)

Estimadores de parámetro 3

Límites inferiores 3

Límites superiores 0

Restricciones lineales 1

Restricciones no lineales 1

Restricciones de igualdad no lineales 1

Page 70: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 70

Inicio de optimización

Función Objetive 18.37581502 Uso indebido de la restricción máxima 1.7246303186

Iteración

Reinicio

Llamadas

de

función

Función

objetiva

Violación

de

restricción

máxima

Función

de

mérito

Cambio

de

función

de

mérito

Ratio

entre

el

cambio

actual

y

el

predicho

1 0 8 13.88579 0.8153 17.3197 1.056 2.000

2 0 14 15.10798 0.0728 15.4146 1.905 0.500

3 0 15 15.18530 0.0471 15.3837 0.0310 0.125

4 0 21 15.22146 0.000441 15.2246 0.159 0.0703

5 0 27 15.22078 1.384E-7 15.2208 0.00385 0.0011

6 0 29 15.22032 1.336E-7 15.2203 0.00047 0.0003

7 0 31 15.22027 4.962E-9 15.2203 0.00005 0.0001

Resultados de optimización

Iteraciones 7 Invocaciones de

función 32

Reinicio 0 Función Objetive 15.22026985

Uso indebido de la restricción

máxima 4.9618167E-9 Función Merit 15.220269885

Actual Over Pred Change 0.0001

Se ha cumplido el criterio de convergencia ABSXCONV.

Tienda de campaña

PROC NLP: Nonlinear Minimization

Resultados de optimización

Parámetros estimados

N Parámetro Estimación

Función

objetivo

gradiente

1 X 1.190065 14.561996

2 Y 0.000694 9.520517

3 Z 2.966141 4.417934

Value of Objective Function = 15.22026985

Page 71: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 71

Linear Constraints Evaluated at Solution

1 ACT 0 = -2.9668 + 1.0000 * Y + 1.0000 * Z

Valores de restricciones no lineales

Restricción Valor Residual

[ 2 ] V 5.6050 4.962E-9 Active NLEC

Page 72: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 72

CÓDIGO (Quasi-Newton dual – Broyden, Fletcher, Goldfarb & Shanno): dm 'log; clear; output; clear'; /* limpiar ventanas */

TITLE 'Tienda de campaña';

PROC NLP TECH=QUANEW OUTDER=2 OUT=DERIV; /* Bastaría

OUTDER=1 */

MIN S;

DECVAR X, Y, Z;

BOUNDS X>0;

BOUNDS Y>0;

BOUNDS Z>0;

LINCON Y+Z = 2.966835545360500; /* = H */

NLINCON V = 5.605010873919824;

V = (X**2)*Z*4/3 + 4*Y*(X**2);

S1=8*X*Y;

S2=4*X*SQRT((X**2)+(Z**2));

S = S1+S2;

RUN;

PROC EXPORT DATA=DERIV

outfile='c:/QN.xls' /** Exportar a Excel **/

replace; /** sobreescribir si existe ***/

RUN;

Page 73: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 73

RESULTADOS:

Tienda de campaña

PROC NLP: Nonlinear Minimization

Gradient is computed using analytic formulas.

Jacobian of nonlinear constraints is computed using analytic formulas.

El punto inicial se ha cambiado para que se ajuste a las restricciones de los límites

y líneas.

Tienda de campaña

PROC NLP: Nonlinear Minimization

Inicio de optimización

Parámetros estimados

N Parámetro Estimación

Función

objetivo

gradiente

Función

Lagrange

gradiente

Restricción

de la cota

inferior

Restricción

de la cota

superior

1 X 0.806492 19.793954 -0.057440 0 .

2 Y 1.413222 6.451939 0.412606 0 .

3 Z 1.553613 2.863180 -0.412606 0 .

Value of Objective Function = 14.764984044

Valor de la función Lagrange = 15.690449077

Restricciones lineales

1 0 : ACT 2.9668 == + 1.0000 * Y + 1.0000 * Z

Valores de restricciones no lineales

Restricción Valor Residual

Multiplicador

Lagrange

[ 2 ] V 5.0242 -0.5808 1.5933 Violat. NLEC

Tienda de campaña

PROC NLP: Nonlinear Minimization

Optimización Dual Quasi-Newton

Algoritmo VMCWD de Powell (1978, 1982) modificado

Actualización Dual Broyden - Fletcher - Goldfarb - Shanno (DBFGS)

Actualización de multiplicador Lagrange de Powell(1982)

Estimadores de parámetro 3

Límites inferiores 3

Límites superiores 0

Page 74: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 74

Restricciones lineales 1

Restricciones no lineales 1

Restricciones de igualdad no lineales 1

Inicio de optimización

Función Objetive 15.66835183 Uso indebido de la

restricción máxima 4.1004624E-6

Gradiente máximo de la

función Lagrange 0.4362272822

Iteració

n

Reinici

o

Llamada

s de

función

Función

objetiv

a

Violación

de

restricció

n

máxima

Reducció

n

de

función

predicha

Tamañ

o

del

paso

Elemento

gradient

e

máximo

de la

función

Lagrange

1 ' 0 13 15.6440

1 0.000371 0.2321 1.000 0.451

2 0 14 15.3750

3 0.0377 0.9389 1.000 0.379

3 0 15 13.7987

5 0.8942 2.5833 1.000 0.461

4 0 16 14.7824

9 0.2309 0.6952 1.000 0.810

5 0 17 15.0952

5 0.0119 0.0282 1.000 0.208

6 0 18 15.1023

4 0.00385 0.00988 1.000 0.0462

7 0 19 15.1050

4 0.00155 0.00464 1.000 0.00510

8 0 20 15.1073

4 0.000015 0.000045 1.000 0.00009

9 0 21 15.1073

6 6.101E-9 1.834E-8 1.000 2.52E-6

Resultados de optimización

Iteraciones 9 Invocaciones de función 22

Invocaciones del

gradiente 12 Restricciones activas 2

Función Objetive 15.107361015 Uso indebido de la restricción

máxima 6.101371E-9

Máximo gradiente

proyectado 1.7636039E-6 Función Lagrange del valor 15.107361024

Page 75: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 75

Resultados de optimización

Gradiente máximo de la

función Lagrange 1.2210742E-6

Coeficiente angular de la

dirección de búsqueda -1.833597E-8

Se ha cumplido el criterio de convergencia FCONV2.

Tienda de campaña

PROC NLP: Nonlinear Minimization

Resultados de optimización

Parámetros estimados

N Parámetro Estimación

Función

objetivo

gradiente

Función

Lagrange

gradiente

1 X 1.072286 15.712373 -0.000000358

2 Y 0.344625 8.578289 0.000001221

3 Z 2.622210 3.970036 -0.000001221

Value of Objective Function = 15.107361015

Valor de la función Lagrange = 15.107361024

Linear Constraints Evaluated at Solution

1 ACT 0 = -2.9668 + 1.0000 * Y + 1.0000 * Z

Valores de restricciones no lineales

Restricción Valor Residual

Multiplicador

Lagrange

[ 2 ] V 5.6050 -6.1E-9 1.5030 Active NLEC

DERIVADAS (outfile QN.xls): _OBS_ _TYPE_ S _WRT_ X Z Y V S1 S2

1 15,10736 1,072286 2,62221 0,344625 5,605011 2,956295 12,15107

1 ANALYTIC 15,71237 X 1,072286 2,62221 0,344625 5,605011 2,956295 12,15107

1 ANALYTIC 3,970036 Z 1,072286 2,62221 0,344625 5,605011 2,956295 12,15107

1 ANALYTIC 8,578288 Y 1,072286 2,62221 0,344625 5,605011 2,956295 12,15107

Page 76: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 76

14: OTRAS PRÁCTICAS

A) Función de Dixon (1973).

Programación No Lineal.

10 variables.

Minimización por mínimos cuadrados.

CÓDIGO SAS:

PROC NLP RANDOM=98765 TECH=LM MAXIT=100 MAXFU=500

ABSXTOL=1e-10;

ARRAY t[11] t1-t11;

ARRAY x[10] x1-x10;

LSQ t1-t11; /* MIN t1**2 + ... + t11**2 */

DECVAR x1-x10;

DO i = 1 TO 9;

t[i]=x[i]**2-x[i+1];

END;

t[10]=1-x[10];

t[11] = 1-x[1];

RUN;

Page 77: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 77

RESULTADOS:

Ejemplo 2max (NLP)

PROC NLP: Least Squares Minimization

Gradient is computed using analytic formulas.

Cross product Jacobian is computed using analytic formulas.

Ejemplo 2max (NLP)

PROC NLP: Least Squares Minimization

Inicio de optimización

Parámetros estimados

N Parámetro Estimación

Función objetivo

gradiente

1 x1 0.828208 -0.380619

2 x2 0.812001 0.145162

3 x3 0.647591 -0.125520

4 x4 0.507211 0.269073

5 x5 0.078603 -0.284187

6 x6 0.677448 0.835077

7 x7 0.338036 -0.403996

8 x8 0.533004 -0.245286

9 x9 0.906998 1.307103

10 x10 0.445469 -0.931708

Value of Objective Function = 0.7817584785

Ejemplo 2max (NLP)

PROC NLP: Least Squares Minimization

Optimización Levenberg-Marquardt

Ajuste a escala de la actualización de More (1978)

Estimadores de parámetro 10

Funciones (Observaciones) 11

Inicio de optimización

Restricciones activas 0 Función Objetive 0.7817584785

Max Abs Gradient Element 1.3071033374 Radio 3.5073382413

Page 78: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 78

Iteraci

ón

Reinic

io

Llamadas de

función

Restricciones

activas

Función

objetiva

Cambio/de función/objet

iva

Elemento/gradiente/max

abs

Lamb

da

Ratio

entre el

cambi

o actual

y

el predic

ho

1 0 3 0 0.45308 0.3287 0.6119 1.583 1.025

2 0 5 0 0.24766 0.2054 0.5557 0.025

3 0.974

3 0 6 0 0.16160 0.0861 1.1147 0 0.348

4 0 7 0 0.00219 0.1594 0.1037 0 0.986

5 0 8 0 9.8802E-

7 0.00219 0.00179 0 1.000

6 0 9 0 1.9965E-

13 9.88E-7 6.638E-7 0 1.000

Resultados de optimización

Iteraciones 6 Invocaciones de función 10

Invocaciones del jacobiano 7 Restricciones activas 0

Función Objetive 1.9965E-13 Max Abs Gradient Element 6.6382252E-7

Lambda 0 Actual Over Pred Change 0.9999997986

Radio 0.0054733379

Se ha cumplido el criterio de convergencia ABSGCONV.

Ejemplo 2max (NLP)

PROC NLP: Least Squares Minimization

Resultados de optimización

Parámetros estimados

N Parámetro Estimación

Función objetivo

gradiente

1 x1 1.000000 4.7947588E-9

2 x2 1.000000 2.6442832E-8

3 x3 1.000000 9.9369342E-8

4 x4 1.000000 0.000000306

5 x5 1.000000 0.000000664

Page 79: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 79

Resultados de optimización

Parámetros estimados

N Parámetro Estimación

Función

objetivo gradiente

6 x6 1.000000 0.000000439

7 x7 1.000000 -0.000000411

8 x8 1.000000 -9.511189E-9

9 x9 1.000000 -3.51255E-11

10 x10 1.000000 0

Value of Objective Function = 1.9965E-13

Page 80: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 80

14: OTRAS PRÁCTICAS

B) Minimización Karush-Kuhn-Tucker con 3n puntos

Programación No Lineal.

Nelder-Mead símplex.

CÓDIGO SAS:

%MACRO KKT(n);

PROC NLP TECH=NMSIMP INITIAL=0.54321;

ARRAY t[&n] t1-t&n;

ARRAY x[&n] x1-x&n;

MIN t1-t&n;

DECVAR x1-x&n;

BOUNDS -1 <= x1-x&n <= 1;

DO i = 1 TO &n;

t[i] = -x[i]-x[i]**2;

END;

RUN;

%MEND KKT;

%KKT(8);

Page 81: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 81

RESULTADOS:

(Se incluyen solamente las primeras y últimas iteraciones)

KKT: Problema con 3**n puntos KKT (NLP)

PROC NLP: Nonlinear Minimization

Gradient is computed using finite difference approximations (2).

KKT: Problema con 3**n puntos KKT (NLP)

PROC NLP: Nonlinear Minimization

Inicio de optimización

Parámetros estimados

N Parámetro Estimación

Función

objetivo

gradiente

Restricción

de la cota

inferior

Restricción

de la cota

superior

1 x1 0.543210 -2.086420 -1.000000 1.000000

2 x2 0.543210 -2.086420 -1.000000 1.000000

3 x3 0.543210 -2.086420 -1.000000 1.000000

4 x4 0.543210 -2.086420 -1.000000 1.000000

5 x5 0.543210 -2.086420 -1.000000 1.000000

6 x6 0.543210 -2.086420 -1.000000 1.000000

7 x7 0.543210 -2.086420 -1.000000 1.000000

8 x8 0.543210 -2.086420 -1.000000 1.000000

Value of Objective Function = -6.706296833

KKT: Problema con 3**n puntos KKT (NLP)

PROC NLP: Nonlinear Minimization

Optimización Nelder-Mead Simplex

Estimadores de parámetro 8

Funciones (Observaciones) 8

Límites inferiores 8

Límites superiores 8

Inicio de optimización

Restricciones activas 0 Función Objetive -6.706296833

Page 82: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 82

Iterac

ión

Reini

cio

Llama

das

de

funci

ón

Restricc

iones

activas

Funció

n

objeti

va

Cambio/de

función/obj

etiva

Desvia

ción

estánd

ar

de

valore

s

simple

s

Longi

tud

del

vérti

ce

de

inici

o

Tama

ño

simp

le

1 0 15 0

-

9.8002

0

1.9322 0.6411 1.000 1.30

0

2 0 21 3

-

10.754

28

2.1240 0.6615 1.000 1.84

1

3 0 27 3

-

11.186

73

1.5311 0.4899 1.000 1.53

0

4 0 34 2

-

11.803

53

1.0025 0.2889 1.000 1.92

3

5 0 39 2

-

11.803

53

0.7477 0.2131 1.000 1.61

3

6 0 55 2

-

11.803

53

0.4756 0.1572 1.000 0.79

1

7 0 61 1

-

11.930

18

0.5062 0.1702 1.000 0.71

7

8 0 68 2

-

12.100

27

0.3259 0.0994 1.000 0.80

2

9 0 74 3

-

12.284

46

0.3990 0.1232 1.000 0.91

9

10 0 79 3

-

12.284

46

0.2342 0.0854 1.000 0.51

2

… … … … … … … … …

220 2 1600 1

-

13.999

05

5.593E-6 1.907E

-6 1.000

0.00

007

221 2 1608 1

-

13.999

05

4.198E-6 1.472E

-6 1.000

0.00

004

222 2 1617 1

-

13.999

05

2.901E-6 9.916E

-7 1.000

0.00

003

Resultados de optimización

Iteraciones 222 Invocaciones de función 1619

Page 83: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 83

Resultados de optimización

Reinicio 2 Restricciones activas 1

Función Objetive -13.99905099 Desviación típica de valores simples 9.9164684E-7

Deltax 1 Tamaño 0.000034383

Se ha cumplido el criterio de convergencia FCONV2.

KKT: Problema con 3**n puntos KKT (NLP)

PROC NLP: Nonlinear Minimization

Resultados de optimización

Parámetros estimados

N Parámetro Estimación

Función

objetivo

gradiente

Restricción

de la cota

activa

1 x1 -0.999405 0.998811

2 x2 0.999933 -2.999865

3 x3 0.999958 -2.999917

4 x4 1.000000 -2.999976 Upper BC

5 x5 0.999999 -2.999976

6 x6 0.999998 -2.999976

7 x7 0.999996 -2.999976

8 x8 0.999998 -2.999976

Value of Objective Function = -13.99905099

Page 84: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 84

14: OTRAS PRÁCTICAS

C) SUDOKU

Ejercicio 2, PROC CLP.

CÓDIGO SAS:

dm 'log; clear; output; clear'; /* limpiar ventanas */

TITLE 'SUDOKU 2';

PROC CLP OUT=SUDOKU FINDALL

VARSELECT=minr; /* Selecciona la variable con menor rango */

ARRAY a[81] (a11-a19 a21-a29 a31-a39 a41-a49 a51-a59 a61-a69 a71-a79

a81-a89 a91-a99); /* aij, i=1..9, j=1..9 */

VAR (a11-a19 a21-a29 a31-a39 a41-a49 a51-a59 a61-a69 a71-a79 a81-a89

a91-a99)=[1,9]; /* dominios de las variables */

/* Los números de cada fila deben ser todos distintos */

ALLDIFF (a11-a19) (a21-a29) (a31-a39) (a41-a49) (a51-a59) (a61-a69)

(a71-a79) (a81-a89) (a91-a99);

/* Los números de cada columna todos distintos */

ALLDIFF(a11 a21 a31 a41 a51 a61 a71 a81 a91);

ALLDIFF(a12 a22 a32 a42 a52 a62 a72 a82 a92);

ALLDIFF(a13 a23 a33 a43 a53 a63 a73 a83 a93);

ALLDIFF(a14 a24 a34 a44 a54 a64 a74 a84 a94);

ALLDIFF(a15 a25 a35 a45 a55 a65 a75 a85 a95);

Page 85: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 85

ALLDIFF(a16 a26 a36 a46 a56 a66 a76 a86 a96);

ALLDIFF(a17 a27 a37 a47 a57 a67 a77 a87 a97);

ALLDIFF(a18 a28 a38 a48 a58 a68 a78 a88 a98);

ALLDIFF(a19 a29 a39 a49 a59 a69 a79 a89 a99);

/* los números de cada subcuadrado todos distintos */

ALLDIFF(a11-a13 a21-a23 a31-a33);

ALLDIFF(a14-a16 a24-a26 a34-a36);

ALLDIFF(a17-a19 a27-a29 a37-a39);

ALLDIFF(a41-a43 a51-a53 a61-a63);

ALLDIFF(a44-a46 a54-a56 a64-a66);

ALLDIFF(a47-a49 a57-a59 a67-a69);

ALLDIFF(a71-a73 a81-a83 a91-a93);

ALLDIFF(a74-a76 a84-a86 a94-a96);

ALLDIFF(a77-a79 a87-a89 a97-a99);

LINCON /* Datos conocidos del sudoku */

/* Se emplean los del EJERCICIO 2 */

a11=7 , a13=8 , a15=9 , a16=5 , a19=4 ,

a23=1 , a25=3 , a26=2 , a27=8 ,

a43=9 , a45=4 , a48=1 ,

a51=8 , a53=5 , a57=9 , a59=2 ,

a62=3 , a65=2 , a67=5 ,

a83=7 , a84=9 , a85=5 , a87=6 ,

a91=4 , a94=3 , a95=8 , a97=1 , a99=9;

Page 86: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 86

RUN;

PROC PRINT DATA=SUDOKU NOOBS; VAR a11-a19; FORMAT a11-a19 2.0;

PROC PRINT DATA=SUDOKU NOOBS; VAR a21-a29; FORMAT a21-a29 2.0;

PROC PRINT DATA=SUDOKU NOOBS; VAR a31-a39; FORMAT a31-a39 2.0;

PROC PRINT DATA=SUDOKU NOOBS; VAR a41-a49; FORMAT a41-a49 2.0;

PROC PRINT DATA=SUDOKU NOOBS; VAR a51-a59; FORMAT a51-a59 2.0;

PROC PRINT DATA=SUDOKU NOOBS; VAR a61-a69; FORMAT a61-a69 2.0;

PROC PRINT DATA=SUDOKU NOOBS; VAR a71-a79; FORMAT a71-a79 2.0;

PROC PRINT DATA=SUDOKU NOOBS; VAR a81-a89; FORMAT a81-a89 2.0;

PROC PRINT DATA=SUDOKU NOOBS; VAR a91-a99; FORMAT a91-a99 2.0;

RUN;

Page 87: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 87

RESULTADOS:

332 dm 'log; clear; output; clear'; /* limpiar ventanas */

333 TITLE 'SUDOKU 2';

334 PROC CLP OUT=SUDOKU FINDALL

ERROR: Procedimiento CLP no encontrado.

[…]

Nota: el procedimiento experimental CLP no se hallaba disponible en la versión del

software del alumno. El resultado del programa es el sudoku resuelto.

Page 88: Programación Matemática con SAS®, FORTRAN-NAG y MPL

MIM-UCM Página 88

BIBLIOGRAFÍA

Se incluye a continuación una selección de referencias bibliográficas consultadas por el

alumno para la resolución de los problemas.

• Apuntes de la asignatura Optimización y simulación (MIM-UCM)

• Apuntes de la asignatura Estadística aplicada y minería de datos (MIM-UCM)

• Encyclopedia of Optimization, 2nd edition (Springer 2009)

• Fortran Resources - Ian D Chivers & Jane Sleightholme (March 5, 2009)

• Introduction to Programming with Fortran, With Coverage of Fortran 90, 95,

2003, and 77 - Ian D. Chivers and Jane Sleightholme

• Fortran 90 Handbook, Complete ANSI-ISO reference (McGraw-Hill 1992)

• Numerical optimization - Nocedal J., Wright S.J. (Springer, 1999)

• SAS Institute Inc. 2008. SAS/OR ® 9.2 User’s Guide: Mathematical

Programming. Cary, NC: SAS Institute Inc.

• SAS/STAT® 9.2 User’s guide – Procedures and knowledge base (online)

http://support.sas.com/documentation/onlinedoc/or/index.html

• SAS/STAT® 9.2 User’s guide – Procedures and knowledge base (online)

http://support.sas.com/documentation/onlinedoc/stat/index_proc.html

• SAS ® and Sudoku, Paper 11 at SAS global forum 2007,

http://www2.sas.com/proceedings/forum2007/011-2007.pdf

• The CLP procedure, SAS online reference,

http://support.sas.com/documentation/cdl/en/orcpug/59630/HTML/default/o

rcpug_clp_sect004.htm

• Logo Sudoku propiedad de ThinkFun, Inc.

http://kevin.athey.org/puzzles/Sudoku5X5/Thinkfun%20-%20Sudoku5X5.html