Skip to content

Instantly share code, notes, and snippets.

View andreacassioli's full-sized avatar

Andrea Cassioli andreacassioli

  • Maersk
  • Copenhagen, Denmark
View GitHub Profile
@andreacassioli
andreacassioli / plot.py
Last active August 29, 2015 13:56
minimal sphere enclosing points with MOSEK fusion
import sys
import mosek
from mosek.fusion import *
import numpy as np
import time
import plot
def sphere_enclosing_primal(n,k,p):
@andreacassioli
andreacassioli / gist:9110599
Created February 20, 2014 10:19
Dual formulation of the minimal sphere enclosing points using MOSEK Fusion API
def sphere_enclosing_dual(n,k,p):
print('Creating the Fusion optimization model...')
start=time.clock()
M = Model("minimal sphere enclosing a set of points dual")
print('Declaring the variables...')
y= M.variable('y',NDSet(k,n+1),Domain.inQCone(k,n+1))
print('done!\n')
M = Model("minimal sphere enclosing a set of points dual")
print('Declaring the variables...')
y= M.variable('y',NDSet(k,n+1),Domain.inQCone(k,n+1))
c=[0. for i in range(n+1)]
c[0]=1.
print('Defining the constraints...')
M.constraint('equalities', Expr.mul(DenseMatrix(1,k,1.0), y), Domain.equalsTo(c) )
* ENCODING=ISO-8859-1
NAME
ROWS
N obj
L c1
G c2
L c3
G c4
L c5
G c6
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.