Skip to content

Commit

Permalink
#38 and #37 complted and tested the Naive implementation of Nama
Browse files Browse the repository at this point in the history
  • Loading branch information
Ajay_kumar committed Oct 21, 2019
1 parent 0f9890d commit 159b71e
Show file tree
Hide file tree
Showing 13 changed files with 4,221 additions and 3,634 deletions.
2 changes: 1 addition & 1 deletion src/Engine.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public:
*
* @param network
* @param forecaster
* @todo remove `SmpcConfig` from here
* TODO remove `SmpcConfig` from here
*/
Engine( DwnNetwork *network,
ScenarioTree *scenarioTree,
Expand Down
229 changes: 150 additions & 79 deletions src/SmpcController.cu

Large diffs are not rendered by default.

63 changes: 53 additions & 10 deletions src/SmpcController.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,13 @@ protected:
* @param real_t step-size in the direction of the lbfgs direction
*/
real_t computeLineSearchLbfgsUpdate(real_t valueFbeYvar);
/*
* compute the line search update of the tau for the AME
* @param valueAmeYvar the value of the AME at the current dual variable Y
*
* @param real_t step-size of the lbfgs direction and fixed point residual
*/
real_t computeLineSearchAmeLbfgsUpdate(real_t valueAmeYvar);
/**
* This method executes the APG algorithm and returns the primal infeasibility.
* @return primalInfeasibilty;
Expand Down Expand Up @@ -283,6 +290,11 @@ protected:
* intialise the dual vectors in the optimisation algorithm
*/
void initialiseAlgorithm();
/*
* update the current and the previous fixed-point residual
* for NAMA algorithm
*/
void updateFixedPointResidualNamaAlgorithm();
/*
* deallocate the memory of the APG in the device
*/
Expand Down Expand Up @@ -487,11 +499,12 @@ protected:
/*
* pointer array to the previous fixed point residual
*/
real_t **devPtrVecFixedPointResidualXi;
real_t *devVecCurrentFixedPointResidualXi;
/*
* pointer array to the previous fixed point residual
* pointer to the previous fixed point residual
*/
real_t **devPtrVecFixedPointResidualPsi;
real_t *devVecCurrentFixedPointResidualPsi;

/* ----- quasi-newton direction ----- */
/**
* Pointer array for the vector required for solve step Xi
Expand Down Expand Up @@ -534,6 +547,22 @@ protected:
* pointer to the direction from the LBFGS psi in the device
*/
real_t *devVecLbfgsDirPsi;
/*
* Hessian oracle with respect to fixed point residual x
*/
real_t *devVecFixedPointXdir;
/*
* Hessian oracle with respect to fixed point residual x
*/
real_t *devVecFixedPointUdir;
/*
* Hessian oracle with respect to fixed point residual x
*/
real_t *devVecFixedPointPrimalXiDir;
/*
* Hessian oracle with respect to fixed point residual x
*/
real_t *devVecFixedPointPrimalPsiDir;
/*
* pointer array to the device pointer of Hessian-direction in X
*/
Expand Down Expand Up @@ -580,19 +609,33 @@ protected:
* vector rho in the lbfgs-buffer rho_k = 1/(y_k*s_k)
*/
real_t *lbfgsBufferRho;

/*
* current col of the lbfgs buffer
*/
uint_t lbfgsBufferCol;

/*
* memory of the lbfgs buffer
*/
uint_t lbfgsBufferMemory;

/*
* skip count of the lbfgs buffer
*/
uint_t lbfgsSkipCount;

/*
* inverse Hessian with the lbfgs
*/
real_t lbfgsBufferHessian;

/*
* value of the proximal function of g with state box
*/
real_t valueFunGxBox;

/*
* value of the proximal function of g with state safe volume
*/
real_t valueFunGxSafe;

/*
* value of the proximal function of g with control box
*/
real_t valueFunGuBox;

/**
Expand Down
1 change: 1 addition & 0 deletions src/main.cu
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ int main(void){
//Testing *otherTesting = new Testing();
//_ASSERT( otherTesting->testSmpcFbeController() );
_ASSERT( myTesting->testSmpcFbeController() );
_ASSERT( myTesting->testSmpcNamaController() );
//myTesting->testNewEngineTesting();
}else{
startTicToc();
Expand Down
Loading

0 comments on commit 159b71e

Please sign in to comment.