Skip to content

Commit

Permalink
made Simulink interface compile on dSPACE, renamed functions xxxOQPyy…
Browse files Browse the repository at this point in the history
…y -> xxxOqpYyyy, updated manual
  • Loading branch information
jferreau committed Aug 25, 2015
1 parent a7217fe commit 6341699
Show file tree
Hide file tree
Showing 12 changed files with 49 additions and 45 deletions.
Binary file modified doc/manual.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion examples/example3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ int main( )
real_t maxStationarity, maxFeasibility, maxComplementarity;

/* 2) Run benchmark. */
if ( runOQPbenchmark( "./chain80w/",
if ( runOqpBenchmark( "./chain80w/",
isSparse,
options,
nWSR,
Expand Down
2 changes: 1 addition & 1 deletion examples/example3b.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ int main( )
real_t maxStationarity, maxFeasibility, maxComplementarity;

/* 2) Run benchmark. */
if ( runOQPbenchmark( "./chain80/",
if ( runOqpBenchmark( "./chain80/",
isSparse,
options,
nWSR,
Expand Down
4 changes: 2 additions & 2 deletions interfaces/python/tests/test_testbench.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import os
import numpy as np
from numpy.testing import *
from qpoases import py_runOQPbenchmark as runOQPbenchmark
from qpoases import py_runOqpBenchmark as runOqpBenchmark
from qpoases import PyQProblem as QProblem
from qpoases import PyBooleanType as BooleanType
from qpoases import PyReturnValue as ReturnValue
Expand Down Expand Up @@ -150,7 +150,7 @@ def run_benchmarks(benchmarks, options, isSparse, useHotstarts,
# Run QP benchmark
returnvalue, maxNWSR, avgNWSR, maxCPUtime, avgCPUtime, \
maxStationarity, maxFeasibility, maxComplementarity \
= runOQPbenchmark(path, isSparse, useHotstarts,
= runOqpBenchmark(path, isSparse, useHotstarts,
options, nWSR, cpu_time )

if (returnvalue == ReturnValue.SUCCESSFUL_RETURN
Expand Down
14 changes: 9 additions & 5 deletions interfaces/simulink/qpOASES_simulink_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
*
*/

#ifndef __SINGLE_OBJECT__
#include <qpOASES.hpp>
#endif


USING_NAMESPACE_QPOASES

Expand Down Expand Up @@ -61,7 +65,7 @@ returnValue removeNaNs( real_t* const data, unsigned int dim )

for ( i=0; i<dim; ++i )
if ( isNaN(data[i]) == BT_TRUE )
data[i] = qpOASES::INFTY;
data[i] = INFTY;

return SUCCESSFUL_RETURN;
}
Expand All @@ -79,11 +83,11 @@ returnValue removeInfs( real_t* const data, unsigned int dim )

for ( i=0; i<dim; ++i )
{
if ( data[i] < -qpOASES::INFTY )
data[i] = -qpOASES::INFTY;
if ( data[i] < -INFTY )
data[i] = -INFTY;

if ( data[i] > qpOASES::INFTY )
data[i] = qpOASES::INFTY;
if ( data[i] > INFTY )
data[i] = INFTY;
}

return SUCCESSFUL_RETURN;
Expand Down
48 changes: 24 additions & 24 deletions src/OQPinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ BEGIN_NAMESPACE_QPOASES


/*
* r e a d O Q P d i m e n s i o n s
* r e a d O q p D i m e n s i o n s
*/
returnValue readOQPdimensions( const char* path,
returnValue readOqpDimensions( const char* path,
int_t& nQP, int_t& nV, int_t& nC, int_t& nEC
)
{
Expand Down Expand Up @@ -74,9 +74,9 @@ returnValue readOQPdimensions( const char* path,


/*
* r e a d O Q P d a t a
* r e a d O q p D a t a
*/
returnValue readOQPdata( const char* path,
returnValue readOqpData( const char* path,
int_t& nQP, int_t& nV, int_t& nC, int_t& nEC,
real_t** H, real_t** g, real_t** A, real_t** lb, real_t** ub, real_t** lbA, real_t** ubA,
real_t** xOpt, real_t** yOpt, real_t** objOpt
Expand All @@ -90,7 +90,7 @@ returnValue readOQPdata( const char* path,


/* 1) Obtain OQP dimensions. */
if ( readOQPdimensions( path, nQP,nV,nC,nEC ) != SUCCESSFUL_RETURN )
if ( readOqpDimensions( path, nQP,nV,nC,nEC ) != SUCCESSFUL_RETURN )
return THROWERROR( RET_UNABLE_TO_READ_FILE );


Expand Down Expand Up @@ -225,9 +225,9 @@ returnValue readOQPdata( const char* path,


/*
* s o l v e O Q P b e n c h m a r k
* s o l v e O q p B e n c h m a r k
*/
returnValue solveOQPbenchmark( int_t nQP, int_t nV, int_t nC, int_t nEC,
returnValue solveOqpBenchmark( int_t nQP, int_t nV, int_t nC, int_t nEC,
const real_t* const _H, const real_t* const g, const real_t* const _A,
const real_t* const lb, const real_t* const ub,
const real_t* const lbA, const real_t* const ubA,
Expand All @@ -240,7 +240,7 @@ returnValue solveOQPbenchmark( int_t nQP, int_t nV, int_t nC, int_t nEC,
real_t avgNWSR = 0.0;
real_t avgCPUtime = 0.0;

returnValue returnvalue = solveOQPbenchmark( nQP,nV,nC,nEC,
returnValue returnvalue = solveOqpBenchmark( nQP,nV,nC,nEC,
_H,g,_A,lb,ub,lbA,ubA,
isSparse,BT_TRUE,
options,nWSR,
Expand All @@ -255,9 +255,9 @@ returnValue solveOQPbenchmark( int_t nQP, int_t nV, int_t nC, int_t nEC,


/*
* s o l v e O Q P b e n c h m a r k
* s o l v e O q p B e n c h m a r k
*/
returnValue solveOQPbenchmark( int_t nQP, int_t nV, int_t nC, int_t nEC,
returnValue solveOqpBenchmark( int_t nQP, int_t nV, int_t nC, int_t nEC,
const real_t* const _H, const real_t* const g, const real_t* const _A,
const real_t* const lb, const real_t* const ub,
const real_t* const lbA, const real_t* const ubA,
Expand Down Expand Up @@ -402,9 +402,9 @@ returnValue solveOQPbenchmark( int_t nQP, int_t nV, int_t nC, int_t nEC,


/*
* s o l v e O Q P b e n c h m a r k
* s o l v e O q p B e n c h m a r k
*/
returnValue solveOQPbenchmark( int_t nQP, int_t nV,
returnValue solveOqpBenchmark( int_t nQP, int_t nV,
const real_t* const _H, const real_t* const g,
const real_t* const lb, const real_t* const ub,
BooleanType isSparse,
Expand All @@ -416,7 +416,7 @@ returnValue solveOQPbenchmark( int_t nQP, int_t nV,
real_t avgNWSR = 0.0;
real_t avgCPUtime = 0.0;

returnValue returnvalue = solveOQPbenchmark( nQP,nV,
returnValue returnvalue = solveOqpBenchmark( nQP,nV,
_H,g,lb,ub,
isSparse,BT_TRUE,
options,nWSR,
Expand All @@ -430,9 +430,9 @@ returnValue solveOQPbenchmark( int_t nQP, int_t nV,


/*
* s o l v e O Q P b e n c h m a r k
* s o l v e O q p B e n c h m a r k
*/
returnValue solveOQPbenchmark( int_t nQP, int_t nV,
returnValue solveOqpBenchmark( int_t nQP, int_t nV,
const real_t* const _H, const real_t* const g,
const real_t* const lb, const real_t* const ub,
BooleanType isSparse, BooleanType useHotstarts,
Expand Down Expand Up @@ -564,9 +564,9 @@ returnValue solveOQPbenchmark( int_t nQP, int_t nV,


/*
* r u n O Q P b e n c h m a r k
* r u n O q p B e n c h m a r k
*/
returnValue runOQPbenchmark( const char* path, BooleanType isSparse, const Options& options,
returnValue runOqpBenchmark( const char* path, BooleanType isSparse, const Options& options,
int_t& nWSR, real_t& maxCPUtime,
real_t& maxStationarity, real_t& maxFeasibility, real_t& maxComplementarity
)
Expand All @@ -575,7 +575,7 @@ returnValue runOQPbenchmark( const char* path, BooleanType isSparse, const Optio
real_t avgNWSR = 0.0;
real_t avgCPUtime = 0.0;

returnValue returnvalue = runOQPbenchmark( path,isSparse,BT_TRUE,
returnValue returnvalue = runOqpBenchmark( path,isSparse,BT_TRUE,
options,nWSR,
maxNWSR,avgNWSR,maxCPUtime,avgCPUtime,
maxStationarity,maxFeasibility,maxComplementarity
Expand All @@ -587,9 +587,9 @@ returnValue runOQPbenchmark( const char* path, BooleanType isSparse, const Optio


/*
* r u n O Q P b e n c h m a r k
* r u n O q p B e n c h m a r k
*/
returnValue runOQPbenchmark( const char* path, BooleanType isSparse, BooleanType useHotstarts,
returnValue runOqpBenchmark( const char* path, BooleanType isSparse, BooleanType useHotstarts,
const Options& options, int_t maxAllowedNWSR,
real_t& maxNWSR, real_t& avgNWSR, real_t& maxCPUtime, real_t& avgCPUtime,
real_t& maxStationarity, real_t& maxFeasibility, real_t& maxComplementarity
Expand All @@ -604,11 +604,11 @@ returnValue runOQPbenchmark( const char* path, BooleanType isSparse, BooleanType

/* I) SETUP BENCHMARK: */
/* 1) Obtain QP sequence dimensions. */
if ( readOQPdimensions( path, nQP,nV,nC,nEC ) != SUCCESSFUL_RETURN )
if ( readOqpDimensions( path, nQP,nV,nC,nEC ) != SUCCESSFUL_RETURN )
return THROWERROR( RET_BENCHMARK_ABORTED );

/* 2) Read OQP benchmark data. */
if ( readOQPdata( path,
if ( readOqpData( path,
nQP,nV,nC,nEC,
&H,&g,&A,&lb,&ub,&lbA,&ubA,
0,0,0
Expand All @@ -622,7 +622,7 @@ returnValue runOQPbenchmark( const char* path, BooleanType isSparse, BooleanType
/* II) SOLVE BENCHMARK */
if ( nC > 0 )
{
returnvalue = solveOQPbenchmark( nQP,nV,nC,nEC,
returnvalue = solveOqpBenchmark( nQP,nV,nC,nEC,
H,g,A,lb,ub,lbA,ubA,
isSparse,useHotstarts,
options,maxAllowedNWSR,
Expand All @@ -644,7 +644,7 @@ returnValue runOQPbenchmark( const char* path, BooleanType isSparse, BooleanType
}
else
{
returnvalue = solveOQPbenchmark( nQP,nV,
returnvalue = solveOqpBenchmark( nQP,nV,
H,g,lb,ub,
isSparse,useHotstarts,
options,maxAllowedNWSR,
Expand Down
6 changes: 3 additions & 3 deletions testing/cpp/test_bench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ int main( int argc, char *argv[] )
int_t nfail = 0, npass = 0;
int_t nproblems, i;
struct dirent **namelist;
char resstr[MAX_STRING_LENGTH], OQPproblem[MAX_STRING_LENGTH];
char resstr[MAX_STRING_LENGTH], oqpProblem[MAX_STRING_LENGTH];
char *problem;
returnValue returnvalue;

Expand Down Expand Up @@ -240,11 +240,11 @@ int main( int argc, char *argv[] )
fprintf(stdFile, "%-10s ", problem);
fflush(stdFile);

snprintf(OQPproblem, MAX_STRING_LENGTH, "../testing/cpp/data/problems/%s/", problem);
snprintf(oqpProblem, MAX_STRING_LENGTH, "../testing/cpp/data/problems/%s/", problem);
maxCPUtime = 300.0;
nWSR = 2500;

returnvalue = runOQPbenchmark( OQPproblem, isSparse, options,
returnvalue = runOqpBenchmark( oqpProblem, isSparse, options,
nWSR, maxCPUtime, maxStationarity, maxFeasibility, maxComplementarity
);
if (returnvalue == SUCCESSFUL_RETURN
Expand Down
4 changes: 2 additions & 2 deletions testing/cpp/test_constraintProduct1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,10 @@ int main( )
int_t k = 10; //th problem


if ( readOQPdimensions( path, nQP,nV,nC,nEC ) != SUCCESSFUL_RETURN )
if ( readOqpDimensions( path, nQP,nV,nC,nEC ) != SUCCESSFUL_RETURN )
return TEST_DATA_NOT_FOUND;

readOQPdata( path, nQP,nV,nC,nEC,
readOqpData( path, nQP,nV,nC,nEC,
&H,&g,&A,&lb,&ub,&lbA,&ubA,
0,0,0
);
Expand Down
4 changes: 2 additions & 2 deletions testing/cpp/test_constraintProduct2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,10 @@ int main( )
int_t k = 200; //th problem


if ( readOQPdimensions( path, nQP,nV,nC,nEC ) != SUCCESSFUL_RETURN )
if ( readOqpDimensions( path, nQP,nV,nC,nEC ) != SUCCESSFUL_RETURN )
return TEST_DATA_NOT_FOUND;

readOQPdata( path, nQP,nV,nC,nEC,
readOqpData( path, nQP,nV,nC,nEC,
&H,&g,&A,&lb,&ub,&lbA,&ubA,
0,0,0
);
Expand Down
6 changes: 3 additions & 3 deletions testing/cpp/test_hs268.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ int main( int argc, char *argv[] )
real_t maxCPUtime; /* seconds */
real_t maxStationarity = 0.0, maxFeasibility = 0.0, maxComplementarity = 0.0;

char OQPproblem[MAX_STRING_LENGTH];
char oqpProblem[MAX_STRING_LENGTH];
char problem[] = "HS268";
returnValue returnvalue;

Expand All @@ -71,11 +71,11 @@ int main( int argc, char *argv[] )
fprintf(stdFile, "%-10s ", problem);
fflush(stdFile);

snprintf(OQPproblem, MAX_STRING_LENGTH, "../testing/cpp/data/problems/%s/", problem);
snprintf(oqpProblem, MAX_STRING_LENGTH, "../testing/cpp/data/problems/%s/", problem);
maxCPUtime = 100.0;
nWSR = 100;

returnvalue = runOQPbenchmark( OQPproblem, isSparse, options,
returnvalue = runOqpBenchmark( oqpProblem, isSparse, options,
nWSR, maxCPUtime, maxStationarity, maxFeasibility, maxComplementarity
);

Expand Down
2 changes: 1 addition & 1 deletion testing/cpp/test_runAllOqpExamples.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ int main( )
maxFeasibility = 0.0;
maxComplementarity = 0.0;

if ( runOQPbenchmark( benchmarkPath[ii/2],
if ( runOqpBenchmark( benchmarkPath[ii/2],
isSparse,useHotstarts,
options,maxAllowedNWSR,
maxNWSR,avgNWSR,maxCPUtime,avgCPUtime,
Expand Down
2 changes: 1 addition & 1 deletion testing/cpp/test_sebastien1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#include <qpOASES/UnitTesting.hpp>


/** Example for qpOASES main function using the OQP interface. */
/** qpOASES main function defining a unit test. */
int main( )
{
REFER_NAMESPACE_QPOASES real_t solution[2] = {0.0f, 0.0f};
Expand Down

0 comments on commit 6341699

Please sign in to comment.