Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
projet-optimisation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
3
Issues
3
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Aliaume Lopez
projet-optimisation
Commits
03d1592f
Commit
03d1592f
authored
Jan 11, 2017
by
Aliaume Lopez
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of gitlab.crans.org:alopez/projet-optimisation
parents
2d3d9816
f09f7012
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
77 additions
and
4 deletions
+77
-4
rapport/presentation.tex
rapport/presentation.tex
+8
-3
testperfs.py
testperfs.py
+69
-1
No files found.
rapport/presentation.tex
View file @
03d1592f
...
@@ -440,7 +440,7 @@
...
@@ -440,7 +440,7 @@
\ds
\ds
Mais
des performances immondes
.
Mais
ce n'est pas très rapide (inversion de matrice à chaque étape, notemment)
.
\end{frame}
\end{frame}
...
@@ -453,13 +453,18 @@ Mais des performances immondes.
...
@@ -453,13 +453,18 @@ Mais des performances immondes.
\ds
\ds
Ce n'est pas très efficace. Ni très précis
.
$
24
$
s pour répondre à 100 instances (200 contraintes, 100 variables)
.
\
d
s
\
e
s
\begin{block}
{
\texttt
{
CVXPy
}}
\begin{block}
{
\texttt
{
CVXPy
}}
Interface élégante de
\texttt
{
CVXopt
}
associée à Python. Très efficace.
Interface élégante de
\texttt
{
CVXopt
}
associée à Python. Très efficace.
\end{block}
\end{block}
\ds
$
4
$
s pour les 100 instances. Peu d'erreurs de faisabilité.
\end{frame}
\end{frame}
\begin{frame}
\begin{frame}
...
...
testperfs.py
View file @
03d1592f
...
@@ -2,6 +2,39 @@ from lineartools import invert
...
@@ -2,6 +2,39 @@ from lineartools import invert
import
numpy
as
np
import
numpy
as
np
import
random
import
random
import
time
import
time
import
scipy.optimize
as
scopt
import
cvxpy
as
cvx
def
vrai_simplexe
(
A
,
b
,
c
):
AA
=
np
.
copy
(
np
.
array
(
A
,
dtype
=
float
))
bb
=
np
.
copy
(
np
.
array
(
b
,
dtype
=
float
))
cc
=
np
.
copy
(
np
.
array
(
c
,
dtype
=
float
))
res
=
scopt
.
linprog
(
c
=
cc
,
A_eq
=
AA
,
b_eq
=
bb
,
bounds
=
(
0
,
None
),
method
=
'simplex'
,
callback
=
None
,
options
=
{
"maxiter"
:
100000
})
# logging.debug ("Résultat de l'appel à simplexe : {}".format (res))
return
res
def
simpl_cvx
(
A
,
b
,
c
):
m
,
n
=
A
.
shape
assert
(
n
==
len
(
c
)
and
(
m
==
len
(
b
)))
x
=
cvx
.
Variable
(
n
)
objective
=
cvx
.
Minimize
(
cvx
.
sum_entries
(
c
*
x
))
constraints
=
[
0
<=
x
,
A
*
x
==
b
]
prob
=
cvx
.
Problem
(
objective
,
constraints
)
opt
=
prob
.
solve
()
s
=
prob
.
status
return
({
"status"
:
s
})
def
testinv
():
def
testinv
():
...
@@ -23,8 +56,43 @@ def testinv():
...
@@ -23,8 +56,43 @@ def testinv():
b
=
time
.
clock
()
b
=
time
.
clock
()
sumlin
+=
b
-
a
sumlin
+=
b
-
a
print
(
"============="
)
print
(
"============="
)
print
(
"Numpy :"
sumnp
)
print
(
"Numpy :"
,
sumnp
)
print
(
"Gauss :"
,
sumlin
)
print
(
"Gauss :"
,
sumlin
)
return
def
testsimpl
():
sumnp
=
0
sumlin
=
0
sumopt
=
0
sumcvx
=
0
for
i
in
range
(
1000
):
print
(
"Iteration"
,
i
)
m
=
100
n
=
200
A
=
np
.
random
.
rand
(
m
,
n
)
*
10
-
5
*
np
.
ones
((
m
,
n
))
b
=
np
.
random
.
rand
(
m
)
*
2
c
=
np
.
random
.
rand
(
n
)
t
=
time
.
clock
()
res
=
vrai_simplexe
(
A
,
b
,
c
)
tt
=
time
.
clock
()
sumopt
+=
tt
-
t
print
(
"Optimize"
,
res
[
"message"
])
t
=
time
.
clock
()
res
=
simpl_cvx
(
A
,
b
,
c
)
tt
=
time
.
clock
()
sumcvx
+=
tt
-
t
print
(
"CVX"
,
res
[
"status"
])
print
(
"============="
)
print
(
"Optimize :"
,
sumopt
)
print
(
"CVX :"
,
sumcvx
)
return
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment