Skip to content

Commit

Permalink
Resolved the conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Sharwan Tiwari authored and Sharwan Tiwari committed Jun 10, 2024
2 parents f5a5dd7 + 93b0286 commit 7023e1e
Show file tree
Hide file tree
Showing 26 changed files with 577 additions and 6,245 deletions.
40 changes: 6 additions & 34 deletions .github/workflows/generate-and-submit-documentation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,59 +3,31 @@ on:
push:
branches:
- main

permissions: write-all
jobs:
generate-documentation:
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main' && github.event.pull_request.head.ref == 'develop'
runs-on: ubuntu-latest
runs-on: self-hosted-k3s
steps:
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
fetch-depth: 0

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build
uses: docker/build-push-action@v4
id: built-image
with:
context: .
file: ./docker/Dockerfile
push: false
load: true
tags: claasp-lib
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
- name: Generate documentation
run: docker run --rm -v $PWD:/home/sage/tii-claasp claasp-lib make doc
run: make doc

- name: Commit & Push changes
uses: actions-js/push@master
with:
github_token: ${{ secrets.AUTHORIZATION_TOKEN }}
branch: 'main'
github_token: ${{ secrets.GITHUB_TOKEN }}
message: "Update documentation"

- name: Update develop branch
uses: morbalint/git-merge-action@v1
with:
target: 'develop'
source: 'main'
token: ${{ secrets.AUTHORIZATION_TOKEN }}
strategy_options: 'ours'
token: ${{ secrets.WORKFLOW_TOKEN }}
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ DOCKER_IMG_NAME=claasp
CURRENT_BRANCH=`git rev-parse --abbrev-ref HEAD`

all: install
if [ $(CURRENT_BRANCH) == "master" ]; then\
if [ $(CURRENT_BRANCH) == "main" ]; then\
$(SAGE_BIN) setup.py testall;\
else\
$(SAGE_BIN) -t `{ git diff --name-only "*.py" ; git diff --name-only --staged "*.py"; } | uniq`;\
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2.4.0
v2.5.0
Original file line number Diff line number Diff line change
Expand Up @@ -83,23 +83,48 @@ def build_xor_differential_trail_model(self, weight=-1, fixed_variables=[]):
self._variables_list.extend(variables)
self._model_constraints.extend(constraints)

if self._window_size_full_window_vars != None:
if self._window_size_full_window_vars is not None:
self._variables_list.extend(self._window_size_full_window_vars)

if self._window_size_full_window_operator == 'at_least':
greater_or_equal = True
else:
greater_or_equal = False

if self._window_size_number_of_full_window == 0:
all_ones_dummy_variables, all_ones_constraints = [], [f'-{variable}' for variable in self._window_size_full_window_vars]
else:
self._variables_list.extend([])
self._model_constraints.extend([f'-{variable}' for variable in self._window_size_full_window_vars])
return


if self._window_size_full_window_operator == 'at_least':
all_ones_dummy_variables, all_ones_constraints = self._sequential_counter_algorithm(
self._window_size_full_window_vars,
self._window_size_number_of_full_window - 1,
'dummy_all_ones_at_least',
greater_or_equal=True
)
elif self._window_size_full_window_operator == 'at_most':
all_ones_dummy_variables, all_ones_constraints = self._sequential_counter_algorithm(
self._window_size_full_window_vars,
self._window_size_number_of_full_window,
'dummy_all_ones_0',
greater_or_equal=greater_or_equal
'dummy_all_ones_at_most',
greater_or_equal=False
)
elif self._window_size_full_window_operator == 'exactly':
all_ones_dummy_variables1, all_ones_constraints1 = self._sequential_counter_algorithm(
self._window_size_full_window_vars,
self._window_size_number_of_full_window,
'dummy_all_ones_at_least',
greater_or_equal=True
)
all_ones_dummy_variables2, all_ones_constraints2 = self._sequential_counter_algorithm(
self._window_size_full_window_vars,
self._window_size_number_of_full_window,
'dummy_all_ones_at_most',
greater_or_equal=False
)
all_ones_dummy_variables = all_ones_dummy_variables1 + all_ones_dummy_variables2
all_ones_constraints = all_ones_constraints1 + all_ones_constraints2
else:
raise ValueError(f'Unknown operator {self._window_size_full_window_operator}')


self._variables_list.extend(all_ones_dummy_variables)
self._model_constraints.extend(all_ones_constraints)

Expand Down Expand Up @@ -474,6 +499,10 @@ def set_window_size_heuristic_by_component_id(
def window_size_number_of_full_window(self):
return self._window_size_number_of_full_window

@property
def window_size_full_window_vars(self):
return self._window_size_full_window_vars

@property
def window_size_by_round_values(self):
return self._window_size_by_round_values
Expand Down
Loading

0 comments on commit 7023e1e

Please sign in to comment.