Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Código TFG Estadística
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tomcarr
Código TFG Estadística
Commits
b8af6746
Commit
b8af6746
authored
7 months ago
by
tomcarr
Browse files
Options
Downloads
Patches
Plain Diff
Replace VarepsilonConstraintMaxMCLP.mos
parent
3f2da07e
Branches
jorvill-main-patch-12338
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Codigos Xpress/VarepsilonConstraintMaxMCLP.mos
+21
-19
21 additions, 19 deletions
Codigos Xpress/VarepsilonConstraintMaxMCLP.mos
with
21 additions
and
19 deletions
Codigos Xpress/VarepsilonConstraintMaxMCLP.mos
+
21
−
19
View file @
b8af6746
...
...
@@ -8,9 +8,9 @@ uses "mmive"
!)
declarations
m
,
n
,
p
,
r
:
integer
archivo_datos
=
"instancesMOFLP/instances/large1.txt"
! formato_datos = 3
!
archivo_datos = "instancesMOFLP/instances/large1.txt" ! formato_datos = 3
!archivo_datos = "municipios/archivo_salida.txt"
!
archivo_datos = "municipios/archivo_cyl.txt"
archivo_datos
=
"municipios/archivo_cyl.txt"
!archivo_datos = "municipios/archivo_esp.txt" ! algo ms de 800 segundos la primera (es la ms importante)
formato_datos
=
3
end
-
declarations
...
...
@@ -42,7 +42,7 @@ declarations
dem
:
array
(
pdemanda
)
of
real
a
:
array
(
pdemanda
,
pservicio
)
of
integer
dc
=
r
tam
=
1
000
tam
=
50
000
Pn
:
array
(
1.
.
tam
,
1..2
)
of
real
y
:
array
(
pdemanda
)
of
mpvar
u
:
array
(
pdemanda
)
of
mpvar
...
...
@@ -105,8 +105,8 @@ fclose(F_INPUT)
Comienzo maximizando el primer criterio (MCLPR)
!)
!setparam("XPRS_MAXTIME",-100)
obj
:=
sum
(
j
in
pdemanda
)
u
(
j
)
!
obj := sum(j in pdemanda) dem(j)*u(j)
!
obj := sum(j in pdemanda) u(j)
obj
:=
sum
(
j
in
pdemanda
)
dem
(
j
)*
u
(
j
)
forall
(
i
in
pdemanda
)
res1
(
i
):=
sum
(
j
in
pservicio
)
x
(
j
)*
a
(
i
,
j
)
>=
2
*
u
(
i
)
forall
(
i
in
pdemanda
)
res2
(
i
):=
sum
(
j
in
pservicio
)
x
(
j
)*
a
(
i
,
j
)>=
y
(
i
)
...
...
@@ -124,9 +124,9 @@ writeln("La solucion optima es\t", varep)
n
:=
1
! Busco para el otro criterio (MCLP) la solucion optima, si pongo como restriccion que el MCLPR sea el maximo anteiror
obj2
:=
sum
(
i
in
pdemanda
)
y
(
i
)
res4
:=
sum
(
i
in
pdemanda
)
u
(
i
)
>=
varep
!
obj2 := sum(i in pdemanda) y(i)
obj2
:=
sum
(
j
in
pdemanda
)
dem
(
j
)*
y
(
j
)
res4
:=
sum
(
i
in
pdemanda
)
u
(
i
)
*
dem
(
i
)
>=
varep
maximize
(
obj2
)
...
...
@@ -153,7 +153,7 @@ end-do
res4
:=
0
! nos aseguramos de no arrastrar una restriccion previa
maximize
(
obj2
)
res4
:=
sum
(
i
in
pdemanda
)
y
(
i
)
>=
getobjval
res4
:=
sum
(
i
in
pdemanda
)
y
(
i
)
*
dem
(
i
)
>=
getobjval
maximize
(
obj
)
...
...
@@ -170,10 +170,10 @@ while(varepIter <= varep)do
n
:=
n
+
1
! Encontrar la solucion optima para MCLP imponiendo como restriccion que el MCLPR sea varepIter
obj
:=
sum
(
j
in
pdemanda
)
y
(
j
)
!
obj := sum(j in pdemanda) dem(j)*y(j)
!
obj := sum(j in pdemanda) y(j)
obj
:=
sum
(
j
in
pdemanda
)
dem
(
j
)*
y
(
j
)
res4
:=
sum
(
i
in
pdemanda
)
u
(
i
)
>=
varepIter
res4
:=
sum
(
i
in
pdemanda
)
u
(
i
)
*
dem
(
i
)
>=
varepIter
forall
(
i
in
pdemanda
)
y
(
i
)
is_binary
forall
(
j
in
pservicio
)
x
(
j
)
is_binary
...
...
@@ -191,19 +191,21 @@ while(varepIter <= varep)do
! COMIENZO de una cosa nueva para quitar iteraciones de dominados (que no se hagan)
maxIterMCLP
:=
getobjval
res4
:=
sum
(
i
in
pdemanda
)
y
(
i
)
>=
maxIterMCLP
obj
:=
sum
(
j
in
pdemanda
)
u
(
j
)
res4
:=
sum
(
i
in
pdemanda
)
y
(
i
)
*
dem
(
i
)
>=
maxIterMCLP
!
obj := sum(j in pdemanda) u(j)
obj
:=
sum
(
j
in
pdemanda
)
dem
(
j
)*
u
(
j
)
maximize
(
obj
)
! FIN de una cosa nueva para quitar iteraciones de dominados (que no se hagan)
Pn
(
n
,
2
)
:=
getobjval
if
(
getobjval
>
varepIter
)
then
varepIter
:=
getobjval
end
-
if
Pn
(
n
,
2
)
:=
varepIter
Pn
(
n
,
1
)
:=
maxIterMCLP
writeln
(
"MCLP = "
,
maxIterMCLP
,
"
\t
MCLPR = "
,
varepIter
,
" getobjval "
,
getobjval
)
varepIter
:=
getobjval
writeln
(
"MCLP = "
,
maxIterMCLP
,
"
\t
MCLPR = "
,
varepIter
)
indR
:=
1
forall
(
indiceRellenar
in
pservicio
|
x
(
indiceRellenar
).
sol
=
1
)
do
psAbiertos
(
n
,
indR
)
:=
indiceRellenar
...
...
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment